Perpetual Futures Models

This section documents the data models used in the Perpetual Futures module.

class bingx_py.models.swap.account.AccountData(*, userId, asset, balance, equity, unrealizedProfit, realisedProfit, availableMargin, usedMargin, freezedMargin)[source]

Bases: BaseModel

Model for account data.

Parameters:
  • user_id (str) – User ID.

  • asset (str) – Asset name, e.g., USDT.

  • balance (str) – Asset balance.

  • equity (str) – Net asset value.

  • unrealized_profit (str) – Unrealized profit and loss.

  • realised_profit (str) – Realized profit and loss.

  • available_margin (str) – Available margin.

  • used_margin (str) – Used margin.

  • freezed_margin (str) – Frozen margin.

  • userId (str)

  • unrealizedProfit (str)

  • realisedProfit (str)

  • availableMargin (str)

  • usedMargin (str)

  • freezedMargin (str)

asset: str
available_margin: str
balance: str
equity: str
freezed_margin: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

realised_profit: str
unrealized_profit: str
used_margin: str
user_id: str
class bingx_py.models.swap.account.CommissionData(**data)[source]

Bases: BaseModel

Model for commission data.

Parameters:
commission: CommissionDetails
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.account.CommissionDetails(*, takerCommissionRate, makerCommissionRate)[source]

Bases: BaseModel

Model for commission details.

Parameters:
  • taker_commission_rate (float) – Taker fee rate.

  • maker_commission_rate (float) – Maker fee rate.

  • takerCommissionRate (float)

  • makerCommissionRate (float)

maker_commission_rate: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

taker_commission_rate: float
class bingx_py.models.swap.account.FundFlowData(*, symbol, incomeType, income, asset, info, time, tranId, tradeId)[source]

Bases: BaseModel

Model for fund flow data.

Parameters:
  • symbol (str) – Trading pair, e.g., LDO-USDT.

  • income_type (str) – Income type, e.g., FUNDING_FEE.

  • income (str) – The amount of capital flow, positive numbers represent inflows, negative numbers represent outflows.

  • asset (str) – Asset content.

  • info (str) – Remarks, depending on the type of stream.

  • time (int) – Time, unit: millisecond.

  • tran_id (str) – Transfer ID.

  • trade_id (str) – The original transaction ID that caused the transaction.

  • incomeType (str)

  • tranId (str)

  • tradeId (str)

asset: str
income: str
income_type: str
info: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

symbol: str
time: int
trade_id: str
tran_id: str
class bingx_py.models.swap.account.GetAccountProfitAndLossFundFlowResponse(**data)[source]

Bases: BaseModel

Model for the response of GetAccountProfitAndLossFundFlow.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[FundFlowData]) – The response data.

code: int
data: list[FundFlowData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.account.PositionData(*, positionId, symbol, currency, positionAmt, availableAmt, positionSide, isolated, avgPrice, initialMargin, leverage, unrealizedProfit, realisedProfit, liquidationPrice)[source]

Bases: BaseModel

Model for position data.

Parameters:
  • position_id (str) – Position ID.

  • symbol (str) – Trading pair, e.g., BNB-USDT.

  • currency (str) – Currency, e.g., USDT.

  • position_amt (str) – Position amount.

  • available_amt (str) – Available amount.

  • position_side (str) – Position direction (LONG/SHORT).

  • isolated (bool) – Whether it is isolated margin mode.

  • avg_price (str) – Average opening price.

  • initial_margin (str) – Initial margin.

  • leverage (int) – Leverage.

  • unrealized_profit (str) – Unrealized profit and loss.

  • realised_profit (str) – Realized profit and loss.

  • liquidation_price (float) – Liquidation price.

  • positionId (str)

  • positionAmt (str)

  • availableAmt (str)

  • positionSide (str)

  • avgPrice (str)

  • initialMargin (str)

  • unrealizedProfit (str)

  • realisedProfit (str)

  • liquidationPrice (float)

available_amt: str
avg_price: str
currency: str
initial_margin: str
isolated: bool
leverage: int
liquidation_price: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position_amt: str
position_id: str
position_side: str
realised_profit: str
symbol: str
unrealized_profit: str
class bingx_py.models.swap.account.QueryAccountDataResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryAccountData.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[AccountData]) – The response data.

code: int
data: list[AccountData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.account.QueryPositionDataResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryPositionData.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[PositionData]) – The response data.

code: int
data: list[PositionData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.account.SwapQueryTradingCommissionRateResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryTradingCommissionRate.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CommissionData) – The response data.

code: int
data: CommissionData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.ApiState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enum for API state.

Values:

TRUE: “true” FALSE: “false”

FALSE = 'false'
TRUE = 'true'
class bingx_py.models.swap.market.BrokerState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enum for broker state.

Values:

TRUE: “true” FALSE: “false”

FALSE = 'false'
TRUE = 'true'
class bingx_py.models.swap.market.Contract(*, contractId, symbol, quantityPrecision, pricePrecision, takerFeeRate, makerFeeRate, tradeMinQuantity, tradeMinUSDT, currency, asset, status, apiStateOpen, apiStateClose, ensureTrigger, triggerFeeRate, brokerState, launchTime, maintainTime, offTime)[source]

Bases: BaseModel

Model for a contract in USDT-M Perp Futures symbols.

Parameters:
  • contract_id (str) – Contract ID

  • symbol (str) – Trading pair, for example: BTC-USDT

  • quantity_precision (int) – Transaction quantity precision

  • price_precision (int) – Price precision

  • taker_fee_rate (float) – Take transaction fee

  • maker_fee_rate (float) – Make transaction fee

  • trade_min_quantity (float) – The minimum trading unit(COIN)

  • trade_min_usdt (float) – The minimum trading unit(USDT)

  • currency (str) – Settlement and margin currency asset

  • asset (str) – Contract trading asset

  • status (ContractStatus) – Contract status (1 online, 25 forbidden to open positions, 5 pre-online, 0 offline)

  • api_state_open (ApiState) – Whether the API can open a position

  • api_state_close (ApiState) – Whether API can close positions

  • ensure_trigger (bool) – Whether to support guaranteed stop loss

  • trigger_fee_rate (str) – The fee rate for guaranteed stop loss

  • broker_state (BrokerState) – Whether to prohibit broker user transactions, true: prohibited

  • launch_time (int) – Shelf time; The status of the pair is pre-online before the listing time, and the status of the pair changes to online after the listing time

  • maintain_time (int) – The start time of the prohibition of opening a position, after the time is up, the currency pair is in a state of prohibition from opening a position, and can only close the position

  • off_time (int) – Down line time, after the time is up, the currency pair is in the offline state and trading is prohibited

  • contractId (str)

  • quantityPrecision (int)

  • pricePrecision (int)

  • takerFeeRate (float)

  • makerFeeRate (float)

  • tradeMinQuantity (float)

  • tradeMinUSDT (float)

  • apiStateOpen (ApiState)

  • apiStateClose (ApiState)

  • ensureTrigger (bool)

  • triggerFeeRate (str)

  • brokerState (BrokerState)

  • launchTime (int)

  • maintainTime (int)

  • offTime (int)

api_state_close: ApiState
api_state_open: ApiState
asset: str
broker_state: BrokerState
contract_id: str
currency: str
ensure_trigger: bool
launch_time: int
maintain_time: int
maker_fee_rate: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

off_time: int
price_precision: int
quantity_precision: int
status: ContractStatus
symbol: str
taker_fee_rate: float
trade_min_quantity: float
trade_min_usdt: float
trigger_fee_rate: str
class bingx_py.models.swap.market.ContractStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enum for contract status.

Values:

ONLINE: 1 FORBIDDEN_TO_OPEN: 25 PRE_ONLINE: 5 OFFLINE: 0

FORBIDDEN_TO_OPEN = 25
OFFLINE = 0
ONLINE = 1
PRE_ONLINE = 5
class bingx_py.models.swap.market.FundingRateHistory(*, symbol, fundingRate, fundingTime)[source]

Bases: BaseModel

Model for the data of Funding Rate History.

Parameters:
  • symbol (str) – Trading pair, for example: BTC-USDT

  • funding_rate (str) – Funding rate

  • funding_time (int) – Funding time: milliseconds

  • fundingRate (str)

  • fundingTime (int)

funding_rate: str
funding_time: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

symbol: str
class bingx_py.models.swap.market.GetFundingRateHistoryResponse(**data)[source]

Bases: BaseModel

Model for the response of Get Funding Rate History.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (List[FundingRateHistory]) – Array of funding rate history.

code: int
data: list[FundingRateHistory]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.HistoricalTransactionOrder(*, time, isBuyerMaker, price, qty, quoteQty, id)[source]

Bases: BaseModel

Model for the data of Historical Transaction Order.

