Type/to search
Built-in Functions
Structures
Trade
Ticker
Record
Order
Condition
OrderBook
Depth
Account
Asset
Position
Market
Funding
OtherStruct
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Chart-options
KLineChart-options
SetData-data
EventLoop-return
DBExec-return
Thread.join-return
Built-in Variables

This JSON is used to set the data to be loaded by the exchange.SetData() function. This JSON data uses an array structure, where each element is also an array with the format [time, data].

Attributes

NameTypeDescription

time

number

The timestamp of the data, used to mark the time corresponding to this data entry.

data

string / number / bool / object / array / any (any type supported by the platform)

data is the specific data content corresponding to a certain time in the data loaded by the exchange.SetData() function. When the strategy is running, the exchange.GetData() function retrieves the data with the corresponding timestamp based on the current time.

See Also

Remarks

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

javascript
/*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) } }