Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

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

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) } }