Parameters:
  • time (int) – Transaction time

  • is_buyer_maker (bool) – Whether the buyer is the maker of the order (true / false)

  • price (str) – Transaction price

  • qty (str) – Transaction quantity

  • quote_qty (str) – Turnover

  • id (str) – Transaction ID

  • isBuyerMaker (bool)

  • quoteQty (str)

id: str
is_buyer_maker: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

price: str
qty: str
quote_qty: str
time: int
class bingx_py.models.swap.market.KlineCandlestick(*, open, close, high, low, volume, time)[source]

Bases: BaseModel

Model for the data of Kline/Candlestick.

Parameters:
  • open (float) – Opening Price

  • close (float) – Closing Price

  • high (float) – High Price

  • low (float) – Low Price

  • volume (float) – Transaction volume

  • time (int) – K-line time stamp, unit milliseconds

close: float
high: float
low: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

open: float
time: int
volume: float
class bingx_py.models.swap.market.KlineCandlestickDataResponse(**data)[source]

Bases: BaseModel

Model for the response of Kline/Candlestick Data.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (List[KlineCandlestick]) – Array of kline/candlestick data.

code: int
data: list[KlineCandlestick]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.MarkPriceAndFundingRateData(*, symbol, markPrice, indexPrice, lastFundingRate, nextFundingTime)[source]

Bases: BaseModel

Model for the data of Mark Price and Funding Rate.

Parameters:
  • symbol (str) – Trading pair, for example: BTC-USDT

  • mark_price (str) – Current mark price

  • index_price (str) – Index price

  • last_funding_rate (str) – Last updated funding rate

  • next_funding_time (int) – The remaining time for the next settlement, in milliseconds

  • markPrice (str)

  • indexPrice (str)

  • lastFundingRate (str)

  • nextFundingTime (int)

index_price: str
last_funding_rate: str
mark_price: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

next_funding_time: int
symbol: str
class bingx_py.models.swap.market.MarkPriceAndFundingRateResponse(**data)[source]

Bases: BaseModel

Model for the response of Mark Price and Funding Rate.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (MarkPriceAndFundingRateData) – The response data.

code: int
data: MarkPriceAndFundingRateData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.MarkPriceKlineCandlestick(*, open, close, high, low, volume, openTime, closeTime)[source]

Bases: BaseModel

Model for the data of Mark Price Kline/Candlestick.

Parameters:
  • open (float) – Opening Price

  • close (float) – Closing Price

  • high (float) – High Price

  • low (float) – Low Price

  • volume (float) – Transaction volume

  • open_time (int) – K-line open time stamp, unit milliseconds

  • close_time (int) – K-line close time stamp, unit milliseconds

  • openTime (int)

  • closeTime (int)

close: float
close_time: int
high: float
low: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

open: float
open_time: int
volume: float
class bingx_py.models.swap.market.MarkPriceKlineCandlestickDataResponse(**data)[source]

Bases: BaseModel

Model for the response of Mark Price Kline/Candlestick Data.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (List[MarkPriceKlineCandlestick]) – Array of mark price kline/candlestick data.

code: int
data: list[MarkPriceKlineCandlestick]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.OpenInterestStatisticsData(*, openInterest, symbol, time)[source]

Bases: BaseModel

Model for the data of Open Interest Statistics.

Parameters:
  • open_interest (str) – Position Amount

  • symbol (str) – Contract name

  • time (int) – Matching engine time

  • openInterest (str)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

open_interest: str
symbol: str
time: int
class bingx_py.models.swap.market.OpenInterestStatisticsResponse(**data)[source]

Bases: BaseModel

Model for the response of Open Interest Statistics.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (OpenInterestStatisticsData) – The response data.

code: int
data: OpenInterestStatisticsData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.OrderBookData(*, T, bids, asks, bidsCoin, asksCoin)[source]

Bases: BaseModel

Model for the order book data.

Parameters:
  • T (int) – System time, unit: millisecond

  • bids (List[List[str]]) – Buyer depth. first element price, second element quantity

  • asks (List[List[str]]) – Depth of asks. first element price, second element quantity

  • bids_coin (List[List[str]]) – Buyer depth. first element price, second element quantity(coin)

  • asks_coin (List[List[str]]) – Depth of asks. first element price, second element quantity(coin)

  • bidsCoin (list[list[str]])

  • asksCoin (list[list[str]])

T: int
asks: list[list[str]]
asks_coin: list[list[str]]
bids: list[list[str]]
bids_coin: list[list[str]]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.market.SwapOrderBookResponse(**data)[source]

Bases: BaseModel

Model for the response of Order Book.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (OrderBookData) – Order book data

code: int
data: OrderBookData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.SwapQueryHistoricalTransactionOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of Query historical transaction orders.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (List[HistoricalTransactionOrder]) – Array of historical transaction orders.

code: int
data: list[HistoricalTransactionOrder]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.SwapRecentTradesListResponse(**data)[source]

Bases: BaseModel

Model for the response of Recent Trades List.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (List[Trade]) – Array of trades

code: int
data: list[Trade]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.SwapSymbolPriceTickerData(*, symbol, price, time)[source]

Bases: BaseModel

Model for the data of Symbol Price Ticker.

Parameters:
  • symbol (str) – Trading pair, for example: BTC-USDT

  • price (str) – Price

  • time (int) – Matching engine time

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

price: str
symbol: str
time: int
class bingx_py.models.swap.market.SwapSymbolPriceTickerResponse(**data)[source]

Bases: BaseModel

Model for the response of Symbol Price Ticker.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (SymbolPriceTickerData) – The response data.

code: int
data: SwapSymbolPriceTickerData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.SymbolOrderBookTickerData(*, symbol, bidPrice, bidQty, askPrice, askQty)[source]

Bases: BaseModel

Model for the data of Symbol Order Book Ticker.

Parameters:
  • symbol (str) – Trading pair, for example: BTC-USDT

  • bid_price (float) – Optimal purchase price

  • bid_qty (float) – Order quantity

  • ask_price (float) – Best selling price

  • ask_qty (float) – Order quantity

  • bidPrice (float)

  • bidQty (float)

  • askPrice (float)

  • askQty (float)

ask_price: float
ask_qty: float
bid_price: float
bid_qty: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

symbol: str
class bingx_py.models.swap.market.SymbolOrderBookTickerResponse(**data)[source]

Bases: BaseModel

Model for the response of Symbol Order Book Ticker.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (SymbolOrderBookTickerData) – The response data.

code: int
data: SymbolOrderBookTickerData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.TickerPriceChangeStatisticsData(*, symbol, priceChange, priceChangePercent, lastPrice, lastQty, highPrice, lowPrice, volume, quoteVolume, openPrice, openTime, closeTime, bidPrice, bidQty, askPrice, askQty)[source]

Bases: BaseModel

Model for the data of 24hr Ticker Price Change Statistics.

Parameters:
  • symbol (str) – Trading pair, for example: BTC-USDT

  • price_change (str) – 24 hour price change

  • price_change_percent (str) – Price change percentage

  • last_price (str) – Latest transaction price

  • last_qty (str) – Latest transaction amount

  • high_price (str) – 24-hour highest price

  • low_price (str) – 24 hours lowest price

  • volume (str) – 24-hour volume

  • quote_volume (str) – 24-hour turnover, the unit is USDT

  • open_price (str) – First price within 24 hours

  • open_time (int) – The time when the first transaction occurred within 24 hours

  • close_time (int) – The time when the last transaction occurred within 24 hours

  • bid_price (float) – Bid price

  • bid_qty (float) – Bid quantity

  • ask_price (float) – Ask price

  • ask_qty (float) – Ask quantity

  • priceChange (str)

  • priceChangePercent (str)

  • lastPrice (str)

  • lastQty (str)

  • highPrice (str)

  • lowPrice (str)

  • quoteVolume (str)

  • openPrice (str)

  • openTime (int)

  • closeTime (int)

  • bidPrice (float)

  • bidQty (float)

  • askPrice (float)

  • askQty (float)

ask_price: float
ask_qty: float
bid_price: float
bid_qty: float
close_time: int
high_price: str
last_price: str
last_qty: str
low_price: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

open_price: str
open_time: int
price_change: str
price_change_percent: str
quote_volume: str
symbol: str
volume: str
class bingx_py.models.swap.market.TickerPriceChangeStatisticsResponse(**data)[source]

Bases: BaseModel

Model for the response of 24hr Ticker Price Change Statistics.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (TickerPriceChangeStatisticsData) – The response data.

code: int
data: TickerPriceChangeStatisticsData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.market.Trade(*, time, isBuyerMaker, price, qty, quoteQty)[source]

Bases: BaseModel

Model for a trade in Recent Trades List.

Parameters:
  • time (int) – Transaction time

  • is_buyer_maker (bool) – Whether the buyer is the maker of the order (true / false)

  • price (str) – Transaction price

  • qty (str) – Transaction quantity

  • quote_qty (str) – Turnover

  • isBuyerMaker (bool)

  • quoteQty (str)

