The resource loading... loading...

SetData-data

The JSON is used to set the data to be loaded by the exchange.SetData() function. The JSON data is an array structure, in which each element is also an array, namely [time, data].

The timestamp of the data, marking the time of this data. time number data is a piece of data corresponding to a certain time in the data loaded by the exchange.SetData() function. When the strategy is running, the exchange.GetData() function gets the data with the corresponding timestamp according to the current time.

data string, number, bool, object, array, etc.

An example of loading data in the backtesting system and retrieving data when the strategy backtest is running:

/*backtest
start: 2020-01-21 00:00:00
end: 2020-02-12 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Bitfinex","currency":"BTC_USD"}]
*/
function main() {
    exchange.SetData("test", [[1579536000000, _D(1579536000000)], [1579622400000, _D(1579622400000)], [1579708800000, _D(1579708800000)]])
    while(true) {
        Log(exchange.GetData("test"))
        Sleep(1000 * 60 * 60 * 24)
    }
}

{@fun SetData}, {@fun GetData}

KLineChart-options EventLoop-return