Skip to main content

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.

Info

Pair data refers to specific information for a trading pair, like USDT-BTC, including current price, historical candle data, and calculated technical indicators.

Gunbot Snippets Extension

Easily create custom trading strategies for Gunbot with this Visual Studio Code extension. There are pre-built snippets for all supported data points.

Learn more about the VSCode Extension!

PropertyReturnsExtra info
gb.data.configobjectGunbot `config.js` contents.
gb.data.pairLedgerobject

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.pairNamestringCurrent pair name, like USDT-BTC
gb.data.exchangeNamestringCurrent exchange name, like binance
gb.data.balancesobjectObject with all balances on same exchange
gb.data.quoteBalancefloat

Pair quote balance, like BTC balance on an USDT-BTC pair.

Specific to spot trading.

gb.data.baseBalancefloatBase balance, like USDT balance on an USDT-BTC pair.
gb.data.onOrdersBalancefloatQuote balance value of open orders for the current pair.
gb.data.openOrdersarrayOpen orders for the current pair.
gb.data.ordersarrayHistory of filled orders for the current pair.
gb.data.orderbookobjectFirst 10 bid and ask entries in the orderbook, including price and volume.
gb.data.breakEvenfloatBreak-even price for current spot holdings. Includes trading fees as defined in Gunbot exchange settings.
gb.data.gotBagbooleanIndicates 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.leveragefloatLeverage of the current futures position.
gb.data.walletBalancefloatWallet balance. Specific to futures.
gb.data.availableMarginfloatAvailable margin balance. Specific to futures.
gb.data.maintenanceMarginfloatMaintenance margin requirement for the futures account.
gb.data.maxNotionalValuefloatMaximum notional value for a futures position at the current leverage.
gb.data.totalPositionInitialMarginfloatTotal initial position margin requirement for all current futures positions.
gb.data.totalOpenOrderInitialMarginfloatTotal initial margin requirement for open futures orders.
gb.data.currentQtyfloatFutures position size.
gb.data.currentSidestring

Indicates current futures position side.

Possible values: long, short, none.

gb.data.liquidationPricefloatFutures position liquidation price.
gb.data.periodfloat

Candle size as set in the Gunbot strategy `PERIOD` setting.

This period is used for all pre-calculated indicator values.

gb.data.bidfloatHighest bid price.
gb.data.askfloatLowest ask price.
gb.data.ema1floatLatest EMA (Exponential Moving Average) indicator value.
gb.data.ema2floatLatest EMA (Exponential Moving Average) indicator value.
gb.data.ema3floatLatest EMA (Exponential Moving Average) indicator value.
gb.data.BTCUSDpricefloatLatest BTC/USD price on the same exchange (or equivalent spot pair, depending on availability).
gb.data.mfifloatLatest MFI (Money Flow Index) indicator value.
gb.data.rsifloatLatest RSI (Relative Strength Index) indicator value.
gb.data.lowBBfloatLatest low Bollinger Band indicator value.
gb.data.highBBfloatLatest high Bollinger Band indicator value.
gb.data.tenkanfloatLatest Tenkan-sen (Ichimoku Cloud) indicator value.
gb.data.chikoufloatLatest Chikou Span (Ichimoku Cloud) indicator value.
gb.data.kijunfloatLatest Kijun-sen (Ichimoku Cloud) indicator value.
gb.data.senkouSpanAfloatLatest Senkou Span A (Ichimoku Cloud) indicator value.
gb.data.senkouSpanBfloatLatest Senkou Span B (Ichimoku Cloud) indicator value.
gb.data.fastSmafloatLatest fast SMA (Simple Moving Average) indicator value.
gb.data.slowSmafloatLatest slow SMA (Simple Moving Average) indicator value.
gb.data.R1floatLatest R1 (Pivot Point Resistance 1) indicator value.
gb.data.S1floatLatest S1 (Pivot Point Support 1) indicator value.
gb.data.R2floatLatest R2 (Pivot Point Resistance 2) indicator value.
gb.data.S2floatLatest S2 (Pivot Point Support 2) indicator value.
gb.data.macdfloatLatest MACD (Moving Average Convergence Divergence) line value.
gb.data.macdSignalfloatLatest MACD signal line value.
gb.data.macdHistogramfloatLatest MACD histogram value.
gb.data.stochKfloatLatest %K line (Stochastic Oscillator) indicator value.
gb.data.stochDfloatLatest %D line (Stochastic Oscillator) indicator value.
gb.data.stochRsifloatLatest Stochastic RSI indicator value.
gb.data.atrfloatLatest ATR (Average True Range) indicator value.
gb.data.fibobjectObject with high and low Fibonacci retracement levels.
gb.data.vwmafloatLatest VWMA (Volume Weighted Moving Average) indicator value.
gb.data.diPlusfloatLatest +DI (Positive Directional Indicator) value.
gb.data.diMinusfloatLatest -DI (Negative Directional Indicator) value.
gb.data.adxfloatLatest ADX (Average Directional Index) indicator value.
gb.data.candlesOpenarray

Array of open values for OHLCV (Open, High, Low, Close, Volume) candles.

Sorted old to new (newest last).

gb.data.candlesHigharray

Array of high values for OHLCV candles.

Sorted old to new (newest last).

gb.data.candlesLowarray

Array of low values for OHLCV candles.

Sorted old to new (newest last).

gb.data.candlesClosearray

Array of close values for OHLCV candles.

Sorted old to new (newest last).

gb.data.candlesVolumearray

Array of volume values for OHLCV candles.

Sorted old to new (newest last).

gb.data.candlesTimestamparray

Array of timestamp values for OHLCV candles.

Sorted old to new (newest last).

gb.data.candlesobjectCombined object with OHLCV candle data.