Jump to content
Sign in to follow this  

Bitcoin premium exchange rate

Recommended Posts

$url = "https://btc-e.com/api/3/ticker/btc_usd";
$fileGet = file_get_contents($url);
$json = json_decode($fileGet, TRUE);
$json = $json["ticker"]["last"];
$premium = 5; //in percentage
$premium = $premium / 100;
$dollar_amount = $premium * $json;
$customer_price = $json + $dollar_amount;
echo $customer_price;

i was trying to display my own premiunm exchange rate.

i mean (Buy Bitcoin on my site at $.....).


 i was doing this by using the last exchange rate from btc-e.com/api/btc_usd.which was a jason.


  what i did is that i define my own percentage from there last exchange rate and i add that percentage to it.but it doesn't work.


 above is example of my code let say im working with addition of 5 percent.

please can i get a help ?



Share this post

Link to post
Share on other sites

I don't see a ["ticker"] anywhere in that JSON.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.