TradableOrder
@objc public class TradableOrder: NSObject
Contains the order data, such as unique ID, instrument ID, amount, type, price, status and more.
-
Amount of the order.
Declaration
Swift
@objc public let amount: Double
-
Unix timestamp in milliseconds of the order creation.
Declaration
Swift
@objc public let creationDate: UInt64
-
Unique identifier of the order.
Declaration
Swift
@objc public let id: String
-
The unique identifier for the order’s instrument.
Declaration
Swift
@objc public let instrumentId: String
-
Order side.
Declaration
Swift
@objc public let side: TradableOrderSide
-
Order type.
Declaration
Swift
@objc public let type: TradableOrderType
-
Order status.
Declaration
Swift
@objc public let status: TradableOrderStatus
-
The price the limit or stop order will trigger at. For market orders it will be 0.
Declaration
Swift
@objc public let price: Double
-
Identifiers of the affected positions. Might not be available.
Declaration
Swift
@objc public let affectedPositionsIds: [String]?
-
The last tick price for the order’s symbol. Might not be available.
Declaration
Swift
public let lastPrice: Double?
-
The average execution price. Only available after the order is executed.
Declaration
Swift
public let executionPrice: Double?
-
The take profit attached to the order. Will be nil if no take profit is attached to the order.
Declaration
Swift
@objc public let takeProfit: TradableOrderProtection?
-
The stop loss attached to the order. Will be nil if no stop loss is attached to the order.
Declaration
Swift
@objc public let stopLoss: TradableOrderProtection?
-
Simple description of this object.
Declaration
Swift
public override var description: String
-
Modifies the order.
Declaration
Swift
@objc public func modify(with orderModification: TradableOrderModification, completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
orderModification
An order modification object containing details about modifications to be done to this order.
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Cancels the order.
Declaration
Swift
@objc public func cancel(_ completionHandler: ((_ error: TradableError?) -> Void)!)
Parameters
completionHandler
A closure to be called when the response comes back, with an optional TradableError object.
-
Fetches the positions that have been affected by this order.
Declaration
Swift
@objc public func getAffectedPositions(_ completionHandler: ((_ affectedPositions: [TradablePosition]?) -> Void)!)
Parameters
completionHandler
A closure containing an optional list of affected positions.
-
Gets the instrument for this order.
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.
-
Sets a TradableOrderStatusDelegate for this order. The delegate will be notified about order status change. Starts full updates if no orders or full updates are running, or orders updates if no updates are running at all. The delegate will not be called if full/orders updates are not running!
Throws
TradableArgumentError.incorrectOrderStatus if the order status is incorrect (not .pending).
Declaration
Swift
@objc public func setStatusChangeDelegate(_ delegate: TradableOrderStatusDelegate?) throws
Parameters
delegate
The delegate to be set. If nil, the delegate previously assigned will be removed.