Available Market and Position Data
Custom strategies can leverage all available pair data through unique property names. The list below contains pre-calculated indicators based on your strategy's settings. While some indicators use standard inputs without configurable parameters, others offer customization options.
Pair data refers to specific information for a trading pair, like USDT-BTC, including current price, historical candle data, and calculated technical indicators.
Easily create custom trading strategies for Gunbot with this Visual Studio Code extension. There are pre-built snippets for all supported data points.
Property | Returns | Extra info |
---|---|---|
gb.data.config | object | Gunbot `config.js` contents. |
gb.data.pairLedger | object | Contains the complete pair ledger. Can also be used to store and access your own persistent variables. Make sure to not overwrite existing properties. This object holds the same data as seen in the pair JSON files. Most items listed below originate from the ledger as well; they are renamed for consistency and are already parsed as floating-point numbers. |
gb.data.pairName | string | Current pair name, like USDT-BTC |
gb.data.exchangeName | string | Current exchange name, like binance |
gb.data.balances | object | Object with all balances on same exchange |
gb.data.quoteBalance | float | Pair quote balance, like BTC balance on an USDT-BTC pair. Specific to spot trading. |
gb.data.baseBalance | float | Base balance, like USDT balance on an USDT-BTC pair. |
gb.data.onOrdersBalance | float | Quote balance value of open orders for the current pair. |
gb.data.openOrders | array | Open orders for the current pair. |
gb.data.orders | array | History of filled orders for the current pair. |
gb.data.orderbook | object | First 10 bid and ask entries in the orderbook, including price and volume. |
gb.data.breakEven | float | Break-even price for current spot holdings. Includes trading fees as defined in Gunbot exchange settings. |
gb.data.gotBag | boolean | Indicates if the value of quoteBalance for spot trading (including on-orders volume) exceeds the minimum volume to sell, as defined in the Gunbot strategy. |
gb.data.leverage | float | Leverage of the current futures position. |
gb.data.walletBalance | float | Wallet balance. Specific to futures. |
gb.data.availableMargin | float | Available margin balance. Specific to futures. |
gb.data.maintenanceMargin | float | Maintenance margin requirement for the futures account. |
gb.data.maxNotionalValue | float | Maximum notional value for a futures position at the current leverage. |
gb.data.totalPositionInitialMargin | float | Total initial position margin requirement for all current futures positions. |
gb.data.totalOpenOrderInitialMargin | float | Total initial margin requirement for open futures orders. |
gb.data.currentQty | float | Futures position size. |
gb.data.currentSide | string | Indicates current futures position side. Possible values: |
gb.data.liquidationPrice | float | Futures position liquidation price. |
gb.data.period | float | Candle size as set in the Gunbot strategy `PERIOD` setting. This period is used for all pre-calculated indicator values. |
gb.data.bid | float | Highest bid price. |
gb.data.ask | float | Lowest ask price. |
gb.data.ema1 | float | Latest EMA (Exponential Moving Average) indicator value. |
gb.data.ema2 | float | Latest EMA (Exponential Moving Average) indicator value. |
gb.data.ema3 | float | Latest EMA (Exponential Moving Average) indicator value. |
gb.data.BTCUSDprice | float | Latest BTC/USD price on the same exchange (or equivalent spot pair, depending on availability). |
gb.data.mfi | float | Latest MFI (Money Flow Index) indicator value. |
gb.data.rsi | float | Latest RSI (Relative Strength Index) indicator value. |
gb.data.lowBB | float | Latest low Bollinger Band indicator value. |
gb.data.highBB | float | Latest high Bollinger Band indicator value. |
gb.data.tenkan | float | Latest Tenkan-sen (Ichimoku Cloud) indicator value. |
gb.data.chikou | float | Latest Chikou Span (Ichimoku Cloud) indicator value. |
gb.data.kijun | float | Latest Kijun-sen (Ichimoku Cloud) indicator value. |
gb.data.senkouSpanA | float | Latest Senkou Span A (Ichimoku Cloud) indicator value. |
gb.data.senkouSpanB | float | Latest Senkou Span B (Ichimoku Cloud) indicator value. |
gb.data.fastSma | float | Latest fast SMA (Simple Moving Average) indicator value. |
gb.data.slowSma | float | Latest slow SMA (Simple Moving Average) indicator value. |
gb.data.R1 | float | Latest R1 (Pivot Point Resistance 1) indicator value. |
gb.data.S1 | float | Latest S1 (Pivot Point Support 1) indicator value. |
gb.data.R2 | float | Latest R2 (Pivot Point Resistance 2) indicator value. |
gb.data.S2 | float | Latest S2 (Pivot Point Support 2) indicator value. |
gb.data.macd | float | Latest MACD (Moving Average Convergence Divergence) line value. |
gb.data.macdSignal | float | Latest MACD signal line value. |
gb.data.macdHistogram | float | Latest MACD histogram value. |
gb.data.stochK | float | Latest %K line (Stochastic Oscillator) indicator value. |
gb.data.stochD | float | Latest %D line (Stochastic Oscillator) indicator value. |
gb.data.stochRsi | float | Latest Stochastic RSI indicator value. |
gb.data.atr | float | Latest ATR (Average True Range) indicator value. |
gb.data.fib | object | Object with high and low Fibonacci retracement levels. |
gb.data.vwma | float | Latest VWMA (Volume Weighted Moving Average) indicator value. |
gb.data.diPlus | float | Latest +DI (Positive Directional Indicator) value. |
gb.data.diMinus | float | Latest -DI (Negative Directional Indicator) value. |
gb.data.adx | float | Latest ADX (Average Directional Index) indicator value. |
gb.data.candlesOpen | array | Array of open values for OHLCV (Open, High, Low, Close, Volume) candles. Sorted old to new (newest last). |
gb.data.candlesHigh | array | Array of high values for OHLCV candles. Sorted old to new (newest last). |
gb.data.candlesLow | array | Array of low values for OHLCV candles. Sorted old to new (newest last). |
gb.data.candlesClose | array | Array of close values for OHLCV candles. Sorted old to new (newest last). |
gb.data.candlesVolume | array | Array of volume values for OHLCV candles. Sorted old to new (newest last). |
gb.data.candlesTimestamp | array | Array of timestamp values for OHLCV candles. Sorted old to new (newest last). |
gb.data.candles | object | Combined object with OHLCV candle data. |