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
download the data
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']
No comments:
Post a Comment