Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
Built-in Variables and Constants
Conventions
Exchanges

Returned by exchange.GetPositions(): instrument, leverage, amount and frozen amount, average price, unrealized profit, direction, contract code and margin.

Attributes

NameTypeDescription

Info

object

Raw data returned by the exchange interface. This attribute does not exist in backtesting mode.

Symbol

string

The FMZ symbol, written as described in Symbols, for example BTC_USDT on spot and BTC_USDT.swap (USDT-margined perpetual) on futures; the same format as Symbol of Ticker.

MarginLevel

number

Position leverage multiplier. If the exchange interface does not provide this data, it will be filled through calculation and may contain errors.

Amount

number

Position quantity, usually a positive integer (number of contracts). Note that contract multipliers, values, and other contract specifications may differ between exchanges.

FrozenAmount

number

Frozen position quantity, temporarily frozen position quantity when close orders are not filled.

Price

number

Average position price. In principle, this attribute is the overall average price of the position (not involved in settlement). If the exchange interface does not provide this data, it will be filled with the existing average position price from the exchange interface (involved in settlement).

Profit

number

Floating profit and loss of the position. In principle, this is the unrealized profit and loss of the position. If the exchange interface does not provide this data, it will be filled with other profit and loss data from the exchange interface. The unit of the profit and loss value is the same as the unit of the current contract margin.

Type

number

Position type, refer to PD_LONG, PD_SHORT.

ContractType

string

Contract code. For specific content, please refer to the description of the exchange.SetContractType function.

Margin

number

Margin occupied by the position. If the exchange interface does not provide this data, it will be filled with 0.

See Also

Remarks

The exchange.GetPositions() function returns a Position array; it is an empty array when there are no positions, and a null value (null in JavaScript, None in Python) when the call fails.

For cryptocurrency futures, it should be noted that in the Position structure array returned by the exchange.GetPositions() function, the FrozenAmount, Profit, and Margin attributes of the position data structure may have different definitions when calling the exchange.GetPositions() interface for different exchange objects, as the data provided by exchanges is not unified.

For example, some exchanges do not have frozen position data in their position data, in which case FrozenAmount is 0. If specific data needs to be calculated, the raw data in the Info attribute can be used for calculation and analysis.