Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update call all apis - exchanges.py #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions call all apis - exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ def btstamp():
bitStampTick = requests.get('https://www.bitstamp.net/api/ticker/')
return bitStampTick.json()['last'] # replace last with timestamp etc

def btceBU():
btceBtcTick = requests.get('https://btc-e.com/api/2/btc_usd/ticker')
return btceBtcTick.json()['ticker']['last'] # replace last with updated etc

def btceBL():
btceLtcTick = requests.get('https://btc-e.com/api/2/ltc_btc/ticker')
return btceLtcTick.json()['ticker']['last'] # replace last with updated etc

def bitfinex():
bitFinexTick = requests.get("https://api.bitfinex.com/v1/ticker/btcusd")
return bitFinexTick.json()['last_price']
Expand All @@ -43,22 +35,17 @@ def kraken():

while True:
btstampUSDLive = float(btstamp())
btceUSDLive = float(btceBU())
btceLTCinBTCLive = float(btceBL())
coinbUSDLive = float(coinbase())
krakenUSDLive = float(kraken())
bitfinexUSDLive = float(bitfinex())

print "Bitstamp Price in USD =", btstampUSDLive
print "BTC-e Price in USD =", btceUSDLive
print "Coinbase Price in USD =", coinbUSDLive
print "Kraken Price in USD =", krakenUSDLive
print "Bitfinex Price in USD =", bitfinexUSDLive
print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
print "BTC USD Average = ",
print (krakenUSDLive + coinbUSDLive + btceUSDLive + btstampUSDLive + bitfinexUSDLive) / 5
print (krakenUSDLive + coinbUSDLive + btstampUSDLive + bitfinexUSDLive) / 5
print "difference betweeen coinbase and bitstamp", (coinbUSDLive - btstampUSDLive)
print "BTC-e LTC Price in BTC", btceLTCinBTCLive
print "BTC-e LTC Price in USD =", btceLTCinBTCLive * btceUSDLive, "USD"
print; print; print "=-=-=-=-=-=-=--=-=-=-"; print;
time.sleep(2) # 120 equals two minutes, you can ping it every second by putting a 1 in here