crypto-chassis / ccapi

A header-only C++ library for interacting with crypto exchanges. Bindings for Python, Java, C#, Go, and Javascript are provided.
https://discord.gg/b5EKcp9s8T
MIT License
568 stars 196 forks source link

Is backtest mode support microseconds history data ? #247

Closed ericyue closed 2 years ago

ericyue commented 2 years ago

Thanks for the great repo! I saw the config files writes the history data format is 'time_seconds,price,size,is_buyer_maker', So I'm wondering if the backtest mode support more higher frequency than seconds? (some data I collect myself through websocket to exchanges ) Do I need to do some modifcation in source and config file?

another small question, by using the api crpyto-chassis provided, how to download a more frequent data such as less than one seconds? or maby I can only collect by myself ?

cryptochassis commented 2 years ago

For trades, it is tick data, the time_seconds will have a fraction part. For order book data, it is 1-second granularity. So far I haven't found time modify the backtest code to accommodate for less than 1 second granularity order book data which will be a major revision. Also the order book data that we can provide is 1 second so that we can keep the cost under control. Thank you for your interest in our repository.

ericyue commented 2 years ago

Thanks for reply! Another three questions: 1、can I use 200ms trades tick data with 1-seconds orderbook for backtesting? or must be 1-second trade with 1-second book data? 2、why there's a limit for only can use 1-seconds orderbook for backtesting ? can you give me some advise about it ? 3、when live-trading , what's the data frequency? Is there still a limit for using a 1-second orderbook data?

cryptochassis commented 2 years ago

Thanks for reply! Another three questions: 1、can I use 200ms trades tick data with 1-seconds orderbook for backtesting? or must be 1-second trade with 1-second book data? 2、why there's a limit for only can use 1-seconds orderbook for backtesting ? can you give me some advise about it ? 3、when live-trading , what's the data frequency? Is there still a limit for using a 1-second orderbook data?

[1] uh, what do you mean by 200ms trades tick data? So trades tick data are tick data without any aggregation. [2] If you use our market making app, then the backtest engine walk through the order book data in one-second clock ticks. If you have your own backtest engine, then any granularity will work. You'd just create a stream of Events in chronological order and walk through them one by one by calling processEvent(event). [3] If you use our market making app, then the data frequency is 1 second. Otherwise if you really need order book tick by tick then https://github.com/crypto-chassis/ccapi/blob/v5.27.0/app/src/spot_market_making/config.env.example#L79. Let me know whether the answers are satisfactory or not. If you have more questions, feel free to message me on https://discord.gg/b5EKcp9s8T.

ericyue commented 2 years ago

great! thanks for your advice!