diff --git a/btsxfeed/btsx_feed.py b/btsxfeed/btsx_feed.py
index 6d3a6bf..5dc6eac 100755
--- a/btsxfeed/btsx_feed.py
+++ b/btsxfeed/btsx_feed.py
@@ -42,6 +42,7 @@ def fetch_from_btc38():
price["CNY"].append(price_cny)
price["USD"].append(price_cny/rate_usd_cny)
price["GLD"].append(price_cny/rate_xau_cny)
+ price["EUR"].append(price_cny/rate_usd_cny*rate_usd_eur)
except:
print "Warning: unknown error"
return
@@ -59,16 +60,17 @@ def fetch_from_bter():
price["CNY"].append(price_cny)
price["USD"].append(price_cny/rate_usd_cny)
price["GLD"].append(price_cny/rate_xau_cny)
+ price["EUR"].append(price_cny/rate_usd_cny*rate_usd_eur)
except:
print "Warning: unknown error"
return
def get_rate_from_yahoo():
global headers
- global rate_usd_cny, rate_xau_cny
+ global rate_usd_cny, rate_xau_cny, rate_usd_eur
try:
url="http://download.finance.yahoo.com/d/quotes.csv"
- params = {'s':'USDCNY=X,XAUCNY=X','f':'l1','e':'.csv'}
+ params = {'s':'USDCNY=X,XAUCNY=X,USDEUR=X','f':'l1','e':'.csv'}
responce = requests.get(url=url, headers=headers,params=params)
pos = posnext = 0
posnext = responce.text.find("\n", pos)
@@ -78,6 +80,10 @@ def get_rate_from_yahoo():
posnext = responce.text.find("\n", pos)
rate_xau_cny = float(responce.text[pos:posnext])
print "Fetch: rate xau/cny", rate_xau_cny
+ pos = posnext + 1
+ posnext = responce.text.find("\n", pos)
+ rate_usd_eur = float(responce.text[pos:posnext])
+ print "Fetch: rate usd/eur", rate_usd_eur
except:
print "Warning: unknown error, try again after 1 seconds"
time.sleep(1)
@@ -122,6 +128,7 @@ def confirm():
rate_usd_cny = 0.0
rate_xau_cny = 0.0
+rate_usd_eur = 0.0
get_rate_from_yahoo()
price = {}
Maybe this helps
quick and durty ... gonna pimp it a little tomorrow ... going from btsx to cny to usd to eur is kind of .... ugly