CCXT

bybit

bybit cryptocurrency exchange — CCXT unified API: methods, parameters and endpoints.

bybit

Kind: global class
Extends: Exchange

enableDemoTrading

enables or disables demo trading mode

Kind: instance method of bybit

See: https://bybit-exchange.github.io/docs/v5/demo

ParamTypeRequiredDescription
enablebooleanNotrue if demo trading should be enabled, false otherwise
bybit.enableDemoTrading (enable?)

isUnifiedEnabled

returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled

Kind: instance method of bybit
Returns: any - [enableUnifiedMargin, enableUnifiedAccount]

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.isUnifiedEnabled (params?)

upgradeUnifiedTradeAccount

upgrades the account to unified trade account warning this is irreversible

Kind: instance method of bybit
Returns: any - nothing

See: https://bybit-exchange.github.io/docs/v5/account/upgrade-unified-account

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.upgradeUnifiedTradeAccount (params?)

fetchTime

fetches the current integer timestamp in milliseconds from the exchange server

Kind: instance method of bybit
Returns: int - the current integer timestamp in milliseconds from the exchange server

See: https://bybit-exchange.github.io/docs/v5/market/time

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchTime (params?)

fetchCurrencies

fetches all available currencies on an exchange

Kind: instance method of bybit
Returns: object - an associative dictionary of currencies

See: https://bybit-exchange.github.io/docs/v5/asset/coin-info

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchCurrencies (params?)

fetchMarkets

retrieves data on all markets for bybit

Kind: instance method of bybit
Returns: Array<object> - an array of objects representing market data

See: https://bybit-exchange.github.io/docs/v5/market/instrument

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchMarkets (params?)

fetchTicker

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

Kind: instance method of bybit
Returns: object - a ticker structure

See: https://bybit-exchange.github.io/docs/v5/market/tickers

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchTicker (symbol, params?)

fetchTickers

fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

Kind: instance method of bybit
Returns: object - an array of ticker structures

See: https://bybit-exchange.github.io/docs/v5/market/tickers

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
paramsobjectNoextra parameters specific to the exchange API endpoint
params.subTypestringNocontract only 'linear', 'inverse'
params.baseCoinstringNooption only base coin, default is 'BTC'
bybit.fetchTickers (symbols, params?)

fetchBidsAsks

fetches the bid and ask price and volume for multiple markets

Kind: instance method of bybit
Returns: object - a dictionary of ticker structures

See: https://bybit-exchange.github.io/docs/v5/market/tickers

ParamTypeRequiredDescription
symbolsArray<string>, undefinedYesunified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
paramsobjectNoextra parameters specific to the exchange API endpoint
params.subTypestringNocontract only 'linear', 'inverse'
params.baseCoinstringNooption only base coin, default is 'BTC'
bybit.fetchBidsAsks (symbols, params?)

fetchOHLCV

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of bybit
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch orders for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchOHLCV (symbol, timeframe, since?, limit?, params?)

fetchFundingRates

fetches funding rates for multiple markets

Kind: instance method of bybit
Returns: Array<object> - a list of funding rate structures

See: https://bybit-exchange.github.io/docs/v5/market/tickers

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchFundingRates (symbols, params?)

fetchFundingRateHistory

fetches historical funding rate prices

Kind: instance method of bybit
Returns: Array<object> - a list of funding rate structures

See: https://bybit-exchange.github.io/docs/v5/market/history-fund-rate

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the funding rate history for
sinceintNotimestamp in ms of the earliest funding rate to fetch
limitintNothe maximum amount of funding rate structures to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNotimestamp in ms of the latest funding rate
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchFundingRateHistory (symbol, since?, limit?, params?)

fetchTrades

get the list of most recent trades for a particular symbol

Kind: instance method of bybit
Returns: Array<Trade> - a list of trade structures

See: https://bybit-exchange.github.io/docs/v5/market/recent-trade

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
bybit.fetchTrades (symbol, since?, limit?, params?)

fetchOrderBook

fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of bybit
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/market/orderbook

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
limitintNothe maximum amount of order book entries to return
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchOrderBook (symbol, limit?, params?)

fetchBalance

query for balance and get the amount of funds available for trading or funds locked in orders

Kind: instance method of bybit
Returns: object - a balance structure

See

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNowallet type, ['spot', 'swap', 'funding']
bybit.fetchBalance (params?)

createMarketBuyOrderWithCost

create a market buy order by providing the symbol and cost

Kind: instance method of bybit
Returns: object - an order structure

See: https://bybit-exchange.github.io/docs/v5/order/create-order

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
costfloatYeshow much you want to trade in units of the quote currency
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.createMarketBuyOrderWithCost (symbol, cost, params?)

createMarkeSellOrderWithCost

create a market sell order by providing the symbol and cost

Kind: instance method of bybit
Returns: object - an order structure

See: https://bybit-exchange.github.io/docs/v5/order/create-order

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
costfloatYeshow much you want to trade in units of the quote currency
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.createMarkeSellOrderWithCost (symbol, cost, params?)

createOrder

create a trade order

