资源加载中... loading...

Data Format

The returned format must be one of the following two formats (which will be recognized by the system automatically):

  • Simulation level Tick, the following is an example of JSON data:

    {
        "detail": {
            "eid": "Binance",
            "symbol": "BTC_USDT",
            "alias": "BTCUSDT",
            "baseCurrency": "BTC",
            "quoteCurrency": "USDT",
            "marginCurrency": "USDT",
            "basePrecision": 5,
            "quotePrecision": 2,
            "minQty": 0.00001,
            "maxQty": 9000,
            "minNotional": 5,
            "maxNotional": 9000000,
            "priceTick": 0.01,
            "volumeTick": 0.00001,
            "marginLevel": 10
        },
        "schema":["time", "open", "high", "low", "close", "vol"],
        "data":[
            [1564315200000, 9531300, 9531300, 9497060, 9497060, 787],
            [1564316100000, 9495160, 9495160, 9474260, 9489460, 338]
        ]
    }
    
  • Bot level tick, the following is an example of JSON data: Tick-level backtest data (contains information on the depth of the market, and the depth format is an array of [price, volume]. It can have multiple levels of depth, asks for price ascending order, bids for price descending order).

    {
        "detail": {
            "eid": "Binance",
            "symbol": "BTC_USDT",
            "alias": "BTCUSDT",
            "baseCurrency": "BTC",
            "quoteCurrency": "USDT",
            "marginCurrency": "USDT",
            "basePrecision": 5,
            "quotePrecision": 2,
            "minQty": 0.00001,
            "maxQty": 9000,
            "minNotional": 5,
            "maxNotional": 9000000,
            "priceTick": 0.01,
            "volumeTick": 0.00001,
            "marginLevel": 10
        },
        "schema":["time", "asks", "bids", "trades", "close", "vol"],
        "data":[
            [1564315200000, [[9531300, 10]], [[9531300, 10]], [[1564315200000, 0, 9531300, 10]], 9497060, 787],
            [1564316100000, [[9531300, 10]], [[9531300, 10]], [[1564316100000, 0, 9531300, 10]], 9497060, 787]
        ]
    }
    
Field Description
detail Detailed information on the requested data type,

including the name of the denominated currency, the name of the trading currency, the precision, the minimum order quantity, etc. | | schema | It specifies the attributes of the columns in the data array, which is case sensitive and is only limited to time, open, high, low, close, vol, asks, bids, trades| | data | The column structure, recorded data according to the schema settings.|

detail field

Field Description
eid Exchange Id, please note that the spot and futures of a
certain exchange have different eids.
symbol Trading product code
alias The symbol in the exchange corresponding to the current
trading product code
baseCurrency Trading Currency
quoteCurrency Denominated Currency
marginCurrency Margin Currency
basePrecision Transaction Currency Accuracy
quotePrecision Pricing Currency Accuracy
minQty Minimum Order Quantity
maxQty Maximum Order Quantity
minNotional Minimum Order Amount
maxNotional Maximum Order Amount
priceTick Price Jump
volumeTick Minimum change value of order quantity (one jump in
order quantity)
marginLevel Futures Leverage Value
contractType For perpetual contracts set to: swap, the

backtest system will continue to send funding rate and price index requests |

Special column attributes asks, bids, trades:

Field Description Remarks
asks / bids [[price, volume], …] For example, the data in

the Live Trading Level Tick data example: [[9531300, 10]] | | trades | [[time,direction(0:buy,1:sell),price,volume], …] | For example, the data in the Live Trading Level Tick data example: [[1564315200000, 0, 9531300, 10]] |

When backtesting perpetual contracts on futures exchanges, custom data sources also require additional funding rate data and price index data. The backtesting system will continue to send requests for funding rates only when the requested market data is returned and the detail field in the returned structure contains the "contractType": "swap" key-value pair.

When the backtesting system receives funding rate data, it will continue to send requests for price index data.

The funding rate data structure is as follows:

{
    "detail": {
        "eid": "Futures_Binance",
        "symbol": "BTC_USDT.funding",
        "alias": "BTC_USDT.funding",
        "baseCurrency": "BTC",
        "quoteCurrency": "USDT",
        "marginCurrency": "",
        "basePrecision": 8,
        "quotePrecision": 8,
        "minQty": 1,
        "maxQty": 10000,
        "minNotional": 1,
        "maxNotional": 100000000,
        "priceTick": 1e-8,
        "volumeTick": 1e-8,
        "marginLevel": 10
    },
    "schema": [
        "time",
        "open",
        "high",
        "low",
        "close",
        "vol"
    ],
    "data": [
        [
            1584921600000,
            -16795,
            -16795,
            -16795,
            -16795,
            0
        ],
        [
            1584950400000,
            -16294,
            -16294,
            -16294,
            -16294,
            0
        ]
        // ...
    ]
}
  • The interval between adjacent periods is 8 hours
  • For example, Binance’s funding rate is updated every 8 hours. Why is the funding rate data -16795? Because like K-line data, in order to avoid the loss of floating point precision during network transmission, the data uses integer type; the funding rate data may also be negative.

An example of a funding rate data request from the backtesting system is:

http://customserver:9090/data?custom=0&depth=20&detail=true&eid=Futures_Binance&from=1351641600&period=86400000&round=true&symbol=BTC_USDT.funding&to=1611244800&trades=0

The price index data structure is as follows:


{
    "detail": {
        "eid": "Futures_Binance",
        "symbol": "BTC_USDT.index",
        "alias": "BTCUSDT",
        "baseCurrency": "BTC",
        "quoteCurrency": "USDT",
        "contractType": "index",
        "marginCurrency": "USDT",
        "basePrecision": 3,
        "quotePrecision": 1,
        "minQty": 0.001,
        "maxQty": 1000,
        "minNotional": 0,
        "maxNotional": 1.7976931348623157e+308,
        "priceTick": 0.1,
        "volumeTick": 0.001,
        "marginLevel": 10,
        "volumeMultiple": 1
    },
    "schema": [
        "time",
        "open",
        "high",
        "low",
        "close",
        "vol"
    ],
    "data": [
        [1584921600000, 58172, 59167, 56902, 58962, 0],
        [1584922500000, 58975, 59428, 58581, 59154, 0],
        // ...
    ]
}

An example of a price index data request sent by the backtesting system is:

http://customserver:9090/data?custom=0&depth=20&detail=true&eid=Futures_Binance&from=1351641600&period=86400000&round=true&symbol=BTC_USDT.index&to=1611244800&trades=0
Save Backtest Settings Example for Custom Data Source