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.

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 has the same data as you see in the pair JSON files. Most items below come from the ledger too, they are renamed for consistency and 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 current pair
gb.data.openOrdersarrayOpen orders for current pair
gb.data.ordersarrayHistory of filled orders for current pair
gb.data.orderbookobjectFirst 10 bid and ask entries in orderbook, 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 value of quoteBalancefor spot trading (including on orders volume) exceeds min volume to sell as defined in Gunbot strategy
gb.data.leveragefloatLeverage of current futures position
gb.data.walletBalancefloatWallet balance. Specific to futures
gb.data.availableMarginfloatAvailable margin balance. Specific to futures
gb.data.maintenanceMarginfloatMaintenance margin requirement for futures account
gb.data.maxNotionalValuefloatMax notional value for futures position at 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 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 indicator value
gb.data.ema2floatLatest indicator value
gb.data.ema3floatLatest indicator value
gb.data.BTCUSDpricefloatLatest BTC/USD price on same exchange (or equivalent spot pair, depending on availability)
gb.data.mfifloatLatest indicator value
gb.data.rsifloatLatest indicator value
gb.data.lowBBfloatLatest indicator value
gb.data.highBBfloatLatest indicator value
gb.data.tenkanfloatLatest indicator value
gb.data.chikoufloatLatest indicator value
gb.data.kijunfloatLatest indicator value
gb.data.senkouSpanAfloatLatest indicator value
gb.data.senkouSpanBfloatLatest indicator value
gb.data.fastSmafloatLatest indicator value
gb.data.slowSmafloatLatest indicator value
gb.data.R1floatLatest indicator value
gb.data.S1floatLatest indicator value
gb.data.R2floatLatest indicator value
gb.data.S2floatLatest indicator value
gb.data.macdfloatLatest indicator value
gb.data.macdSignalfloatLatest indicator value
gb.data.macdHistogramfloatLatest indicator value
gb.data.stochKfloatLatest indicator value
gb.data.stochDfloatLatest indicator value
gb.data.stochRsifloatLatest indicator value
gb.data.atrfloatLatest indicator value
gb.data.fibobjectObject with high and low Fibonacci retracement levels
gb.data.vwmafloatLatest indicator value
gb.data.diPlusfloatLatest indicator value
gb.data.diMinusfloatLatest indicator value
gb.data.adxfloatLatest indicator value
gb.data.candlesOpenarray

Array of open values for OHLCV

Sorted old to new (newest last)

gb.data.candlesHigharray

Array of high values for OHLCV

Sorted old to new (newest last)

gb.data.candlesLowarray

Array of low values for OHLCV

Sorted old to new (newest last)

gb.data.candlesClosearray

Array of close values for OHLCV

Sorted old to new (newest last)

gb.data.candlesVolumearray

Array of volume values for OHLCV

Sorted old to new (newest last)

gb.data.candlesTimestamparray

Array of timestamp values for OHLCV

Sorted old to new (newest last)

gb.data.candlesobjectCombined object with OHLCV data