Position
Data structure for contract position information.
Attributes
| Name | Type | Description |
Info | object | Raw data returned by the exchange interface. This attribute does not exist in backtesting mode. |
Symbol | string | The
|
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 | |
ContractType | string | Contract code. For specific content, please refer to the description of the |
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.