is_buyer_maker: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

price: str
qty: str
quote_qty: str
time: int
class bingx_py.models.swap.market.UsdtMPerpFuturesSymbolsResponse(**data)[source]

Bases: BaseModel

Model for the response of USDT-M Perp Futures symbols.

Parameters:
  • code (int) – error code, 0 means successfully response, others means response failure

  • msg (str) – Error Details Description

  • data (List[Contract]) – Array of contracts

code: int
data: list[Contract]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.ApplyVstData(*, amount)[source]

Bases: BaseModel

Model for the response data of ApplyVst.

Parameters:

amount (float) – Amount of VST applied.

amount: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.ApplyVstResponse(**data)[source]

Bases: BaseModel

Model for the response of ApplyVst.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (ApplyVstData) – The response data.

code: int
data: ApplyVstData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.BatchCancelReplaceOrdersResponse(*, code, msg, data)[source]

Bases: BaseModel

Model for the response of BatchCancelReplaceOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[CancelReplaceOrderData]) – The response data.

code: int
data: list[CancelReplaceOrderData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CancelAllAfterData(*, triggerTime, status, note)[source]

Bases: BaseModel

Model for the response data of CancelAllAfter.

Parameters:
  • trigger_time (int) – Trigger time for canceling orders.

  • status (str) – Status of the operation.

  • note (str) – Explanation of the operation.

  • triggerTime (int)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

note: str
status: str
trigger_time: int
class bingx_py.models.swap.trades.CancelAllAfterResponse(**data)[source]

Bases: BaseModel

Model for the response of CancelAllAfter.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • debug_msg (str) – Debug message.

  • data (CancelAllAfterData) – The response data.

code: int
data: CancelAllAfterData
debug_msg: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CancelAllOpenOrdersData(*, success, failed=None)[source]

Bases: BaseModel

Model for the response data of CancelAllOpenOrders.

Parameters:
  • success (List[CancelOrderData]) – List of successfully canceled orders.

  • failed (Optional[List[FailedOrder]]) – List of failed orders. Defaults to None.

failed: list[FailedOrder] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

success: list[CancelOrderData]
class bingx_py.models.swap.trades.CancelAllOpenOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of CancelAllOpenOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CancelAllOpenOrdersData) – The response data.

code: int
data: CancelAllOpenOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CancelMultipleOrdersData(**data)[source]

Bases: BaseModel

Model for the response data of CancelMultipleOrders.

Parameters:
  • success (List[CancelOrderData]) – List of successfully canceled orders.

  • failed (Optional[List[FailedOrder]]) – List of failed orders. Defaults to None.

  • data (Any)

failed: list[FailedOrder] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

success: list[CancelOrderData]
class bingx_py.models.swap.trades.CancelMultipleOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of CancelMultipleOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CancelMultipleOrdersData) – The response data.

code: int
data: CancelMultipleOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CancelOrderData(*, symbol, orderId, side, positionSide, type, origQty, price, executedQty, avgPrice, cumQuote, stopPrice, profit, commission, status, time, updateTime, clientOrderId, leverage, takeProfit, stopLoss, advanceAttr, positionID, takeProfitEntrustPrice, stopLossEntrustPrice, orderType, workingType)[source]

Bases: BaseModel

Model for the response data of CancelOrder.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • order_id (int) – Order ID.

  • side (OrderSide) – BUY or SELL.

  • position_side (PositionSide) – Position direction (BOTH, LONG, SHORT).

  • type (OrderType) – Order type.

  • orig_qty (str) – Original quantity.

  • price (str) – Price.

  • executed_qty (str) – Executed quantity.

  • avg_price (str) – Average transaction price.

  • cum_quote (str) – Transaction amount.

  • stop_price (str) – Trigger price.

  • profit (str) – Profit and loss.

  • commission (str) – Fee.

  • status (OrderStatus) – Order status.

  • time (int) – Order time, unit: millisecond.

  • update_time (int) – Update time, unit: millisecond.

  • client_order_id (str) – Customized order ID.

  • leverage (str) – Leverage.

  • take_profit (Dict[str, Any]) – Take profit settings.

  • stop_loss (Dict[str, Any]) – Stop loss settings.

  • advance_attr (int) – Advanced attributes.

  • position_id (int) – Position ID.

  • take_profit_entrust_price (int) – Take profit entrust price.

  • stop_loss_entrust_price (int) – Stop loss entrust price.

  • order_type (str) – Order type.

  • working_type (WorkingType) – Working type.

  • orderId (int)

  • positionSide (PositionSide)

  • origQty (str)

  • executedQty (str)

  • avgPrice (str)

  • cumQuote (str)

  • stopPrice (str)

  • updateTime (int)

  • clientOrderId (str)

  • takeProfit (dict[str, Any])

  • stopLoss (dict[str, Any])

  • advanceAttr (int)

  • positionID (int)

  • takeProfitEntrustPrice (int)

  • stopLossEntrustPrice (int)

  • orderType (str)

  • workingType (WorkingType)

advance_attr: int
avg_price: str
client_order_id: str
commission: str
cum_quote: str
executed_qty: str
leverage: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
order_type: str
orig_qty: str
position_id: int
position_side: PositionSide
price: str
profit: str
side: OrderSide
status: OrderStatus
stop_loss: dict[str, Any]
stop_loss_entrust_price: int
stop_price: str
symbol: str
take_profit: dict[str, Any]
take_profit_entrust_price: int
time: int
type: OrderType
update_time: int
working_type: WorkingType
class bingx_py.models.swap.trades.CancelOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of CancelOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CancelOrderData) – The response data.

code: int
data: CancelOrderData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CancelReplaceOrderData(*, cancelResult, cancelMsg, cancelResponse, replaceResult, replaceMsg, newOrderResponse)[source]

Bases: BaseModel

Model for the response data of CancelReplaceOrder.

Parameters:
  • cancel_result (str) – Cancellation result.

  • cancel_msg (str) – Cancellation message.

  • cancel_response (OrderDetails) – Details of the canceled order.

  • replace_result (str) – Replacement result.

  • replace_msg (str) – Replacement message.

  • new_order_response (OrderDetails) – Details of the new order.

  • cancelResult (str)

  • cancelMsg (str)

  • cancelResponse (OrderDetails)

  • replaceResult (str)

  • replaceMsg (str)

  • newOrderResponse (OrderDetails)

cancel_msg: str
cancel_response: OrderDetails
cancel_result: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

new_order_response: OrderDetails
replace_msg: str
replace_result: str
class bingx_py.models.swap.trades.CancelReplaceOrderRequest(*, cancel_replace_mode, symbol, type, side, position_side, cancel_client_order_id=None, cancel_order_id=None, cancel_restrictions=None, reduce_only=None, price=None, quantity=None, stop_price=None, price_rate=None, working_type=None, stop_loss=None, take_profit=None, client_order_id=None, close_position=None, activation_price=None, stop_guaranteed=None, time_in_force=None, recv_window=None)[source]

Bases: BaseModel

Model for the request of CancelReplaceOrder.

Parameters:
  • cancel_replace_mode (str) – STOP_ON_FAILURE or ALLOW_FAILURE.

  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • type (str) – Order type.

  • side (str) – BUY or SELL.

  • position_side (str) – LONG, SHORT, or BOTH.

  • cancel_client_order_id (Optional[str]) – Client-defined order ID to cancel. Defaults to None.

  • cancel_order_id (Optional[int]) – Platform order ID to cancel. Defaults to None.

  • cancel_restrictions (Optional[str]) – ONLY_NEW, ONLY_PENDING, or ONLY_PARTIALLY_FILLED. Defaults to None.

  • reduce_only (Optional[bool]) – Whether the order is reduce-only. Defaults to None.

  • price (Optional[float]) – Order price. Defaults to None.

  • quantity (Optional[float]) – Order quantity. Defaults to None.

  • stop_price (Optional[float]) – Trigger price. Defaults to None.

  • price_rate (Optional[float]) – Price rate for TRAILING_STOP_MARKET or TRAILING_TP_SL. Defaults to None.

  • working_type (Optional[str]) – MARK_PRICE, CONTRACT_PRICE, or INDEX_PRICE. Defaults to None.

  • stop_loss (Optional[str]) – Stop loss settings. Defaults to None.

  • take_profit (Optional[str]) – Take profit settings. Defaults to None.

  • client_order_id (Optional[str]) – Custom client order ID. Defaults to None.

  • close_position (Optional[bool]) – Whether to close the position. Defaults to None.

  • activation_price (Optional[float]) – Activation price for TRAILING_STOP_MARKET or TRAILING_TP_SL. Defaults to None.

  • stop_guaranteed (Optional[bool]) – true or false. Defaults to None.

  • time_in_force (Optional[str]) – Time in force. Defaults to None.

  • recv_window (Optional[int]) – Request valid time window (milliseconds). Defaults to None.

