Custom Data Source
The backtest system can use a custom data source instead of the platform's historical data: set the exchange's data source in the backtest configuration to the custom data source (feeder) address, and during the backtest the platform's data server requests that URL with the GET method, so the URL must be reachable from the public internet. The request carries these parameters:
| Parameter | Meaning | Description |
|---|---|---|
| symbol | Symbol name | Spot like BTC_USDT, futures like BTC_USDT.swap; funding rate and price index: see below |
| eid | Exchange | For example: OKX, Futures_OKX |
| round | Data precision | Always round=true: values are integers scaled by precision; see Data Format |
| period | K-line data period (milliseconds) | For example: 60000 represents a 1-minute period |
| depth | Order book depth levels | 1-20 |
| trades | Whether trade-by-trade data is required | Yes (1) / No (0); always 0 in simulated-tick backtests |
| from | Start time | Unix timestamp in seconds |
| to | End time | Unix timestamp in seconds |
| detail | Instrument details | Always detail=true: the response must include the instrument details |
| event | Request type | feed: market data requested when the backtest starts; fill: older K-lines when there are not enough bars |
| custom | -- | This parameter can be ignored |
- Perpetual contract backtests also request funding rate data (
symbollikeBTC_USDT.funding) and price index data (symbollikeBTC_USDT.index); seeData Format. event=fillrequests always carrydepth=2&trades=0&custom=0, withperiod900000or86400000.
Example requests sent by the backtest system to a custom data source (one for a spot and one for a futures exchange object):
url
http://customserver:9090/data?custom=0&depth=20&detail=true&eid=Bitget&event=feed&from=1351641600&period=86400000&round=true&symbol=BTC_USDT&to=1611244800&trades=0
http://customserver:9090/data?custom=0&depth=20&detail=true&eid=Futures_OKX&event=feed&from=1351641600&period=86400000&round=true&symbol=BTC_USDT.swap&to=1611244800&trades=0
In this sectionRead the whole section
| Name | Description |
| Data Format | A custom data source returns JSON in one of the two formats below, recognized automatically: simulated-tick backtests use K-line data, real-tick backtests use o… |
| Custom Data Source Example | A minimal custom data source service written in Go, and a test strategy to check it. |