The resource loading... loading...

Position

Structure of contract position information.

The original data returned by the exchange interface, no such attribute is available for backtesting. Info object The Symbol field is the trading product code defined by the FMZ platform, and its format is consistent with the Symbol field of the {@struct/Ticker Ticker} structure.

  • For spot exchange objects, the format of the Symbol field value is (for example): BTC_USDT, indicating the BTC_USDT spot trading pair.
  • For futures exchange objects, the format of the Symbol field value is (for example): BTC_USDT.swap, which represents the USDT-standard perpetual contract of BTC.

Symbol string Position bar size, filled by calculation if the exchange interface does not provide this data, it may be inaccurate. MarginLevel number Position size, which is usually a positive integer (number of contract numbers). Note that contract specifications such as contract multipliers, values, etc. may differ from one exchange to another. Amount number Position freeze amount, the number of temporarily frozen positions when the closed order is not filled. FrozenAmount number Average price of the position, which in principle is the average price of the position as a whole (does not participate in settlement). If the data is not provided by the exchange interface, it is filled with the average price of positions available on the exchange interface (participating in settlement). Price number The floating profit/loss of the position is in principle the unrealized profit/loss of the position, if the data is not provided by the exchange interface, it will be filled with other profit/loss data of the exchange interface. The unit of profit and loss value is the same as the unit of current contract margin. Profit number Position type, refer to {@var/POSITION_DIRECTION/PD_LONG PD_LONG}, {@var/POSITION_DIRECTION/PD_SHORT PD_SHORT}. Type number Contract code, see the description of the {@fun/Futures/exchange.SetContractType exchange.SetContractType} function for details. ContractType string The margin occupied by the position, filled with 0 if the exchange interface does not provide this data. Margin number

The exchange.GetPositions() function returns an array of Positions or an empty array. For cryptocurrency futures, it is important to note that the Position structure array returned by the exchange.GetPositions() function. For the FrozenAmount, Profit, and Margin attributes in the position data structure, as the data provided by the exchange is not uniform, the GetPositions() interface, the definition of the data returned by the exchange object may be different. For example, some exchanges have no position freeze data in the position data, so the FrozenAmount is 0. If you need to calculate certain data, you can use the original data in the Info attribute to calculate and analysis.

{@fun/Futures/exchange.GetPositions exchange.GetPositions}

Asset Market