activation_price: float | None
cancel_client_order_id: str | None
cancel_order_id: int | None
cancel_replace_mode: str
cancel_restrictions: str | None
client_order_id: str | None
close_position: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position_side: str
price: float | None
price_rate: float | None
quantity: float | None
recv_window: int | None
reduce_only: bool | None
side: str
stop_guaranteed: bool | None
stop_loss: str | None
stop_price: float | None
symbol: str
take_profit: str | None
time_in_force: str | None
type: str
working_type: str | None
class bingx_py.models.swap.trades.CancelReplaceOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of CancelReplaceOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CancelReplaceOrderData) – The response data.

code: int
data: CancelReplaceOrderData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CancelTwapOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of CancelTwapOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (TwapOrderDetails) – The response data.

code: int
data: TwapOrderDetails
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.ChangeMarginTypeResponse(*, code, msg)[source]

Bases: BaseModel

Model for the response of ChangeMarginType.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

code: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.CloseAllPositionsData(*, success, failed=None)[source]

Bases: BaseModel

Model for the response data of CloseAllPositions.

Parameters:
  • success (List[int]) – List of successful order IDs.

  • failed (Optional[List[int]]) – List of failed order IDs. Defaults to None.

failed: list[int] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

success: list[int]
class bingx_py.models.swap.trades.CloseAllPositionsResponse(**data)[source]

Bases: BaseModel

Model for the response of CloseAllPositions.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CloseAllPositionsData) – The response data.

code: int
data: CloseAllPositionsData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.ClosePositionData(*, orderId, positionId, symbol, side, type, positionSide, origQty)[source]

Bases: BaseModel

Model for the response data of ClosePosition.

Parameters:
  • order_id (int) – Order ID.

  • position_id (str) – Position ID.

  • symbol (str) – Trading pair.

  • side (str) – BUY or SELL.

  • type (str) – Order type.

  • position_side (str) – LONG, SHORT, or BOTH.

  • orig_qty (str) – Original quantity.

  • orderId (int)

  • positionId (str)

  • positionSide (str)

  • origQty (str)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
orig_qty: str
position_id: str
position_side: str
side: str
symbol: str
type: str
class bingx_py.models.swap.trades.ClosePositionResponse(**data)[source]

Bases: BaseModel

Model for the response of ClosePosition.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Timestamp of the response.

  • data (ClosePositionData) – The response data.

code: int
data: ClosePositionData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.CurrentAllOpenOrdersData(*, orders)[source]

Bases: BaseModel

Model for the response data of CurrentAllOpenOrders.

Parameters:

orders (List[CancelOrderData]) – List of open orders.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[CancelOrderData]
class bingx_py.models.swap.trades.CurrentAllOpenOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of CurrentAllOpenOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (CurrentAllOpenOrdersData) – The response data.

code: int
data: CurrentAllOpenOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.FailedOrder(*, orderId, clientOrderId, errorCode, errorMessage)[source]

Bases: BaseModel

Model for a failed order.

Parameters:
  • order_id (int) – Order ID.

  • client_order_id (str) – Customized order ID.

  • error_code (int) – Error code.

  • error_message (str) – Error message.

  • orderId (int)

  • clientOrderId (str)

  • errorCode (int)

  • errorMessage (str)

client_order_id: str
error_code: int
error_message: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
class bingx_py.models.swap.trades.FillHistoryOrder(*, filledTm, volume, price, qty, quoteQty, commission, commissionAsset, orderId, tradeId, filledTime, symbol, role, side, positionSide)[source]

Bases: BaseModel

Model for a historical transaction order.

Parameters:
  • filled_tm (str) – Transaction time.

  • volume (str) – Transaction quantity.

  • price (str) – Transaction price.

  • qty (str) – Transaction quantity.

  • quote_qty (str) – Transaction amount.

  • commission (str) – Commission.

  • commission_asset (str) – Asset unit, usually USDT.

  • order_id (str) – Order ID.

  • trade_id (str) – Trade ID.

  • filled_time (str) – Match the transaction time.

  • symbol (str) – Trading pair.

  • role (str) – Active selling and buying, taker: active buying, maker: active selling.

  • side (str) – Buying and selling direction.

  • position_side (str) – Position direction.

  • filledTm (str)

  • quoteQty (str)

  • commissionAsset (str)

  • orderId (str)

  • tradeId (str)

  • filledTime (str)

  • positionSide (str)

commission: str
commission_asset: str
filled_time: str
filled_tm: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: str
position_side: str
price: str
qty: str
quote_qty: str
role: str
side: str
symbol: str
trade_id: str
volume: str
class bingx_py.models.swap.trades.FillOrderDetails(*, filledTm, volume, price, amount, commission, currency, orderId, liquidatedPrice, liquidatedMarginRatio, filledTime, clientOrderId, symbol)[source]

Bases: BaseModel

Model for filled order details.

Parameters:
  • filled_tm (str) – Filled timestamp.

  • volume (str) – Filled volume.

  • price (str) – Filled price.

  • amount (str) – Filled amount.

  • commission (str) – Commission.

  • currency (str) – Currency.

  • order_id (str) – Order ID.

  • liquidated_price (str) – Liquidated price.

  • liquidated_margin_ratio (str) – Liquidated margin ratio.

  • filled_time (str) – Filled time.

  • client_order_id (str) – Client order ID.

  • symbol (str) – Trading symbol.

  • filledTm (str)

  • orderId (str)

  • liquidatedPrice (str)

  • liquidatedMarginRatio (str)

  • filledTime (str)

  • clientOrderId (str)

amount: str
client_order_id: str
commission: str
currency: str
filled_time: str
filled_tm: str
liquidated_margin_ratio: str
liquidated_price: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: str
price: str
symbol: str
volume: str
class bingx_py.models.swap.trades.HedgeModeAutoAddMarginResponse(*, code, msg, amount, type)[source]

Bases: BaseModel

Model for the response of HedgeModeAutoAddMargin.

Parameters:
  • code (int) – Error code, 0 means success, non-zero means failure.

  • msg (str) – Error message.

  • amount (int) – Amount of margin added, in USDT.

  • type (int) – Response type.

amount: int
code: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
type: int
class bingx_py.models.swap.trades.IsolatedMarginChangeHistoryData(**data)[source]

Bases: BaseModel

Model for the response data of IsolatedMarginChangeHistory.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

records: list[IsolatedMarginChangeRecord]
total: int
class bingx_py.models.swap.trades.IsolatedMarginChangeHistoryResponse(**data)[source]

Bases: BaseModel

Model for the response of IsolatedMarginChangeHistory.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (IsolatedMarginChangeHistoryData) – The response data.

code: int
data: IsolatedMarginChangeHistoryData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.IsolatedMarginChangeRecord(*, symbol, positionId, changeReason, marginChange, marginAfterChange, time)[source]

Bases: BaseModel

Model for a margin change record.

Parameters:
  • symbol (str) – Trading pair.

  • position_id (str) – Position ID.

  • change_reason (str) – Reason for the margin change.

  • margin_change (str) – Change amount.

  • margin_after_change (str) – Total amount after change.

  • time (int) – Change time.

  • positionId (str)

  • changeReason (str)

  • marginChange (str)

  • marginAfterChange (str)

change_reason: str
margin_after_change: str
margin_change: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position_id: str
symbol: str
time: int
class bingx_py.models.swap.trades.MarginType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Margin type.

Parameters:
  • ISOLATED – Isolated margin mode.

  • CROSSED – Crossed margin mode.

CROSSED = 'CROSSED'
ISOLATED = 'ISOLATED'
class bingx_py.models.swap.trades.ModifyIsolatedPositionMarginResponse(*, code, msg, amount, type)[source]

Bases: BaseModel

Model for the response of modifying isolated position margin.

Parameters:
  • code (int) – Response code.

  • msg (str) – Response message.

  • amount (float) – The amount of margin modified.

  • type (int) – The type of margin modification.

amount: float
code: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
type: int
class bingx_py.models.swap.trades.OneClickReversePositionData(*, type, positionId, newPositionId, symbol, positionSide, isolated, positionAmt, availableAmt, unrealizedProfit, realizedProfit, initialMargin, margin, liquidationPrice, avgPrice, leverage, positionValue, markPrice, riskRate, maxMarginReduction, pnlRatio, updateTime)[source]

Bases: BaseModel

Model for the response data of OneClickReversePosition.

