Monday, July 18, 2016

finance - Separate market and limit orders from market depth/tick data


From the website https://www.algoseek.com/equities/, we can get a sample of the full depth market/tick data. From the paper https://arxiv.org/pdf/1710.03870.pdf page 8, I would like to extract the market orders and limit orders separately with timestamp of 1 second . Is it possible to do such a thing? If so, how?



Answer






  1. download the data




  2. open Jupyter Notebook





import pandas as pd


data = pd.read_csv('IBM.FullDepth.20140128.csv', parse_dates=[['Date', 'Timestamp']])

data['EventType'].unique()


array(['ADD BID', 'ADD ASK', 'DELETE ASK', 'DELETE BID', 'TRADE ASK', 'EXECUTE BID', 'FILL BID', 'TRADE BID', 'FILL ASK', 'EXECUTE ASK', 'CROSS', 'CANCEL ASK', 'CANCEL BID'], dtype=object)




grouped = data.groupby(pd.Grouper(key='Date_Timestamp', freq='1s'))
groups = grouped.groups

keys = list(groups.keys())

df=grouped.get_group(keys[0])
df[df.EventType=='ADD BID']

enter image description here


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...