Using historical bid/ask record for back testing

Create issue
Issue #13 resolved
Max created an issue

Suppose I want to test some ideas of HFT strategy what sensitive to bid/ask spread and I have my own historical tick data in csv file not only for last price, but also bid/ask value for every tick. Can I use historical bid/ask record for back testing and how to do it right way?

Comments (3)

  1. Stanislav Kovalevsky repo owner

    You should be able to test on best bid offer data using execution_type = 'bbo' option. Here is corresponding part of documentation: Two execution types supported trade(default) and bbo. trade type processes orders using tick prices and bbo processes orders using preceding tick bid and ask values. Market orders in bbo mode executed at worst price: at bid for sells and at ask for buys, in trade mode at current tick price. Buy limit orders executed when ask goes under order price and sell orders executed when bid goes above order price. In case limit order is placed in the market it is executed as market order if allow_limit_to_hit_market set to TRUE (default is FALSE). Also please see list of available options ?Processor Options section. Regarding input data it should be data.table with following columns: time, price, volume, bid, ask.

  2. Max reporter

    Fantastic! Sounds like this is kind of thing, that I looking for for a long time. Thanks a lot for sharing your code!

  3. Log in to comment