Parameters:
  • type (str) – Reverse type, Reverse: immediate reverse, TriggerReverse: planned reverse.

  • position_id (str) – Original position ID.

  • new_position_id (str) – New position ID.

  • symbol (str) – Trading pair, e.g.: BTC-USDT.

  • position_side (str) – Position side LONG/SHORT.

  • isolated (bool) – Whether in isolated mode, true: isolated mode, false: cross margin.

  • position_amt (str) – Position amount.

  • available_amt (str) – Available amount for closing.

  • unrealized_profit (str) – Unrealized profit and loss.

  • realized_profit (str) – Realized profit and loss.

  • initial_margin (str) – Initial margin.

  • margin (str) – Margin.

  • liquidation_price (float) – Liquidation price.

  • avg_price (str) – Average entry price.

  • leverage (int) – Leverage.

  • position_value (str) – Position value.

  • mark_price (str) – Mark price.

  • risk_rate (str) – Risk rate, position will be force-reduced or liquidated when risk rate reaches 100%.

  • max_margin_reduction (str) – Maximum reducible margin.

  • pnl_ratio (str) – Unrealized PNL ratio.

  • update_time (int) – Position update time in milliseconds.

  • positionId (str)

  • newPositionId (str)

  • positionSide (str)

  • positionAmt (str)

  • availableAmt (str)

  • unrealizedProfit (str)

  • realizedProfit (str)

  • initialMargin (str)

  • liquidationPrice (float)

  • avgPrice (str)

  • positionValue (str)

  • markPrice (str)

  • riskRate (str)

  • maxMarginReduction (str)

  • pnlRatio (str)

  • updateTime (int)

available_amt: str
avg_price: str
initial_margin: str
isolated: bool
leverage: int
liquidation_price: float
margin: str
mark_price: str
max_margin_reduction: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

new_position_id: str
pnl_ratio: str
position_amt: str
position_id: str
position_side: str
position_value: str
realized_profit: str
risk_rate: str
symbol: str
type: str
unrealized_profit: str
update_time: int
class bingx_py.models.swap.trades.OneClickReversePositionResponse(**data)[source]

Bases: BaseModel

Model for the response of OneClickReversePosition.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp.

  • data (OneClickReversePositionData) – The response data.

code: int
data: OneClickReversePositionData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.OrderDetails(*, symbol, orderId, side, positionSide, type, origQty, price, executedQty, avgPrice, cumQuote, stopPrice, profit, commission, status, time, updateTime, clientOrderId, leverage, takeProfit, stopLoss, advanceAttr, positionID, takeProfitEntrustPrice, stopLossEntrustPrice, orderType, workingType, stopGuaranteed, triggerOrderId)[source]

Bases: BaseModel

Model for the order details.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • order_id (int) – Order ID.

  • side (OrderSide) – BUY/SELL.

  • position_side (PositionSide) – Position direction (LONG, SHORT, BOTH).

  • type (OrderType) – Order type (LIMIT, MARKET, etc.).

  • orig_qty (str) – Original quantity.

  • price (str) – Price.

  • executed_qty (str) – Executed quantity.

  • avg_price (str) – Average price.

  • cum_quote (str) – Transaction amount.

  • stop_price (str) – Trigger price.

  • profit (str) – Profit and loss.

  • commission (str) – Fee.

  • status (OrderStatus) – Order status.

  • time (int) – Order time, unit: millisecond.

  • update_time (int) – Update time, unit: millisecond.

  • client_order_id (str) – Customized order ID for users.

  • leverage (str) – Leverage.

  • take_profit (TakeProfitStopLoss) – Take profit details.

  • stop_loss (TakeProfitStopLoss) – Stop loss details.

  • advance_attr (int) – Advanced attributes.

  • position_id (int) – Position ID.

  • take_profit_entrust_price (float) – Take profit entrust price.

  • stop_loss_entrust_price (float) – Stop loss entrust price.

  • order_type (str) – Order type.

  • working_type (WorkingType) – StopPrice trigger price types.

  • stop_guaranteed (bool) – Whether the guaranteed stop-loss feature is enabled.

  • trigger_order_id (int) – Trigger order ID associated with this order.

  • orderId (int)

  • positionSide (PositionSide)

  • origQty (str)

  • executedQty (str)

  • avgPrice (str)

  • cumQuote (str)

  • stopPrice (str)

  • updateTime (int)

  • clientOrderId (str)

  • takeProfit (TakeProfitStopLoss)

  • stopLoss (TakeProfitStopLoss)

  • advanceAttr (int)

  • positionID (int)

  • takeProfitEntrustPrice (float)

  • stopLossEntrustPrice (float)

  • orderType (str)

  • workingType (WorkingType)

  • stopGuaranteed (bool)

  • triggerOrderId (int)

advance_attr: int
avg_price: str
client_order_id: str
commission: str
cum_quote: str
executed_qty: str
leverage: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
order_type: str
orig_qty: str
position_id: int
position_side: PositionSide
price: str
profit: str
side: OrderSide
status: OrderStatus
stop_guaranteed: bool
stop_loss: TakeProfitStopLoss
stop_loss_entrust_price: float
stop_price: str
symbol: str
take_profit: TakeProfitStopLoss
take_profit_entrust_price: float
time: int
trigger_order_id: int
type: OrderType
update_time: int
working_type: WorkingType
class bingx_py.models.swap.trades.OrderRequest(*, symbol, type, side, position_side=None, reduce_only=None, price=None, quantity=None, stop_price=None, price_rate=None, stop_loss=None, take_profit=None, working_type=None, client_order_id=None, time_in_force=None, close_position=None, activation_price=None, stop_guaranteed=None)[source]

Bases: BaseModel

Model for an individual order in the batch.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • type (OrderType) – Order type.

  • side (OrderSide) – BUY or SELL.

  • position_side (Optional[PositionSide]) – Position direction (BOTH, LONG, SHORT). Defaults to None.

  • reduce_only (Optional[bool]) – true or false. Defaults to None.

  • price (Optional[float]) – Price or trailing stop distance. Defaults to None.

  • quantity (Optional[float]) – Original quantity. Defaults to None.

  • stop_price (Optional[float]) – Trigger price. Defaults to None.

  • price_rate (Optional[float]) – For TRAILING_STOP_MARKET or TRAILING_TP_SL. Maximum: 1. Defaults to None.

  • stop_loss (Optional[str]) – Stop loss settings. Defaults to None.

  • take_profit (Optional[str]) – Take profit settings. Defaults to None.

  • working_type (Optional[WorkingType]) – StopPrice trigger price types. Defaults to None.

  • client_order_id (Optional[str]) – Customized order ID. Defaults to None.

  • time_in_force (Optional[TimeInForce]) – Time in force. Defaults to None.

  • close_position (Optional[bool]) – true or false. Defaults to None.

  • activation_price (Optional[float]) – Activation price for TRAILING_STOP_MARKET or TRAILING_TP_SL. Defaults to None.

  • stop_guaranteed (Optional[bool]) – true or false. Defaults to None.

activation_price: float | None
client_order_id: str | None
close_position: bool | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position_side: PositionSide | None
price: float | None
price_rate: float | None
quantity: float | None
reduce_only: bool | None
side: OrderSide
stop_guaranteed: bool | None
stop_loss: str | None
stop_price: float | None
symbol: str
take_profit: str | None
time_in_force: TimeInForce | None
type: OrderType
working_type: WorkingType | None
class bingx_py.models.swap.trades.OrderResponse(*, symbol, orderId, side, positionSide, type, clientOrderId, workingType)[source]

Bases: BaseModel

Model for the response of a single order.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • order_id (int) – Order ID.

  • side (OrderSide) – BUY or SELL.

  • position_side (PositionSide) – Position direction (BOTH, LONG, SHORT).

  • type (OrderType) – Order type.

  • client_order_id (str) – Customized order ID.

  • working_type (WorkingType) – Working type, e.g., MARK_PRICE.

  • orderId (int)

  • positionSide (PositionSide)

  • clientOrderId (str)

  • workingType (WorkingType)

client_order_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
position_side: PositionSide
side: OrderSide
symbol: str
type: OrderType
working_type: WorkingType
class bingx_py.models.swap.trades.OrderType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Enum for order types.

Parameters:
  • LIMIT (str) – Limit order.

  • MARKET (str) – Market order.

  • STOP_MARKET (str) – Stop market order.

  • TAKE_PROFIT_MARKET (str) – Take profit market order.

  • STOP (str) – Stop order.

  • TAKE_PROFIT (str) – Take profit order.

  • TRIGGER_LIMIT (str) – Trigger limit order.

  • TRIGGER_MARKET (str) – Trigger market order.

  • TRAILING_STOP_MARKET (str) – Trailing stop market order.

  • TRAILING_TP_SL (str) – Trailing take profit/stop loss order.

LIMIT = 'LIMIT'
MARKET = 'MARKET'
STOP = 'STOP'
STOP_MARKET = 'STOP_MARKET'
TAKE_PROFIT = 'TAKE_PROFIT'
TAKE_PROFIT_MARKET = 'TAKE_PROFIT_MARKET'
TRAILING_STOP_MARKET = 'TRAILING_STOP_MARKET'
TRAILING_TP_SL = 'TRAILING_TP_SL'
TRIGGER_LIMIT = 'TRIGGER_LIMIT'
TRIGGER_MARKET = 'TRIGGER_MARKET'
class bingx_py.models.swap.trades.PlaceMultipleOrdersData(**data)[source]

