jeremyis78 / JBookTrader

A Java ATS for market-depth-based trading strategies
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

Support candle-based trading strategies to minimize data subscription costs and data file sizes #10

Open jeremyis78 opened 5 years ago

jeremyis78 commented 5 years ago

While Eugene Kononov (the original author) has mentioned in charting it's possible to change candle size as is ("For charting, any time period in candle data is already supported. Take a look at com.jbooktrader.platform.chart.BarSize" https://groups.google.com/forum/#!topic/jbooktrader/RqLsinhbVYA); it's not possible to trade a candle-based strategy instead of a market-depth based strategy (I realize this goes against the name JBookTrader but hear me out; I'll come back to this point). Data files recorded and used for backtesting are currently recorded at one-second snapshots per line. As such it's

1) more expensive for level 2/market-depth subscriptions, and 2) for a longer-term strategy it requires very large data files at 1-second resolution (imagine 20 years of 1-second data).

To trade/backtest a medium-to-longer term strategy based on aggregated price data and not market-depth/book--for example, something that trades on daily OHLCV candles or 30-minute candles--there's no need to record more granular data than a candle-based strategy actually needs.

Also, with such a change, it brings up another issue: possibly introducing bid/ask prices where there is no notion of them in the project currently--only a fixed bidAskSpread (see Strategy.setStrategy(...)). But know my intent is to maintain the spirit of using JBT for trading highly liquid instruments, so I'd like to avoid using separate bid and ask prices in the candle-based strategies, if at all possible. What I don't know is if it would affect profitability of those strategies on highly liquid instruments (obviously it would on illiquid instruments but the project is not for trading those instruments). More research needed here.

NOTE: Implementing this feature may warrant changing the name of the project, too, as it will no longer only be a book trading project as it would have the ability to trade both types of strategies.