#!/usr/bin/python
import time
import urllib2
import urllib
import json
import os
def get(arg):
return json.load(urllib2.urlopen(arg))
def precio():
return get("https://www.bitstamp.net/api/ticker/")['last']
def precioconst():
while 1:
time.sleep(1)
print precio()
def orderbook(bids,asks,pr,i):
bid1=[]
ask1=[]
a=" BIDS "+str(pr)+" ASKS\n\n $ BTC $ BTC "+ str(i)+"\n--------------------------------------------------------------\n"
for i in range(0,len(bids)):
bid1.append(bids)
for i in range(0,len(asks)):
ask1.append(asks)
for i in range(0,32):
a+=str(bid1
- )+" "+str(bid1[1])+" "+str(ask1
- )+" "+ask1[1]+'\n'
print "ORDER BOOK"
i=0
pr=0
z=1
while z:
try:
i=i+1
a=get("https://www.bitstamp.net/api/order_book/")
bids= a['bids']
asks= a['asks']
os.system('clear')
print orderbook(bids,asks,pr,i)
time.sleep(1)
pr=precio()
os.system('clear')
i=i+1
print orderbook(bids,asks,pr,i)
time.sleep(1)
except:
z=0
print("\n")
# por 01835113