Bases: BaseModel

Model for the response data of PlaceMultipleOrders.

Parameters:
  • orders (List[OrderResponse]) – List of order responses.

  • data (Any)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[OrderResponse]
class bingx_py.models.swap.trades.PlaceMultipleOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of PlaceMultipleOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (PlaceMultipleOrdersData) – The response data.

code: int
data: PlaceMultipleOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.PlaceOrderData(*, symbol, orderId, side, positionSide, type, clientOrderId, workingType)[source]

Bases: BaseModel

Model for the response data of PlaceOrder.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • order_id (int) – Order ID.

  • side (OrderSide) – BUY or SELL.

  • position_side (PositionSide) – Position direction (BOTH, LONG, SHORT).

  • type (OrderType) – Order type.

  • client_order_id (str) – Customized order ID.

  • working_type (WorkingType) – Working type, e.g., MARK_PRICE.

  • orderId (int)

  • positionSide (PositionSide)

  • clientOrderId (str)

  • workingType (WorkingType)

client_order_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
position_side: PositionSide
side: OrderSide
symbol: str
type: OrderType
working_type: WorkingType
class bingx_py.models.swap.trades.PlaceOrderInDemoTradingData(*, symbol, orderId, side, positionSide, type, clientOrderId, workingType)[source]

Bases: BaseModel

Model for the response data of PlaceOrderInDemoTrading.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • order_id (int) – Order ID.

  • side (OrderSide) – BUY or SELL.

  • position_side (PositionSide) – Position direction (BOTH, LONG, SHORT).

  • type (OrderType) – Order type.

  • client_order_id (str) – Customized order ID.

  • working_type (WorkingType) – Working type, e.g., MARK_PRICE.

  • orderId (int)

  • positionSide (PositionSide)

  • clientOrderId (str)

  • workingType (WorkingType)

client_order_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
position_side: PositionSide
side: OrderSide
symbol: str
type: OrderType
working_type: WorkingType
class bingx_py.models.swap.trades.PlaceOrderInDemoTradingResponse(**data)[source]

Bases: BaseModel

Model for the response of PlaceOrderInDemoTrading.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (PlaceOrderInDemoTradingData) – The response data.

code: int
data: PlaceOrderInDemoTradingData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.PlaceOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of PlaceOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (PlaceOrderData) – The response data.

code: int
data: PlaceOrderData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.PlaceTwapOrderData(*, mainOrderId)[source]

Bases: BaseModel

Model for the response data of PlaceTwapOrder.

Parameters:
  • main_order_id (str) – TWAP order number.

  • mainOrderId (str)

main_order_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.PlaceTwapOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of PlaceTwapOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (PlaceTwapOrderData) – The response data.

code: int
data: PlaceTwapOrderData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.PositionAndMaintenanceMarginRatioData(*, tier, symbol, minPositionVal, maxPositionVal, maintMarginRatio, maintAmount)[source]

Bases: BaseModel

Model for the response data of PositionAndMaintenanceMarginRatio.

Parameters:
  • tier (str) – Layer.

  • symbol (str) – Trading pair.

  • min_position_val (str) – Minimum position value.

  • max_position_val (str) – Maximum position value.

  • maint_margin_ratio (str) – Maintenance margin ratio.

  • maint_amount (str) – Maintenance margin quick calculation amount.

  • minPositionVal (str)

  • maxPositionVal (str)

  • maintMarginRatio (str)

  • maintAmount (str)

maint_amount: str
maint_margin_ratio: str
max_position_val: str
min_position_val: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

symbol: str
tier: str
class bingx_py.models.swap.trades.PositionAndMaintenanceMarginRatioResponse(**data)[source]

Bases: BaseModel

Model for the response of PositionAndMaintenanceMarginRatio.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (List[PositionAndMaintenanceMarginRatioData]) – The response data.

code: int
data: list[PositionAndMaintenanceMarginRatioData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.PositionHistoryData(*, positionId, symbol, isolated, positionSide, openTime, updateTime, avgPrice, avgClosePrice, realisedProfit, netProfit, positionAmt, closePositionAmt, leverage, closeAllPositions, positionCommission, totalFunding)[source]

Bases: BaseModel

Model for the response data of QueryPositionHistory.

Parameters:
  • position_id (str) – Position ID.

  • symbol (str) – Trading pair.

  • isolated (bool) – Isolated mode.

  • position_side (str) – Position side LONG/SHORT.

  • open_time (int) – Open time.

  • update_time (int) – Update time.

  • avg_price (str) – Average open price.

  • avg_close_price (float) – Average close price.

  • realised_profit (str) – Realized profit and loss.

  • net_profit (str) – Net profit and loss.

  • position_amt (str) – Position amount.

  • close_position_amt (str) – Closed position amount.

  • leverage (int) – Leverage.

  • close_all_positions (bool) – All positions closed.

  • position_commission (str) – Commission fee.

  • total_funding (str) – Funding fee.

  • positionId (str)

  • positionSide (str)

  • openTime (int)

  • updateTime (int)

  • avgPrice (str)

  • avgClosePrice (float)

  • realisedProfit (str)

  • netProfit (str)

  • positionAmt (str)

  • closePositionAmt (str)

  • closeAllPositions (bool)

  • positionCommission (str)

  • totalFunding (str)

avg_close_price: float
avg_price: str
close_all_positions: bool
close_position_amt: str
isolated: bool
leverage: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

net_profit: str
open_time: int
position_amt: str
position_commission: str
position_id: str
position_side: str
realised_profit: str
symbol: str
total_funding: str
update_time: int
class bingx_py.models.swap.trades.PositionSide(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Enum for position sides.

Parameters:
  • BOTH (str) – Both long and short positions.

  • LONG (str) – Long position.

  • SHORT (str) – Short position.

BOTH = 'BOTH'
LONG = 'LONG'
SHORT = 'SHORT'
class bingx_py.models.swap.trades.QueryAllOrdersData(*, orders)[source]

Bases: BaseModel

Model for the response data of QueryAllOrders.

Parameters:

orders (List[OrderDetails]) – List of orders.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[OrderDetails]
class bingx_py.models.swap.trades.QueryAllOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryAllOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryAllOrdersData) – The response data.

code: int
data: QueryAllOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryHistoricalTransactionDetailsData(**data)[source]

Bases: BaseModel

Model for the response data of QueryHistoricalTransactionDetails.

Parameters:
  • fill_history_orders (List[FillHistoryOrder]) – List of historical transaction orders.

  • total (int) – Total records.

  • data (Any)

fill_history_orders: list[FillHistoryOrder]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

total: int
class bingx_py.models.swap.trades.QueryHistoricalTransactionDetailsResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryHistoricalTransactionDetails.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryHistoricalTransactionDetailsData) – The response data.

code: int
data: QueryHistoricalTransactionDetailsData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryHistoricalTransactionOrdersData(**data)[source]

Bases: BaseModel

Model for the data of querying historical transaction orders.

Parameters:
  • fill_orders (List[FillOrderDetails]) – List of filled order details.

  • data (Any)

fill_orders: list[FillOrderDetails]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.QueryHistoricalTransactionOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of querying historical transaction orders.

Parameters:
code: int
data: QueryHistoricalTransactionOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryLeverageAndAvailablePositionsData(*, longLeverage, shortLeverage, maxLongLeverage, maxShortLeverage, availableLongVol, availableShortVol, availableLongVal, availableShortVal, maxPositionLongVal, maxPositionShortVal)[source]

Bases: BaseModel

Model for the response data of QueryLeverageAndAvailablePositions.

Parameters:
  • long_leverage (int) – Long position leverage.

  • short_leverage (int) – Short position leverage.

  • max_long_leverage (int) – Max Long position leverage.

  • max_short_leverage (int) – Max Short position leverage.

  • available_long_vol (str) – Available Long Volume.

  • available_short_vol (str) – Available Short Volume.

  • available_long_val (str) – Available Long Value.

  • available_short_val (str) – Available Short Value.

  • max_position_long_val (str) – Maximum Position Long Value.

  • max_position_short_val (str) – Maximum Position Short Value.

  • longLeverage (int)

  • shortLeverage (int)

  • maxLongLeverage (int)

  • maxShortLeverage (int)

  • availableLongVol (str)

  • availableShortVol (str)

  • availableLongVal (str)

  • availableShortVal (str)

  • maxPositionLongVal (str)

  • maxPositionShortVal (str)

available_long_val: str
available_long_vol: str
available_short_val: str
available_short_vol: str
long_leverage: int
max_long_leverage: int
max_position_long_val: str
max_position_short_val: str
max_short_leverage: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

short_leverage: int
class bingx_py.models.swap.trades.QueryLeverageAndAvailablePositionsResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryLeverageAndAvailablePositions.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryLeverageAndAvailablePositionsData) – The response data.

code: int
data: QueryLeverageAndAvailablePositionsData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryMarginTypeData(*, marginType)[source]

Bases: BaseModel

Model for the response data of QueryMarginType.

Parameters:
margin_type: MarginType
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.QueryMarginTypeResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryMarginType.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryMarginTypeData) – The response data.

code: int
data: QueryMarginTypeData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryMultiAssetsMarginData(*, currency, totalAmount, availableTransfer, latestMortgageAmount)[source]

Bases: BaseModel

Model for the response data of QueryMultiAssetsMargin.

Parameters:
  • currency (str) – Margin assets, such as BTC and ETH etc.

  • total_amount (str) – Total amount of margin assets.

  • available_transfer (str) – Current available amount for transfer out.

  • latest_mortgage_amount (str) – Latest collateral amount available.

  • totalAmount (str)

  • availableTransfer (str)

  • latestMortgageAmount (str)

available_transfer: str
currency: str
latest_mortgage_amount: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

total_amount: str
class bingx_py.models.swap.trades.QueryMultiAssetsMarginResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryMultiAssetsMargin.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[QueryMultiAssetsMarginData]) – The response data.

code: int
data: list[QueryMultiAssetsMarginData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryMultiAssetsModeData(*, assetMode)[source]

Bases: BaseModel

Model for the response data of QueryMultiAssetsMode.

Parameters:
  • asset_mode (str) – Multi-assets mode, singleAssetMode or multiAssetsMode.

  • assetMode (str)

asset_mode: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.QueryMultiAssetsModeResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryMultiAssetsMode.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryMultiAssetsModeData) – The response data.

code: int
data: QueryMultiAssetsModeData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryMultiAssetsRulesData(*, marginAssets, ltv, collateralValueRatio, maxTransfer, indexPrice)[source]

Bases: BaseModel

Model for the response data of QueryMultiAssetsRules.

Parameters:
  • margin_assets (str) – Margin assets, such as BTC, ETH, etc.

  • ltv (str) – Loan-to-Value ratio, value conversion ratio used when calculating available margin.

  • collateral_value_ratio (str) – Collateral ratio, value conversion ratio used when calculating risk rate.

  • max_transfer (str) – Transfer limit, maximum amount that can be transferred in. Empty means no limit.

  • index_price (str) – Current latest USD index price for the asset.

  • marginAssets (str)

  • collateralValueRatio (str)

  • maxTransfer (str)

  • indexPrice (str)

collateral_value_ratio: str
index_price: str
ltv: str
margin_assets: str
max_transfer: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.QueryMultiAssetsRulesResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryMultiAssetsRules.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[QueryMultiAssetsRulesData]) – The response data.

code: int
data: list[QueryMultiAssetsRulesData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryOrderDetailsData(**data)[source]

Bases: BaseModel

Model for the response data of QueryOrderDetails.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order: OrderDetails
class bingx_py.models.swap.trades.QueryOrderDetailsResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryOrderDetails.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryOrderDetailsData) – The response data.

code: int
data: QueryOrderDetailsData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryPendingOrderStatusData(*, order)[source]

Bases: BaseModel

Model for the response data of QueryPendingOrderStatus.

Parameters:

order (CancelOrderData) – The order data.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order: CancelOrderData
class bingx_py.models.swap.trades.QueryPendingOrderStatusResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryPendingOrderStatus.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (QueryPendingOrderStatusData) – The response data.

code: int
data: QueryPendingOrderStatusData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryPositionHistoryResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryPositionHistory.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (List[PositionHistoryData]) – The response data.

code: int
data: list[PositionHistoryData]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryPositionModeData(*, dualSidePosition)[source]

Bases: BaseModel

Model for the data of querying position mode.

Parameters:
  • dual_side_position (str) – Indicates whether dual-side position mode is enabled.

  • dualSidePosition (str)

dual_side_position: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.QueryPositionModeResponse(**data)[source]

Bases: BaseModel

Model for the response of querying position mode.

Parameters:
  • code (int) – Response code.

  • msg (str) – Response message.

  • data (QueryPositionModeData) – The response data containing position mode information.

code: int
data: QueryPositionModeData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.QueryTwapEntrustedOrderData(**data)[source]

Bases: BaseModel

Model for the response data of QueryTwapEntrustedOrder.

Parameters:
  • list (List[TwapOrder]) – List of TWAP orders.

  • total (int) – Total records.

  • data (Any)

list: list[TwapOrder]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

total: int
class bingx_py.models.swap.trades.QueryTwapEntrustedOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryTwapEntrustedOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (QueryTwapEntrustedOrderData) – The response data.

code: int
data: QueryTwapEntrustedOrderData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.QueryTwapHistoricalOrdersData(**data)[source]

Bases: BaseModel

Model for the response data of QueryTwapHistoricalOrders.

Parameters:
  • list (List[TwapOrder]) – List of TWAP orders.

  • total (int) – Total records.

  • data (Any)

list: list[TwapOrder]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

total: int
class bingx_py.models.swap.trades.QueryTwapHistoricalOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryTwapHistoricalOrders.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (QueryTwapHistoricalOrdersData) – The response data.

code: int
data: QueryTwapHistoricalOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.QueryTwapOrderDetailsResponse(**data)[source]

Bases: BaseModel

Model for the response of QueryTwapOrderDetails.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • timestamp (int) – Response timestamp in milliseconds.

  • data (TwapOrderDetails) – The response data.

code: int
data: TwapOrderDetails
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
timestamp: int
class bingx_py.models.swap.trades.SetLeverageData(*, leverage, symbol, availableLongVol, availableShortVol, availableLongVal, availableShortVal, maxPositionLongVal, maxPositionShortVal)[source]

Bases: BaseModel

Model for the response data of SetLeverage.

Parameters:
  • leverage (int) – Leverage value.

  • symbol (str) – Trading pair.

  • available_long_vol (str) – Available Long Volume.

  • available_short_vol (str) – Available Short Volume.

  • available_long_val (str) – Available Long Value.

  • available_short_val (str) – Available Short Value.

  • max_position_long_val (str) – Maximum Position Long Value.

  • max_position_short_val (str) – Maximum Position Short Value.

  • availableLongVol (str)

  • availableShortVol (str)

  • availableLongVal (str)

  • availableShortVal (str)

  • maxPositionLongVal (str)

  • maxPositionShortVal (str)

available_long_val: str
available_long_vol: str
available_short_val: str
available_short_vol: str
leverage: int
max_position_long_val: str
max_position_short_val: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

symbol: str
class bingx_py.models.swap.trades.SetLeverageResponse(**data)[source]

Bases: BaseModel

Model for the response of SetLeverage.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (SetLeverageData) – The response data.

code: int
data: SetLeverageData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.SetPositionModeData(*, dualSidePosition)[source]

Bases: BaseModel

Model for the data of setting position mode.

Parameters:
  • dual_side_position (str) – Indicates whether dual-side position mode is enabled.

  • dualSidePosition (str)

dual_side_position: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.SetPositionModeResponse(**data)[source]

Bases: BaseModel

Model for the response of setting position mode.

Parameters:
  • code (int) – Response code.

  • msg (str) – Response message.

  • data (SetPositionModeData) – The response data containing position mode information.

code: int
data: SetPositionModeData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.SwapHistoryOrderDetails(*, symbol, orderId, side, positionSide, type, origQty, price, executedQty, avgPrice, cumQuote, stopPrice, profit, commission, status, time, updateTime, clientOrderId, leverage, takeProfit, stopLoss, advanceAttr, positionID, takeProfitEntrustPrice, stopLossEntrustPrice, orderType, workingType, stopGuaranteed, triggerOrderId)[source]

Bases: BaseModel

Model for historical order details.

