Bitcoin Forum

Bitcoin => Project Development => Topic started by: pangu on April 24, 2013, 07:44:21 PM



Title: mtgoxapi php / ticker
Post by: pangu on April 24, 2013, 07:44:21 PM
with:
https://github.com/1360/mtgox-api-v1-php-class/blob/master/mtGox.class.php
+
Quote
echo '<pre>' . print_r($gox->getTicker(),true) . '</pre>';
i get:
Quote
Array
(
    [high] => Array
        (
            [value] => 125.90000
            [value_int] => 12590000
            [display] => 125.90000 €
            [display_short] => 125.90 €
            [currency] => EUR
        )

    [low] => Array
        (
            [value] => 103.00000
            [value_int] => 10300000
            [display] => 103.00000 €
            [display_short] => 103.00 €
            [currency] => EUR
        )

    [avg] => Array
        (
            [value] => 115.72957
            [value_int] => 11572957
            [display] => 115.72957 €
            [display_short] => 115.73 €
            [currency] => EUR
        )

    [vwap] => Array
        (
            [value] => 116.30918
            [value_int] => 11630918
            [display] => 116.30918 €
            [display_short] => 116.31 €
            [currency] => EUR
        )

    [vol] => Array
        (
            [value] => 20741.48337502
            [value_int] => 2074148337502
            [display] => 20,741.48337502 BTC
            [display_short] => 20,741.48 BTC
            [currency] => BTC
        )

    [last_local] => Array
        (
            [value] => 113.50000
            [value_int] => 11350000
            [display] => 113.50000 €
            [display_short] => 113.50 €
            [currency] => EUR
        )

    [last_orig] => Array
        (
            [value] => 146.20000
            [value_int] => 14620000
            [display] => $146.20000
            [display_short] => $146.20
            [currency] => USD
        )

    [last_all] => Array
        (
            [value] => 112.54811
            [value_int] => 11254811
            [display] => 112.54811 €
            [display_short] => 112.55 €
            [currency] => EUR
        )

    [last] => Array
        (
            [value] => 113.50000
            [value_int] => 11350000
            [display] => 113.50000 €
            [display_short] => 113.50 €
            [currency] => EUR
        )

    [buy] => Array
        (
            [value] => 113.50000
            [value_int] => 11350000
            [display] => 113.50000 €
            [display_short] => 113.50 €
            [currency] => EUR
        )

    [sell] => Array
        (
            [value] => 114.49000
            [value_int] => 11449000
            [display] => 114.49000 €
            [display_short] => 114.49 €
            [currency] => EUR
        )

    [item] => BTC
    [now] => 1366832440861482
)
-> how can i read out only ONE value, e.g. the last price to buy:
Quote
[buy][value_int]
= 11350000
? thx


Title: Re: mtgoxapi php / ticker
Post by: minzie on April 24, 2013, 09:30:49 PM
A good example of how simple the APIs are to use.


Title: Re: mtgoxapi php / ticker
Post by: ebildude123 on April 24, 2013, 10:38:02 PM
$arr = $gox->getTicker();
$val = $arr["buy"]["value_int"];
echo $val;