In [16]:
import pickle
from matplotlib import pyplot as plt
import ast
In [11]:
items = pickle.load(open("/work/eng/eliavb/polyakov/samples.pkl"))
In [33]:
# bid - represents the maximum price that a buyer or buyers are willing to pay
# ask - represents the minimum price that a seller or sellers are willing to receive
for item in items:
before = item[0]
after = item[1]
#print before, after, after - before
order_book = item[2]
order_book = ast.literal_eval(order_book)
bids = order_book["bids"]
asks = order_book["asks"]
b_v = [float(b[1]) for b in bids]
b_p = [float(b[0]) for b in bids]
plt.plot(b_p, b_v)
min_bid = min([float(b[0]) for b in bids])
max_ask = min([float(a[0]) for a in asks])
a_v = [float(b[1]) for b in asks]
a_p = [float(b[0]) for b in asks]
#print min_bid, max_ask
break
In [34]:
plt.plot(a_p, a_v)
Out[34]:
In [ ]: