forked from tonyarroyave/BitsoTicker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrice_Hour_BTC.py
More file actions
23 lines (21 loc) · 858 Bytes
/
Copy pathPrice_Hour_BTC.py
File metadata and controls
23 lines (21 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import bitso
import csv
import time
with open('BTC_Price.csv', 'w') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(['TIME','ASK','BID','HIGH','LAST','LOW','VWAP','VOLUME'])
api = bitso.Api()
transcurrido = 0
while(True):
print('Sigo vivo...')
if (transcurrido >= 1799):
transcurrido = 0
tick = api.ticker('btc_mxn')
with open('BTC_Price.csv', 'a') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow([tick.created_at,tick.ask,tick.bid,tick.high,tick.last,tick.low,tick.vwap,tick.volume])
print('Tengo valores :D!')
time.sleep(10)
transcurrido = transcurrido + 10