Available Data Fields
Data Structure Overview
The system provides market data through two main interfaces:
- The
data
object (passed toonBar
function) - Contains arrays of historical values - The
candle
object (passed toonNewBar
method) - Contains single row of current values
Both objects share the same fields but are structured differently:
// Single candle data structure (used in onNewBar)
interface Candle {
open: number; // Opening price
high: number; // Highest price
low: number; // Lowest price
close: number; // Closing price
buy_volume: number; // Buy volume
sell_volume: number; // Sell volume
number_of_buys: number; // Number of buy transactions
number_of_sells: number; // Number of sell transactions
minute: string; // Timestamp
token_address: string; // Token identifier
}
// Historical data structure (used in onBar)
interface Data {
open: number[]; // Array of opening prices
high: number[]; // Array of highest prices
low: number[]; // Array of lowest prices
close: number[]; // Array of closing prices
buy_volume: number[]; // Array of buy volumes
sell_volume: number[]; // Array of sell volumes
number_of_buys: number[]; // Array of buy transaction counts
number_of_sells: number[]; // Array of sell transaction counts
minute: string[]; // Array of timestamps
token_address: string[]; // Array of token identifiers
}
Usage Context
- In strategy's
onBar
: Thedata
object contains arrays where each field is an array of historical values - In indicator's
onNewBar
: Thecandle
object contains a single row where each field is the current value
This dual structure allows for both historical analysis and real-time processing of market data. When using the data
object, each array contains the full history up to the current bar, while the candle
object provides just the latest values.