Type/to search
Built-in Functions
Structures
Trade
Ticker
Record
Order
Condition
OrderBook
Depth
Account
Asset
Position
Market
Funding
OtherStruct
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Chart-options
KLineChart-options
SetData-data
EventLoop-return
DBExec-return
Thread.join-return
Built-in Variables

Data structure for contract position information.

Attributes

NameTypeDescription

Info

object

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

Symbol

string

The Symbol field is the trading symbol code defined by the FMZ platform, with a format consistent with the Symbol field of the Ticker structure.

  • For spot exchange objects, the format of the Symbol field value (example) is: BTC_USDT, representing the BTC_USDT spot trading pair.

  • For futures exchange objects, the format of the Symbol field value (example) is: BTC_USDT.swap, representing the BTC USDT-margined perpetual contract.

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 or an empty array.

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.