TradablePosition
@objc public class TradablePosition: NSObject
Contains the position data, such as unique ID, instrument ID, amount, side, open/closed profit and more.
-
Unique identifier of the position.
Declaration
Swift
@objc public let id: String
-
The unique identifier for the position’s instrument.
Declaration
Swift
@objc public let instrumentId: String
-
Unix timestamp in milliseconds of the position creation.
Declaration
Swift
@objc public let creationTime: UInt64
-
Open price of the position (volume-weighted average).
Declaration
Swift
@objc public let openPrice: Double
-
Amount of the position.
Declaration
Swift
@objc public let amount: Double
-
Side of the position.
Declaration
Swift
@objc public let side: TradableOrderSide
-
Unix timestamp in milliseconds of the position last modification.
Declaration
Swift
@objc public let lastModified: UInt64
-
Closed profit in the instrument currency for the already closed part of the position. Might not be available.
Declaration
Swift
public let closedNotionalProfit: Double?
-
Open profit in the instrument currency. Might not be available.
Declaration
Swift
public let openNotionalProfit: Double?
-
Closed profit in the account currency for the already closed part of the position. Might not be available.
Declaration
Swift
public let closedProfit: Double?
-
Open profit in the account currency if the position was to be closed at the current price. Might not be available.
Declaration
Swift
public let openProfit: Double?
-
The last tick price for the position’s symbol. Might not be available.
Declaration
Swift
public let lastPrice: Double?
-
Other fees, such as commission. Might not be available.
Declaration
Swift
public let otherFees: Double?
-
Rollover fees, that some system charge for having a position overnight. Might not be available.
Declaration
Swift
public let rolloverFees: Double?
-
Stop loss protection price. Might not be available.
Declaration
Swift
public let stopLoss: Double?
-
Take profit protection price. Might not be available.
Declaration
Swift
public let takeProfit: Double?
-
Simple description of this object.
Declaration
Swift
public override var description: String
-
Reduces a position size to the specified amount.
Declaration
Swift
@objc public func reduceSize(to amount: TradableAmount, completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
amount
The amount that the position size should be reduced to.
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Closes this position.
Declaration
Swift
@objc public func close(_ completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Adds or modifies a single protection.
Declaration
Swift
@objc public func modifySingleProtection(ofType protectionType: TradableSingleProtection, with priceModification: TradablePriceModification, completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
protectionType
The type of protection that should be added or modified.
priceModification
The TradablePriceModification object containing the changes to be made to a protection.
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Cancels a single protection.
Declaration
Swift
@objc public func cancelSingleProtection(ofType protectionType: TradableSingleProtection, completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
protectionType
The type of protection that should be cancelled.
completionHandler
A closure to be called when the response comes back, with optional TradableError object.
-
Adds or modifies protections.
Declaration
Swift
@objc public func modifyProtections(_ protections: TradableProtections, completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
protections
The protection object containing the changes to be made to protections.
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Cancels protections.
Declaration
Swift
@objc public func cancelProtections(_ completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Gets the instrument for this position.
Declaration
Swift
@objc public func getInstrument(_ completionHandler: ((_ instrument: TradableInstrument?, _ error: TradableError?) -> Void)!)
Parameters
completionHandler
A closure to be called when the response comes back, with an optional TradableInstrument object and an optional TradableError object.