Parameters:
  • symbol (str) – Trading symbol.

  • order_id (int) – Order ID.

  • side (OrderSide) – Order side (BUY/SELL).

  • position_side (PositionSide) – Position side (LONG/SHORT).

  • type (OrderType) – Order type (LIMIT, MARKET, etc.).

  • orig_qty (str) – Original quantity.

  • price (str) – Order price.

  • executed_qty (str) – Executed quantity.

  • avg_price (str) – Average price.

  • cum_quote (str) – Cumulative quote asset transacted.

  • stop_price (str) – Stop price.

  • profit (str) – Profit.

  • commission (str) – Commission.

  • status (OrderStatus) – Order status.

  • time (int) – Order creation time.

  • update_time (int) – Order update time.

  • client_order_id (str) – Client order ID.

  • leverage (str) – Leverage used.

  • take_profit (TakeProfitStopLoss) – Take profit details.

  • stop_loss (TakeProfitStopLoss) – Stop loss details.

  • advance_attr (int) – Advanced attributes.

  • position_id (int) – Position ID.

  • take_profit_entrust_price (float) – Take profit entrust price.

  • stop_loss_entrust_price (float) – Stop loss entrust price.

  • order_type (str) – Order type.

  • working_type (WorkingType) – Working type (MARK_PRICE, CONTRACT_PRICE).

  • stop_guaranteed (bool) – Whether stop loss is guaranteed.

  • trigger_order_id (int) – Trigger order ID.

  • orderId (int)

  • positionSide (PositionSide)

  • origQty (str)

  • executedQty (str)

  • avgPrice (str)

  • cumQuote (str)

  • stopPrice (str)

  • updateTime (int)

  • clientOrderId (str)

  • takeProfit (TakeProfitStopLoss)

  • stopLoss (TakeProfitStopLoss)

  • advanceAttr (int)

  • positionID (int)

  • takeProfitEntrustPrice (float)

  • stopLossEntrustPrice (float)

  • orderType (str)

  • workingType (WorkingType)

  • stopGuaranteed (bool)

  • triggerOrderId (int)

advance_attr: int
avg_price: str
client_order_id: str
commission: str
cum_quote: str
executed_qty: str
leverage: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
order_type: str
orig_qty: str
position_id: int
position_side: PositionSide
price: str
profit: str
side: OrderSide
status: OrderStatus
stop_guaranteed: bool
stop_loss: TakeProfitStopLoss
stop_loss_entrust_price: float
stop_price: str
symbol: str
take_profit: TakeProfitStopLoss
take_profit_entrust_price: float
time: int
trigger_order_id: int
type: OrderType
update_time: int
working_type: WorkingType
class bingx_py.models.swap.trades.SwapQueryOrderHistoryData(**data)[source]

Bases: BaseModel

Model for the data of querying order history.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[SwapHistoryOrderDetails]
class bingx_py.models.swap.trades.SwapQueryOrderHistoryResponse(**data)[source]

Bases: BaseModel

Model for the response of querying order history.

Parameters:
  • code (int) – Response code.

  • msg (str) – Response message.

  • data (SwapQueryOrderHistoryData) – The response data containing historical orders.

code: int
data: SwapQueryOrderHistoryData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.SwitchMultiAssetsModeData(*, assetMode)[source]

Bases: BaseModel

Model for the response data of SwitchMultiAssetsMode.

Parameters:
  • asset_mode (str) – Multi-assets mode (singleAssetMode or multiAssetsMode).

  • assetMode (str)

asset_mode: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class bingx_py.models.swap.trades.SwitchMultiAssetsModeResponse(**data)[source]

Bases: BaseModel

Model for the response of SwitchMultiAssetsMode.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (SwitchMultiAssetsModeData) – The response data.

code: int
data: SwitchMultiAssetsModeData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.TakeProfitStopLoss(*, type, quantity, stopPrice, price, workingType)[source]

Bases: BaseModel

Model for Take Profit and Stop Loss details.

Parameters:
  • type (str) – Type of the order.

  • quantity (float) – Quantity.

  • stop_price (float) – Stop price.

  • price (float) – Price.

  • working_type (str) – Working type.

  • stopPrice (float)

  • workingType (str)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

price: float
quantity: float
stop_price: float
type: str
working_type: str
class bingx_py.models.swap.trades.TestOrderData(*, symbol, orderId, side, positionSide, type, clientOrderId, workingType)[source]

Bases: BaseModel

Model for the response data of TestOrder.

Parameters:
  • symbol (str) – Trading pair, e.g., BTC-USDT.

  • order_id (int) – Order ID.

  • side (OrderSide) – BUY or SELL.

  • position_side (PositionSide) – Position direction (BOTH, LONG, SHORT).

  • type (OrderType) – Order type.

  • client_order_id (str) – Customized order ID.

  • working_type (WorkingType) – Working type, e.g., MARK_PRICE.

  • orderId (int)

  • positionSide (PositionSide)

  • clientOrderId (str)

  • workingType (WorkingType)

client_order_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_id: int
position_side: PositionSide
side: OrderSide
symbol: str
type: OrderType
working_type: WorkingType
class bingx_py.models.swap.trades.TestOrderResponse(**data)[source]

Bases: BaseModel

Model for the response of TestOrder.

Parameters:
  • code (int) – Error code, 0 means successfully response, others means response failure.

  • msg (str) – Error details description.

  • data (TestOrderData) – The response data.

code: int
data: TestOrderData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.TwapOrder(*, symbol, mainOrderId, side, positionSide, priceType, priceVariance, triggerPrice, interval, amountPerOrder, totalAmount, orderStatus, executedQty, duration, maxDuration, createdTime, updateTime)[source]

Bases: BaseModel

Model for a TWAP order.

Parameters:
  • symbol (str) – Trading pair.

  • main_order_id (str) – TWAP order number.

  • side (str) – Buying and selling direction (SELL, BUY).

  • position_side (str) – LONG or SHORT.

  • price_type (str) – Price limit type (constant or percentage).

  • price_variance (str) – Price difference or slippage ratio.

  • trigger_price (str) – Trigger price.

  • interval (int) – Time interval for order placing (5-120s).

  • amount_per_order (str) – Quantity of a single order.

  • total_amount (str) – Total trading volume.

  • order_status (str) – Order status.

  • executed_qty (str) – Volume.

  • duration (int) – Execution time in seconds.

  • max_duration (int) – Maximum execution time in seconds.

  • created_time (int) – Order creation time in milliseconds.

  • update_time (int) – Order update time in milliseconds.

  • mainOrderId (str)

  • positionSide (str)

  • priceType (str)

  • priceVariance (str)

  • triggerPrice (str)

  • amountPerOrder (str)

  • totalAmount (str)

  • orderStatus (str)

  • executedQty (str)

  • maxDuration (int)

  • createdTime (int)

  • updateTime (int)

amount_per_order: str
created_time: int
duration: int
executed_qty: str
interval: int
main_order_id: str
max_duration: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_status: str
position_side: str
price_type: str
price_variance: str
side: str
symbol: str
total_amount: str
trigger_price: str
update_time: int
class bingx_py.models.swap.trades.TwapOrderDetails(*, symbol, mainOrderId, side, positionSide, priceType, priceVariance, triggerPrice, interval, amountPerOrder, totalAmount, orderStatus, executedQty, duration, maxDuration, createdTime, updateTime)[source]

Bases: BaseModel

Model for the response data of QueryTwapOrderDetails and CancelTwapOrder.

Parameters:
  • symbol (str) – Trading pair.

  • main_order_id (str) – TWAP order number.

  • side (str) – Buying and selling direction (SELL, BUY).

  • position_side (str) – LONG or SHORT.

  • price_type (str) – Price limit type (constant or percentage).

  • price_variance (str) – Price difference or slippage ratio.

  • trigger_price (str) – Trigger price.

  • interval (int) – Time interval for order placing (5-120s).

  • amount_per_order (str) – Quantity of a single order.

  • total_amount (str) – Total trading volume.

  • order_status (str) – Order status.

  • executed_qty (str) – Volume.

  • duration (int) – Execution time in seconds.

  • max_duration (int) – Maximum execution time in seconds.

  • created_time (int) – Order creation time in milliseconds.

  • update_time (int) – Order update time in milliseconds.

  • mainOrderId (str)

  • positionSide (str)

  • priceType (str)

  • priceVariance (str)

  • triggerPrice (str)

  • amountPerOrder (str)

  • totalAmount (str)

  • orderStatus (str)

  • executedQty (str)

  • maxDuration (int)

  • createdTime (int)

  • updateTime (int)

amount_per_order: str
created_time: int
duration: int
executed_qty: str
interval: int
main_order_id: str
max_duration: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

order_status: str
position_side: str
price_type: str
price_variance: str
side: str
symbol: str
total_amount: str
trigger_price: str
update_time: int
class bingx_py.models.swap.trades.UsersForceOrdersData(*, orders)[source]

Bases: BaseModel

Model for the data of users’ force orders.

Parameters:

orders (List[OrderDetails]) – List of force order details.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orders: list[OrderDetails]
class bingx_py.models.swap.trades.UsersForceOrdersResponse(**data)[source]

Bases: BaseModel

Model for the response of users’ force orders.

Parameters:
  • code (int) – Response code.

  • msg (str) – Response message.

  • data (UsersForceOrdersData) – The response data containing force orders.

code: int
data: UsersForceOrdersData
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

msg: str
class bingx_py.models.swap.trades.WorkingType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Enum for working types.

Parameters:
  • MARK_PRICE (str) – Order is based on the mark price.

  • CONTRACT_PRICE (str) – Order is based on the contract price.

  • INDEX_PRICE (str) – Order is based on the index price.

CONTRACT_PRICE = 'CONTRACT_PRICE'
INDEX_PRICE = 'INDEX_PRICE'
MARK_PRICE = 'MARK_PRICE'