Kind: instance method of bybit
Returns: object - an order structure

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo"GTC", "IOC", "FOK"
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.positionIdxstringNocontracts only 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
params.hedgedboolNocontracts only true for hedged mode, false for one way mode, default is false
params.isLeverageintNounified spot only false then spot trading true then margin trading
params.tpslModestringNocontract only 'Full' or 'Partial'
params.mmpstringNooption only market maker protection
params.triggerDirectionstringNocontract only the direction for trigger orders, 'ascending' or 'descending'
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.stopLossPricefloatNoThe price at which a stop loss order is triggered at
params.stopLossLimitPricefloatNoThe limit price for a stoploss order (only when used in OCO with takeProfitPrice)
params.takeProfitPricefloatNoThe price at which a take profit order is triggered at
params.takeProfitLimitPricefloatNoThe limit price for a takeprofit order (only when used in OCO combination with stopLossPrice)
params.takeProfitobjectNotakeProfit object in params containing the triggerPrice at which the attached take profit order will be triggered
params.takeProfit.triggerPricefloatNotake profit trigger price
params.stopLossobjectNostopLoss object in params containing the triggerPrice at which the attached stop loss order will be triggered
params.stopLoss.triggerPricefloatNostop loss trigger price
params.trailingAmountstringNothe quote amount to trail away from the current market price
params.trailingTriggerPricestringNothe price to trigger a trailing order, default uses the price argument
params.tradingStopEndpointbooleanNowhether to enforce using the tradingStop (https://bybit-exchange.github.io/docs/v5/position/trading-stop) endpoint, makes difference when submitting single tp/sl order
bybit.createOrder (symbol, type, side, amount, price?, params?)

createOrders

create a list of trade orders

Kind: instance method of bybit
Returns: object - an order structure

See: https://bybit-exchange.github.io/docs/v5/order/batch-place

ParamTypeRequiredDescription
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.createOrders (orders, params?)

editOrder

edit a trade order

Kind: instance method of bybit
Returns: object - an order structure

See

ParamTypeRequiredDescription
idstringYescancel order id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatYesthe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdstringNounique client order id
params.triggerPricefloatNoThe price that a trigger order is triggered at
params.stopLossPricefloatNoThe price that a stop loss order is triggered at
params.takeProfitPricefloatNoThe price that a take profit order is triggered at
params.takeProfitobjectNotakeProfit object in params containing the triggerPrice that the attached take profit order will be triggered
params.takeProfit.triggerPricefloatNotake profit trigger price
params.stopLossobjectNostopLoss object in params containing the triggerPrice that the attached stop loss order will be triggered
params.stopLoss.triggerPricefloatNostop loss trigger price
params.triggerBystringNo'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
params.slTriggerBystringNo'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
params.tpTriggerbystringNo'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
bybit.editOrder (id, symbol, type, side, amount, price, params?)

editOrders

edit a list of trade orders

Kind: instance method of bybit
Returns: object - an order structure

See: https://bybit-exchange.github.io/docs/v5/order/batch-amend

ParamTypeRequiredDescription
ordersArrayYeslist of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.editOrders (orders, params?)

cancelOrder

cancels an open order

Kind: instance method of bybit
Returns: object - An order structure

See: https://bybit-exchange.github.io/docs/v5/order/cancel-order

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNospot only whether the order is a trigger order
params.stopbooleanNoalias for trigger
params.orderFilterstringNospot only 'Order' or 'StopOrder' or 'tpslOrder'
bybit.cancelOrder (id, symbol, params?)

cancelOrders

cancel multiple orders

Kind: instance method of bybit
Returns: object - an list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/batch-cancel

ParamTypeRequiredDescription
idsArray<string>Yesorder ids
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.clientOrderIdsArray<string>Noclient order ids
bybit.cancelOrders (ids, symbol, params?)

cancelAllOrdersAfter

dead man's switch, cancel all orders after the given timeout

Kind: instance method of bybit
Returns: object - the api result

See: https://bybit-exchange.github.io/docs/v5/order/dcp

ParamTypeRequiredDescription
timeoutnumberYestime in milliseconds
paramsobjectNoextra parameters specific to the exchange API endpoint
params.productstringNoOPTIONS, DERIVATIVES, SPOT, default is 'DERIVATIVES'
bybit.cancelAllOrdersAfter (timeout, params?)

cancelOrdersForSymbols

cancel multiple orders for multiple symbols

Kind: instance method of bybit
Returns: object - an list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/batch-cancel

ParamTypeRequiredDescription
ordersArray<CancellationRequest>Yeslist of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.cancelOrdersForSymbols (orders, params?)

cancelAllOrders

cancel all open orders

Kind: instance method of bybit
Returns: Array<object> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/cancel-all

ParamTypeRequiredDescription
symbolstringYesunified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNotrue if trigger order
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.baseCoinstringNoBase coin. Supports linear, inverse & option
params.settleCoinstringNoSettle coin. Supports linear, inverse & option
bybit.cancelAllOrders (symbol, params?)

fetchOrderClassic

fetches information on an order made by the user classic accounts only

Kind: instance method of bybit
Returns: object - An order structure

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
idstringYesthe order id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchOrderClassic (id, symbol, params?)

fetchOrder

classic accounts only/ spot not supported fetches information on an order made by the user classic accounts only

Kind: instance method of bybit
Returns: object - An order structure

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
idstringYesthe order id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.acknowledgedobjectNoto suppress the warning, set to true
bybit.fetchOrder (id, symbol, params?)

fetchOrders

classic accounts only/ spot not supported fetches information on multiple orders made by the user classic accounts only/ spot not supported

Kind: instance method of bybit
Returns: Array<Order> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNotrue if trigger order
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchOrders (symbol, since?, limit?, params?)

fetchOrdersClassic

fetches information on multiple orders made by the user classic accounts only

Kind: instance method of bybit
Returns: Array<Order> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNotrue if trigger order
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchOrdersClassic (symbol, since?, limit?, params?)

fetchClosedOrder

fetches information on a closed order made by the user

Kind: instance method of bybit
Returns: object - an order structure

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
idstringYesorder id
symbolstringNounified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNoset to true for fetching a closed trigger order
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
bybit.fetchClosedOrder (id, symbol?, params?)

fetchOpenOrder

fetches information on an open order made by the user

Kind: instance method of bybit
Returns: object - an order structure

See: https://bybit-exchange.github.io/docs/v5/order/open-order

ParamTypeRequiredDescription
idstringYesorder id
symbolstringNounified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNoset to true for fetching an open trigger order
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.baseCoinstringNoBase coin. Supports linear, inverse & option
params.settleCoinstringNoSettle coin. Supports linear, inverse & option
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
bybit.fetchOpenOrder (id, symbol?, params?)

fetchCanceledAndClosedOrders

fetches information on multiple canceled and closed orders made by the user

Kind: instance method of bybit
Returns: Array<Order> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNoset to true for fetching trigger orders
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
bybit.fetchCanceledAndClosedOrders (symbol?, since?, limit?, params?)

fetchClosedOrders

fetches information on multiple closed orders made by the user

Kind: instance method of bybit
Returns: Array<Order> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNoset to true for fetching closed trigger orders
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
bybit.fetchClosedOrders (symbol?, since?, limit?, params?)

fetchCanceledOrders

fetches information on multiple canceled orders made by the user

Kind: instance method of bybit
Returns: object - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/order-list

ParamTypeRequiredDescription
symbolstringNounified market symbol of the market orders were made in
sinceintNotimestamp in ms of the earliest order, default is undefined
limitintNomax number of orders to return, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNotrue if trigger order
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
bybit.fetchCanceledOrders (symbol?, since?, limit?, params?)

fetchOpenOrders

fetch all unfilled currently open orders

Kind: instance method of bybit
Returns: Array<Order> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/order/open-order

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch open orders for
limitintNothe maximum number of open orders structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNoset to true for fetching open trigger orders
params.stopbooleanNoalias for trigger
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.baseCoinstringNoBase coin. Supports linear, inverse & option
params.settleCoinstringNoSettle coin. Supports linear, inverse & option
params.orderFilterstringNo'Order' or 'StopOrder' or 'tpslOrder'
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchOpenOrders (symbol, since?, limit?, params?)

fetchOrderTrades

fetch all the trades made from a single order

Kind: instance method of bybit
Returns: Array<object> - a list of trade structures

See: https://bybit-exchange.github.io/docs/v5/position/execution

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trades to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchOrderTrades (id, symbol, since?, limit?, params?)

fetchMyTrades

fetch all trades made by the user

Kind: instance method of bybit
Returns: Array<Trade> - a list of trade structures

See: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution

ParamTypeRequiredDescription
symbolstringYesunified market symbol
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trades structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchMyTrades (symbol, since?, limit?, params?)

fetchDepositAddressesByNetwork

fetch a dictionary of addresses for a currency, indexed by network

Kind: instance method of bybit
Returns: object - a dictionary of address structures indexed by the network

See: https://bybit-exchange.github.io/docs/v5/asset/master-deposit-addr

ParamTypeRequiredDescription
codestringYesunified currency code of the currency for the deposit address
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchDepositAddressesByNetwork (code, params?)

fetchDepositAddress

fetch the deposit address for a currency associated with this account

Kind: instance method of bybit
Returns: object - an address structure

See: https://bybit-exchange.github.io/docs/v5/asset/master-deposit-addr

ParamTypeRequiredDescription
codestringYesunified currency code
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchDepositAddress (code, params?)

fetchDeposits

fetch all deposits made to an account

Kind: instance method of bybit
Returns: Array<object> - a list of transaction structures

See: https://bybit-exchange.github.io/docs/v5/asset/deposit-record

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNothe earliest time in ms to fetch deposits for, default = 30 days before the current time
limitintNothe maximum number of deposits structures to retrieve, default = 50, max = 50
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch deposits for, default = 30 days after since EXCHANGE SPECIFIC PARAMETERS
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
params.cursorstringNoused for pagination
bybit.fetchDeposits (code, since?, limit?, params?)

fetchWithdrawals

fetch all withdrawals made from an account

Kind: instance method of bybit
Returns: Array<object> - a list of transaction structures

See: https://bybit-exchange.github.io/docs/v5/asset/withdraw-record

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNothe earliest time in ms to fetch withdrawals for
limitintNothe maximum number of withdrawals structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchWithdrawals (code, since?, limit?, params?)

fetchLedger

fetch the history of changes, actions done by the user or operations that altered the balance of the user

Kind: instance method of bybit
Returns: object - a ledger structure

See

ParamTypeRequiredDescription
codestringNounified currency code, default is undefined
sinceintNotimestamp in ms of the earliest ledger entry, default is undefined
limitintNomax number of ledger entries to return, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
params.subTypestringNoif inverse will use v5/account/contract-transaction-log
bybit.fetchLedger (code?, since?, limit?, params?)

withdraw

make a withdrawal

Kind: instance method of bybit
Returns: object - a transaction structure

See: https://bybit-exchange.github.io/docs/v5/asset/withdraw

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesthe amount to withdraw
addressstringYesthe address to withdraw to
tagstringYes
paramsobjectNoextra parameters specific to the exchange API endpoint
params.accountTypestringNo'UTA', 'FUND', 'FUND,UTA', and 'SPOT (for classic accounts only)
bybit.withdraw (code, amount, address, tag, params?)

fetchPosition

fetch data on a single open contract trade position

Kind: instance method of bybit
Returns: object - a position structure

See: https://bybit-exchange.github.io/docs/v5/position

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market the position is held in, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchPosition (symbol, params?)

fetchPositions

fetch all open positions

Kind: instance method of bybit
Returns: Array<object> - a list of position structure

See: https://bybit-exchange.github.io/docs/v5/position

ParamTypeRequiredDescription
symbolsArray<string>Yeslist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.baseCoinstringNoBase coin. Supports linear, inverse & option
params.settleCoinstringNoSettle coin. Supports linear, inverse & option
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times
bybit.fetchPositions (symbols, params?)

fetchLeverage

fetch the set leverage for a market

Kind: instance method of bybit
Returns: object - a leverage structure

See: https://bybit-exchange.github.io/docs/v5/position

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchLeverage (symbol, params?)

setMarginMode

set margin mode (account) or trade mode (symbol)

Kind: instance method of bybit
Returns: object - response from the exchange

See

ParamTypeRequiredDescription
marginModestringYesaccount mode must be either [isolated, cross, portfolio], trade mode must be either [isolated, cross]
symbolstringYesunified market symbol of the market the position is held in, default is undefined
paramsobjectNoextra parameters specific to the exchange API endpoint
params.leveragestringNothe rate of leverage, is required if setting trade mode (symbol)
bybit.setMarginMode (marginMode, symbol, params?)

setLeverage

set the level of leverage for a market

Kind: instance method of bybit
Returns: object - response from the exchange

See: https://bybit-exchange.github.io/docs/v5/position/leverage

ParamTypeRequiredDescription
leveragefloatYesthe rate of leverage
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
params.buyLeveragestringNoleverage for buy side
params.sellLeveragestringNoleverage for sell side
bybit.setLeverage (leverage, symbol, params?)

setPositionMode

set hedged to true or false for a market

Kind: instance method of bybit
Returns: object - response from the exchange

See: https://bybit-exchange.github.io/docs/v5/position/position-mode

ParamTypeRequiredDescription
hedgedboolYes
symbolstringYesused for unified account with inverse market
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.setPositionMode (hedged, symbol, params?)

fetchOpenInterest

Retrieves the open interest of a derivative trading pair

Kind: instance method of bybit
Returns: object - an open interest structure/docs/manual#open-interest-structure

See: https://bybit-exchange.github.io/docs/v5/market/open-interest

ParamTypeRequiredDescription
symbolstringYesUnified CCXT market symbol
paramsobjectNoexchange specific parameters
params.intervalstringNo5m, 15m, 30m, 1h, 4h, 1d
params.categorystringNo"linear" or "inverse"
bybit.fetchOpenInterest (symbol, params?)

fetchOpenInterestHistory

Gets the total amount of unsettled contracts. In other words, the total number of contracts held in open positions

Kind: instance method of bybit
Returns: An array of open interest structures

See: https://bybit-exchange.github.io/docs/v5/market/open-interest

ParamTypeRequiredDescription
symbolstringYesUnified market symbol
timeframestringYes"5m", 15m, 30m, 1h, 4h, 1d
sinceintNoNot used by Bybit
limitintNoThe number of open interest structures to return. Max 200, default 50
paramsobjectNoExchange specific parameters
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchOpenInterestHistory (symbol, timeframe, since?, limit?, params?)

fetchCrossBorrowRate

fetch the rate of interest to borrow a currency for margin trading

Kind: instance method of bybit
Returns: object - a borrow rate structure

See: https://bybit-exchange.github.io/docs/zh-TW/v5/spot-margin-normal/interest-quota

ParamTypeRequiredDescription
codestringYesunified currency code
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchCrossBorrowRate (code, params?)

fetchBorrowInterest

fetch the interest owed by the user for borrowing currency for margin trading

Kind: instance method of bybit
Returns: Array<object> - a list of borrow interest structures

See: https://bybit-exchange.github.io/docs/zh-TW/v5/spot-margin-normal/account-info

ParamTypeRequiredDescription
codestringYesunified currency code
symbolstringYesunified market symbol when fetch interest in isolated markets
sincenumberNothe earliest time in ms to fetch borrrow interest for
limitnumberNothe maximum number of structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchBorrowInterest (code, symbol, since?, limit?, params?)

fetchBorrowRateHistory

retrieves a history of a currencies borrow interest rate at specific time slots

Kind: instance method of bybit
Returns: Array<object> - an array of borrow rate structures

See: https://bybit-exchange.github.io/docs/v5/spot-margin-uta/historical-interest

ParamTypeRequiredDescription
codestringYesunified currency code
sinceintNotimestamp for the earliest borrow rate
limitintNothe maximum number of borrow rate structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch entries for
bybit.fetchBorrowRateHistory (code, since?, limit?, params?)

transfer

transfer currency internally between wallets on the same account

Kind: instance method of bybit
Returns: object - a transfer structure

See: https://bybit-exchange.github.io/docs/v5/asset/create-inter-transfer

ParamTypeRequiredDescription
codestringYesunified currency code
amountfloatYesamount to transfer
fromAccountstringYesaccount to transfer from
toAccountstringYesaccount to transfer to
paramsobjectNoextra parameters specific to the exchange API endpoint
params.transferIdstringNoUUID, which is unique across the platform
bybit.transfer (code, amount, fromAccount, toAccount, params?)

fetchTransfers

fetch a history of internal transfers made on an account

Kind: instance method of bybit
Returns: Array<object> - a list of transfer structures

See: https://bybit-exchange.github.io/docs/v5/asset/inter-transfer-list

ParamTypeRequiredDescription
codestringYesunified currency code of the currency transferred
sinceintNothe earliest time in ms to fetch transfers for
limitintNothe maximum number of transfer structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.untilintNothe latest time in ms to fetch entries for
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the availble parameters
bybit.fetchTransfers (code, since?, limit?, params?)

borrowCrossMargin

create a loan to borrow margin

Kind: instance method of bybit
Returns: object - a margin loan structure

See: https://bybit-exchange.github.io/docs/v5/account/borrow

ParamTypeRequiredDescription
codestringYesunified currency code of the currency to borrow
amountfloatYesthe amount to borrow
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.borrowCrossMargin (code, amount, params?)

repayCrossMargin

repay borrowed margin and interest

Kind: instance method of bybit
Returns: object - a margin loan structure

See: https://bybit-exchange.github.io/docs/v5/account/no-convert-repay

ParamTypeRequiredDescription
codestringYesunified currency code of the currency to repay
amountfloatYesthe amount to repay
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.repayCrossMargin (code, amount, params?)

fetchMarketLeverageTiers

retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market

Kind: instance method of bybit
Returns: object - a leverage tiers structure

See: https://bybit-exchange.github.io/docs/v5/market/risk-limit

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchMarketLeverageTiers (symbol, params?)

fetchTradingFee

fetch the trading fees for a market

Kind: instance method of bybit
Returns: object - a fee structure

See: https://bybit-exchange.github.io/docs/v5/account/fee-rate

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchTradingFee (symbol, params?)

fetchTradingFees

fetch the trading fees for multiple markets

Kind: instance method of bybit
Returns: object - a dictionary of fee structures indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/account/fee-rate

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.typestringNomarket type, ['swap', 'option', 'spot']
bybit.fetchTradingFees (params?)

fetchDepositWithdrawFees

fetch deposit and withdraw fees

Kind: instance method of bybit
Returns: object - a list of fee structures

See: https://bybit-exchange.github.io/docs/v5/asset/coin-info

ParamTypeRequiredDescription
codesArray<string>Yeslist of unified currency codes
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchDepositWithdrawFees (codes, params?)

fetchSettlementHistory

fetches historical settlement records

Kind: instance method of bybit
Returns: Array<object> - a list of [settlement history objects]

See: https://bybit-exchange.github.io/docs/v5/market/delivery-price

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the settlement history
sinceintNotimestamp in ms
limitintNonumber of records
paramsobjectNoexchange specific params
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
bybit.fetchSettlementHistory (symbol, since?, limit?, params?)

fetchMySettlementHistory

fetches historical settlement records of the user

Kind: instance method of bybit
Returns: Array<object> - a list of [settlement history objects]

See: https://bybit-exchange.github.io/docs/v5/asset/delivery

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the settlement history
sinceintNotimestamp in ms
limitintNonumber of records
paramsobjectNoexchange specific params
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
bybit.fetchMySettlementHistory (symbol, since?, limit?, params?)

fetchVolatilityHistory

fetch the historical volatility of an option market based on an underlying asset

Kind: instance method of bybit
Returns: Array<object> - a list of volatility history objects

See: https://bybit-exchange.github.io/docs/v5/market/iv

ParamTypeRequiredDescription
codestringYesunified currency code
paramsobjectNoextra parameters specific to the exchange API endpoint
params.periodintNothe period in days to fetch the volatility for: 7,14,21,30,60,90,180,270
bybit.fetchVolatilityHistory (code, params?)

fetchGreeks

fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract

Kind: instance method of bybit
Returns: object - a greeks structure

See: https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch greeks for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchGreeks (symbol, params?)

fetchAllGreeks

fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract

Kind: instance method of bybit
Returns: object - a greeks structure

See: https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers

ParamTypeRequiredDescription
symbolsArray<string>Nounified symbols of the markets to fetch greeks for, all markets are returned if not assigned
paramsobjectNoextra parameters specific to the exchange API endpoint
params.baseCoinstringNothe baseCoin of the symbol, default is BTC
bybit.fetchAllGreeks (symbols?, params?)

fetchMyLiquidations

retrieves the users liquidated positions

Kind: instance method of bybit
Returns: object - an array of liquidation structures

See: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution

ParamTypeRequiredDescription
symbolstringNounified CCXT market symbol
sinceintNothe earliest time in ms to fetch liquidations for
limitintNothe maximum number of liquidation structures to retrieve
paramsobjectNoexchange specific parameters for the exchange API endpoint
params.typestringNomarket type, ['swap', 'option', 'spot']
params.subTypestringNomarket subType, ['linear', 'inverse']
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
bybit.fetchMyLiquidations (symbol?, since?, limit?, params?)

fetchLeverageTiers

retrieve information on the maximum leverage, for different trade sizes

Kind: instance method of bybit
Returns: object - a dictionary of leverage tiers structures, indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/market/risk-limit

ParamTypeRequiredDescription
symbolsArray<string>Noa list of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
params.subTypestringNomarket subType, ['linear', 'inverse'], default is 'linear'
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
bybit.fetchLeverageTiers (symbols?, params?)

fetchFundingHistory

fetch the history of funding payments paid and received on this account

Kind: instance method of bybit
Returns: object - a funding history structure

See: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution

ParamTypeRequiredDescription
symbolstringNounified market symbol
sinceintNothe earliest time in ms to fetch funding history for
limitintNothe maximum number of funding history structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.paginatebooleanNodefault false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the available parameters
bybit.fetchFundingHistory (symbol?, since?, limit?, params?)

fetchOption

fetches option data that is commonly found in an option chain

Kind: instance method of bybit
Returns: object - an option chain structure

See: https://bybit-exchange.github.io/docs/v5/market/tickers

ParamTypeRequiredDescription
symbolstringYesunified market symbol
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchOption (symbol, params?)

fetchOptionChain

fetches data for an underlying asset that is commonly found in an option chain

Kind: instance method of bybit
Returns: object - a list of option chain structures

See: https://bybit-exchange.github.io/docs/v5/market/tickers

ParamTypeRequiredDescription
codestringYesbase currency to fetch an option chain for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchOptionChain (code, params?)

fetchPositionsHistory

fetches historical positions

Kind: instance method of bybit
Returns: Array<object> - a list of position structures

See: https://bybit-exchange.github.io/docs/v5/position/close-pnl

ParamTypeRequiredDescription
symbolsArray<string>Yesa list of unified market symbols
sinceintNotimestamp in ms of the earliest position to fetch, params["until"] - since <= 7 days
limitintNothe maximum amount of records to fetch, default=50, max=100
paramsobjectYesextra parameters specific to the exchange api endpoint
params.untilintNotimestamp in ms of the latest position to fetch, params["until"] - since <= 7 days
params.subTypestringNo'linear' or 'inverse'
bybit.fetchPositionsHistory (symbols, since?, limit?, params)

fetchConvertCurrencies

fetches all available currencies that can be converted

Kind: instance method of bybit
Returns: object - an associative dictionary of currencies

See: https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.accountTypestringNoeb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
bybit.fetchConvertCurrencies (params?)

fetchConvertQuote

fetch a quote for converting from one currency to another

Kind: instance method of bybit
Returns: object - a conversion structure

See: https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote

ParamTypeRequiredDescription
fromCodestringYesthe currency that you want to sell and convert from
toCodestringYesthe currency that you want to buy and convert into
amountfloatNohow much you want to trade in units of the from currency
paramsobjectNoextra parameters specific to the exchange API endpoint
params.accountTypestringNoeb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
bybit.fetchConvertQuote (fromCode, toCode, amount?, params?)

createConvertTrade

convert from one currency to another

Kind: instance method of bybit
Returns: object - a conversion structure

See: https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote

ParamTypeRequiredDescription
idstringYesthe id of the trade that you want to make
fromCodestringYesthe currency that you want to sell and convert from
toCodestringYesthe currency that you want to buy and convert into
amountfloatYeshow much you want to trade in units of the from currency
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.createConvertTrade (id, fromCode, toCode, amount, params?)

fetchConvertTrade

fetch the data for a conversion trade

Kind: instance method of bybit
Returns: object - a conversion structure

See: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result

ParamTypeRequiredDescription
idstringYesthe id of the trade that you want to fetch
codestringNothe unified currency code of the conversion trade
paramsobjectNoextra parameters specific to the exchange API endpoint
params.accountTypestringNoeb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
bybit.fetchConvertTrade (id, code?, params?)

fetchConvertTradeHistory

fetch the users history of conversion trades

Kind: instance method of bybit
Returns: Array<object> - a list of conversion structures

See: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history

ParamTypeRequiredDescription
codestringNothe unified currency code
sinceintNothe earliest time in ms to fetch conversions for
limitintNothe maximum number of conversion structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.accountTypestringNoeb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract
bybit.fetchConvertTradeHistory (code?, since?, limit?, params?)

fetchLongShortRatioHistory

fetches the long short ratio history for a unified market symbol

Kind: instance method of bybit
Returns: Array<object> - an array of long short ratio structures

See: https://bybit-exchange.github.io/docs/v5/market/long-short-ratio

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the long short ratio for
timeframestringNothe period for the ratio, default is 24 hours
sinceintNothe earliest time in ms to fetch ratios for
limitintNothe maximum number of long short ratio structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchLongShortRatioHistory (symbol, timeframe?, since?, limit?, params?)

fetchPositionsADLRank

fetches the auto deleveraging rank and risk percentage for a list of symbols

Kind: instance method of bybit
Returns: Array<object> - an array of auto de leverage structures

See: https://bybit-exchange.github.io/docs/v5/position#response-parameters

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchPositionsADLRank (symbols?, params?)

fetchMarginMode

fetches the margin mode of the trading pair

Kind: instance method of bybit
Returns: object - a margin mode structure

See: https://bybit-exchange.github.io/docs/v5/account/account-info

ParamTypeRequiredDescription
symbolstringNounified symbol of the market to fetch the margin mode for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.fetchMarginMode (symbol?, params?)

createOrderWs

create a trade order

Kind: instance method of bybit
Returns: object - an order structure

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatNothe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.timeInForcestringNo"GTC", "IOC", "FOK"
params.postOnlyboolNotrue or false whether the order is post-only
params.reduceOnlyboolNotrue or false whether the order is reduce-only
params.positionIdxstringNocontracts only 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
params.isLeveragebooleanNounified spot only false then spot trading true then margin trading
params.tpslModestringNocontract only 'full' or 'partial'
params.mmpstringNooption only market maker protection
params.triggerDirectionstringNocontract only the direction for trigger orders, 'above' or 'below'
params.triggerPricefloatNoThe price at which a trigger order is triggered at
params.stopLossPricefloatNoThe price at which a stop loss order is triggered at
params.takeProfitPricefloatNoThe price at which a take profit order is triggered at
params.takeProfitobjectNotakeProfit object in params containing the triggerPrice at which the attached take profit order will be triggered
params.takeProfit.triggerPricefloatNotake profit trigger price
params.stopLossobjectNostopLoss object in params containing the triggerPrice at which the attached stop loss order will be triggered
params.stopLoss.triggerPricefloatNostop loss trigger price
params.trailingAmountstringNothe quote amount to trail away from the current market price
params.trailingTriggerPricestringNothe price to trigger a trailing order, default uses the price argument
bybit.createOrderWs (symbol, type, side, amount, price?, params?)

editOrderWs

edit a trade order

Kind: instance method of bybit
Returns: object - an order structure

See

ParamTypeRequiredDescription
idstringYescancel order id
symbolstringYesunified symbol of the market to create an order in
typestringYes'market' or 'limit'
sidestringYes'buy' or 'sell'
amountfloatYeshow much of currency you want to trade in units of base currency
pricefloatYesthe price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerPricefloatNoThe price that a trigger order is triggered at
params.stopLossPricefloatNoThe price that a stop loss order is triggered at
params.takeProfitPricefloatNoThe price that a take profit order is triggered at
params.takeProfitobjectNotakeProfit object in params containing the triggerPrice that the attached take profit order will be triggered
params.takeProfit.triggerPricefloatNotake profit trigger price
params.stopLossobjectNostopLoss object in params containing the triggerPrice that the attached stop loss order will be triggered
params.stopLoss.triggerPricefloatNostop loss trigger price
params.triggerBystringNo'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
params.slTriggerBystringNo'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
params.tpTriggerbystringNo'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
bybit.editOrderWs (id, symbol, type, side, amount, price, params?)

cancelOrderWs

cancels an open order

Kind: instance method of bybit
Returns: object - An order structure

See

ParamTypeRequiredDescription
idstringYesorder id
symbolstringYesunified symbol of the market the order was made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.triggerbooleanNospot only whether the order is a trigger order
params.orderFilterstringNospot only 'Order' or 'StopOrder' or 'tpslOrder'
bybit.cancelOrderWs (id, symbol, params?)

watchTicker

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

Kind: instance method of bybit
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchTicker (symbol, params?)

watchTickers

watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list

Kind: instance method of bybit
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchTickers (symbols, params?)

unWatchTickers

unWatches a price ticker

Kind: instance method of bybit
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchTickers (symbols, params?)

unWatchTicker

unWatches a price ticker

Kind: instance method of bybit
Returns: object - a ticker structure

See

ParamTypeRequiredDescription
symbolArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchTicker (symbol, params?)

watchBidsAsks

watches best bid & ask for symbols

Kind: instance method of bybit
Returns: object - a ticker structure

See: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch the ticker for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchBidsAsks (symbols, params?)

watchOHLCV

watches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of bybit
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchOHLCV (symbol, timeframe, since?, limit?, params?)

watchOHLCVForSymbols

watches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of bybit
Returns: object - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbolsAndTimeframesArray<Array<string>>Yesarray of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum amount of candles to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchOHLCVForSymbols (symbolsAndTimeframes, since?, limit?, params?)

unWatchOHLCVForSymbols

unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of bybit
Returns: object - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbolsAndTimeframesArray<Array<string>>Yesarray of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchOHLCVForSymbols (symbolsAndTimeframes, params?)

unWatchOHLCV

unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market

Kind: instance method of bybit
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume

See

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch OHLCV data for
timeframestringYesthe length of time each candle represents
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchOHLCV (symbol, timeframe, params?)

watchOrderBook

watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of bybit
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to fetch the order book for
limitintNothe maximum amount of order book entries to return.
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchOrderBook (symbol, limit?, params?)

watchOrderBookForSymbols

watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data

Kind: instance method of bybit
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook

ParamTypeRequiredDescription
symbolsArray<string>Yesunified array of symbols
limitintNothe maximum amount of order book entries to return.
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchOrderBookForSymbols (symbols, limit?, params?)

unWatchOrderBookForSymbols

unsubscribe from the orderbook channel

Kind: instance method of bybit
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to unwatch the trades for
paramsobjectNoextra parameters specific to the exchange API endpoint
params.limitintNoorderbook limit, default is undefined
bybit.unWatchOrderBookForSymbols (symbols, params?)

unWatchOrderBook

unsubscribe from the orderbook channel

Kind: instance method of bybit
Returns: object - A dictionary of order book structures indexed by market symbols

See: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook

ParamTypeRequiredDescription
symbolstringYessymbol of the market to unwatch the trades for
paramsobjectNoextra parameters specific to the exchange API endpoint
params.limitintNoorderbook limit, default is undefined
bybit.unWatchOrderBook (symbol, params?)

watchTrades

watches information on multiple trades made in a market

Kind: instance method of bybit
Returns: Array<object> - a list of trade structures

See: https://bybit-exchange.github.io/docs/v5/websocket/public/trade

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market trades were made in
sinceintNothe earliest time in ms to fetch trades for
limitintNothe maximum number of trade structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchTrades (symbol, since?, limit?, params?)

watchTradesForSymbols

get the list of most recent trades for a list of symbols

Kind: instance method of bybit
Returns: Array<object> - a list of trade structures

See: https://bybit-exchange.github.io/docs/v5/websocket/public/trade

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to fetch trades for
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum amount of trades to fetch
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchTradesForSymbols (symbols, since?, limit?, params?)

unWatchTradesForSymbols

unsubscribe from the trades channel

Kind: instance method of bybit
Returns: any - status of the unwatch request

See: https://bybit-exchange.github.io/docs/v5/websocket/public/trade

ParamTypeRequiredDescription
symbolsArray<string>Yesunified symbol of the market to unwatch the trades for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchTradesForSymbols (symbols, params?)

unWatchTrades

unsubscribe from the trades channel

Kind: instance method of bybit
Returns: any - status of the unwatch request

See: https://bybit-exchange.github.io/docs/v5/websocket/public/trade

ParamTypeRequiredDescription
symbolstringYesunified symbol of the market to unwatch the trades for
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchTrades (symbol, params?)

watchMyTrades

watches information on multiple trades made by the user

Kind: instance method of bybit
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedMarginbooleanNouse unified margin account
params.executionFastbooleanNouse fast execution
bybit.watchMyTrades (symbol, since?, limit?, params?)

unWatchMyTrades

unWatches information on multiple trades made by the user

Kind: instance method of bybit
Returns: Array<object> - a list of order structures

See

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedMarginbooleanNouse unified margin account
params.executionFastbooleanNouse fast execution
bybit.unWatchMyTrades (symbol, params?)

watchPositions

watch all open positions

Kind: instance method of bybit
Returns: Array<object> - a list of position structure

See: https://bybit-exchange.github.io/docs/v5/websocket/private/position

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
sinceintNothe earliest time in ms to fetch positions for
limitintNothe maximum number of positions to retrieve
paramsobjectYesextra parameters specific to the exchange API endpoint
bybit.watchPositions (symbols?, since?, limit?, params)

unWatchPositions

unWatches all open positions

Kind: instance method of bybit
Returns: object - status of the unwatch request

See: https://bybit-exchange.github.io/docs/v5/websocket/private/position

ParamTypeRequiredDescription
symbolsArray<string>Nolist of unified market symbols
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.unWatchPositions (symbols?, params?)

watchLiquidations

watch the public liquidations of a trading pair

Kind: instance method of bybit
Returns: object - an array of liquidation structures

See: https://bybit-exchange.github.io/docs/v5/websocket/public/all-liquidation

ParamTypeRequiredDescription
symbolstringYesunified CCXT market symbol
sinceintNothe earliest time in ms to fetch liquidations for
limitintNothe maximum number of liquidation structures to retrieve
paramsobjectNoexchange specific parameters for the bitmex api endpoint
params.methodstringNoexchange specific method, supported: liquidation, allLiquidation
bybit.watchLiquidations (symbol, since?, limit?, params?)

watchOrders

watches information on multiple orders made by the user

Kind: instance method of bybit
Returns: Array<object> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/websocket/private/order

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
sinceintNothe earliest time in ms to fetch orders for
limitintNothe maximum number of order structures to retrieve
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchOrders (symbol, since?, limit?, params?)

unWatchOrders

unWatches information on multiple orders made by the user

Kind: instance method of bybit
Returns: Array<object> - a list of order structures

See: https://bybit-exchange.github.io/docs/v5/websocket/private/order

ParamTypeRequiredDescription
symbolstringYesunified market symbol of the market orders were made in
paramsobjectNoextra parameters specific to the exchange API endpoint
params.unifiedMarginbooleanNouse unified margin account
bybit.unWatchOrders (symbol, params?)

watchBalance

watch balance and get the amount of funds available for trading or funds locked in orders

Kind: instance method of bybit
Returns: object - a balance structure

See: https://bybit-exchange.github.io/docs/v5/websocket/private/wallet

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
bybit.watchBalance (params?)

On this page

bybitenableDemoTradingisUnifiedEnabledupgradeUnifiedTradeAccountfetchTimefetchCurrenciesfetchMarketsfetchTickerfetchTickersfetchBidsAsksfetchOHLCVfetchFundingRatesfetchFundingRateHistoryfetchTradesfetchOrderBookfetchBalancecreateMarketBuyOrderWithCostcreateMarkeSellOrderWithCostcreateOrdercreateOrderseditOrdereditOrderscancelOrdercancelOrderscancelAllOrdersAftercancelOrdersForSymbolscancelAllOrdersfetchOrderClassicfetchOrderfetchOrdersfetchOrdersClassicfetchClosedOrderfetchOpenOrderfetchCanceledAndClosedOrdersfetchClosedOrdersfetchCanceledOrdersfetchOpenOrdersfetchOrderTradesfetchMyTradesfetchDepositAddressesByNetworkfetchDepositAddressfetchDepositsfetchWithdrawalsfetchLedgerwithdrawfetchPositionfetchPositionsfetchLeveragesetMarginModesetLeveragesetPositionModefetchOpenInterestfetchOpenInterestHistoryfetchCrossBorrowRatefetchBorrowInterestfetchBorrowRateHistorytransferfetchTransfersborrowCrossMarginrepayCrossMarginfetchMarketLeverageTiersfetchTradingFeefetchTradingFeesfetchDepositWithdrawFeesfetchSettlementHistoryfetchMySettlementHistoryfetchVolatilityHistoryfetchGreeksfetchAllGreeksfetchMyLiquidationsfetchLeverageTiersfetchFundingHistoryfetchOptionfetchOptionChainfetchPositionsHistoryfetchConvertCurrenciesfetchConvertQuotecreateConvertTradefetchConvertTradefetchConvertTradeHistoryfetchLongShortRatioHistoryfetchPositionsADLRankfetchMarginModecreateOrderWseditOrderWscancelOrderWswatchTickerwatchTickersunWatchTickersunWatchTickerwatchBidsAskswatchOHLCVwatchOHLCVForSymbolsunWatchOHLCVForSymbolsunWatchOHLCVwatchOrderBookwatchOrderBookForSymbolsunWatchOrderBookForSymbolsunWatchOrderBookwatchTradeswatchTradesForSymbolsunWatchTradesForSymbolsunWatchTradeswatchMyTradesunWatchMyTradeswatchPositionsunWatchPositionswatchLiquidationswatchOrdersunWatchOrderswatchBalance