Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample limit order book export to csv... #2

Open
DanielRonnstam opened this issue Mar 22, 2019 · 7 comments
Open

Sample limit order book export to csv... #2

DanielRonnstam opened this issue Mar 22, 2019 · 7 comments

Comments

@DanielRonnstam
Copy link

Hello. For research purposes, I need a script that can parse a message flow of Level II limit order data (order, delete, modify, trades etc), and sample the order book to a CSV for each ticker symbol (stock) in the following format;

  • Date.
  • Day of week.
  • Timestamp, milliseconds from midnight (interval to be set in script command, 1 sec to 10 min interval).
  • bidprice_level_1
  • bidvolume_level_1
  • askprice_level_1
  • askvolume_level_1
  • bidprice_level_2
  • etc.. to level 20.

The messages are converted from Nasdaq ITCH 5.0 and are loaded into an R data.table, or exported to CSV. I have this already from another script.

Can your script do this sampling? Or can it be easily modified to do the sampling? Or, do you know some other script that can? thanks

@RJ2000
Copy link

RJ2000 commented Mar 30, 2019

How are you getting TotalView ITCH data? Who’s is the data provider?

@DanielRonnstam
Copy link
Author

I downloaded the file from nasdaqs demo server. It contains level 2 data for all instruments in the exchanges the cover, during one day. I will use this data for testing the script.

@RJ2000
Copy link

RJ2000 commented Mar 30, 2019

I don’t think you have enough data if you only got the snapshot. It’s easy to transform the data by timestamp.

@RJ2000
Copy link

RJ2000 commented Mar 30, 2019

where is the link to the sample data?

@phil8192
Copy link
Owner

phil8192 commented Apr 1, 2019

Hi @DanielRonnstam, It has been a while since I've done anything with this code - There is likely something much nicer out there that can do what you want. I am however planning to make some changes so that it can take as input a CSV containing limit order events and output a CSV with summary stats for each LOB update.

Sticking to basic limit order types, the input CSV might look like:

order_id, local_timestamp, exchange_timestamp, price, volume, action, direction

Where order_id = Unique limit order id, local_timestamp (optional) time limit order event recorded, exchange_timestamp = time of limit order event, price = limit order price, volume = limit order volume, action = one of added, deleted, updated (update may be for price and/or volume), direction = Bid or Ask.

@RJ2000
Copy link

RJ2000 commented Apr 1, 2019

That would be great @phil8192 are you able to get LOB data for stocks?

@DanielRonnstam
Copy link
Author

Thanks. With LOB update, what do you mean? Do you know of any other order book sampling script that does what I need it to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants