Skip to content

Instantly share code, notes, and snippets.

@mzupan
Last active August 29, 2015 14:00
Show Gist options
  • Save mzupan/11375306 to your computer and use it in GitHub Desktop.
Save mzupan/11375306 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from termcolor import colored
import requests
import time
while True:
ltc = requests.get("https://btc-e.com/api/2/ltc_usd/ticker").json()
btc = requests.get("https://btc-e.com/api/2/btc_usd/ticker").json()
sellratio = 1.0 / (1.0 / (float(ltc['ticker']['sell'] / float(btc['ticker']['sell']))))
buyratio = 1.0 / (1.0 / (float(ltc['ticker']['buy'] / float(btc['ticker']['buy']))))
print colored("Buy Ratio is: %.5f" % buyratio, "green"), colored("Sell Ratio is: %.5f" % sellratio, "red")
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment