Bitcoin Forum
July 05, 2024, 12:38:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with BTCe api USD/LTC price  (Read 6552 times)
tatsuchan (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 100



View Profile
November 24, 2012, 03:16:04 PM
 #1

Not trying to do anything complex here, but couldn't find an easy answer.  How do I get recent Litecoin price in USD for a website from BTCe?  I'd like to get a script going that I could post what the recent litecoin price is.
Greedi
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250


LitecoinTalk


View Profile WWW
November 24, 2012, 04:22:57 PM
 #2

<?
function GetJsonFeed($json_url)
{
    $feed = file_get_contents($json_url);
    return json_decode($feed, true);
}
$LTC_BTC = GetJsonFeed("https://btc-e.com/api/2/ltc_btc/ticker");
$LTC_BTC_HIGH = $LTC_BTC["ticker"]["high"];
$LTC_BTC_LOW = $LTC_BTC["ticker"]["low"];
$LTC_BTC_AVG = $LTC_BTC["ticker"]["avg"];
$LTC_BTC_VOL = $LTC_BTC["ticker"]["vol"];
$LTC_BTC_VOL_CUR = $LTC_BTC["ticker"]["vol_cur"];
$LTC_BTC_LAST = $LTC_BTC["ticker"]["last"];
$LTC_BTC_BUY = $LTC_BTC["ticker"]["buy"];
$LTC_BTC_SELL = $LTC_BTC["ticker"]["sell"];
$LTC_USD = GetJsonFeed("https://btc-e.com/api/2/ltc_usd/ticker");
$LTC_USD_HIGH = $LTC_USD["ticker"]["high"];
$LTC_USD_LOW = $LTC_USD["ticker"]["low"];
$LTC_USD_AVG = $LTC_USD["ticker"]["avg"];
$LTC_USD_VOL = $LTC_USD["ticker"]["vol"];
$LTC_USD_VOL_CUR = $LTC_USD["ticker"]["vol_cur"];
$LTC_USD_LAST = $LTC_USD["ticker"]["last"];
$LTC_USD_BUY = $LTC_USD["ticker"]["buy"];
$LTC_USD_SELL = $LTC_USD["ticker"]["sell"];
$BTC_USD = GetJsonFeed("https://btc-e.com/api/2/btc_usd/ticker");
$BTC_USD_HIGH = $BTC_USD["ticker"]["high"];
$BTC_USD_LOW = $BTC_USD["ticker"]["low"];
$BTC_USD_AVG = $BTC_USD["ticker"]["avg"];
$BTC_USD_VOL = $BTC_USD["ticker"]["vol"];
$BTC_USD_VOL_CUR = $BTC_USD["ticker"]["vol_cur"];
$BTC_USD_LAST = $BTC_USD["ticker"]["last"];
$BTC_USD_BUY = $BTC_USD["ticker"]["buy"];
$BTC_USD_SELL = $BTC_USD["ticker"]["sell"];
?>

using php Smiley

LitecoinTalk - Sign up today!
Try out LTC-Aarade!
Buy Shares!
tatsuchan (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 100



View Profile
November 24, 2012, 07:10:15 PM
 #3

Thank you sir!
01BTC10
VIP
Hero Member
*
Offline Offline

Activity: 756
Merit: 503



View Profile
April 07, 2013, 04:23:58 PM
 #4

Anyone know what is the minimum time between each API request without getting banned?
RyNinDaCleM
Legendary
*
Offline Offline

Activity: 2408
Merit: 1009


Legen -wait for it- dary


View Profile
April 07, 2013, 05:06:57 PM
 #5

Anyone know what is the minimum time between each API request without getting banned?

I was told by support 10-15 seconds

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!