@@ -12,52 +12,58 @@ public struct SwiftTraderStopLimitOrderInput {
12
12
13
13
// MARK: - Properties
14
14
15
+ public let clean : Bool
16
+ public let contractSymbol : String
17
+ public let currentPrice : Double
18
+ public let entryPrice : Double
15
19
public let exchange : SwiftTraderExchange
20
+ public let isLong : Bool
16
21
public let ticker : String
17
22
public let tickerSize : String
18
- public let contractSymbol : String
19
- public let entryPrice : Double
20
- public let currentPrice : Double
21
- public let profitPercentage : Double
22
23
public let offset : Double
23
- public let clean : Bool
24
+ public let profitPercentage : Double
24
25
25
26
// MARK: - Lifecycle
26
27
27
28
/// Creates a `SwiftTraderOrderInput` instance.
28
29
///
29
30
/// - Parameters:
31
+ /// - clean: When `true`, all the untriggered stop orders for the `contractSymbol` will be cancelled before placing a new one.
32
+ /// Cleaning is done via `SwiftTrader.kucoinFuturesCancelStopOrders(symbol:)`. In case that fails, the execution continues
33
+ /// and a new order will be placed regardless.
34
+ /// - contractSymbol: E.g.: XBTCUSDTM
35
+ /// - currentPrice: The current price of the asset.
36
+ /// - entryPrice: E.g.: "42.856", "43567.98", "127.01".
30
37
/// - exchange: E.g.: Kucoin, Binance
38
+ /// - isLong: Indicates the side of the position. `true` indicates "long". `false` indicates "short. The side is taken into consideration
39
+ /// when performing trailing stop logic.
31
40
/// - ticker: E.g.: BTCUSDT
32
41
/// - tickerSize: E.g.: "1", "0.05", "0.00001"
33
- /// - contractSymbol: E.g.: XBTCUSDTM
34
- /// - entryPrice: E.g.: "42.856", "43567.98", "127.01".
35
- /// - currentPrice: The current price of the asset.
36
- /// - profitPercentage: The percentage of the profit at this point, e.g.: "1.5", "0.67".
37
42
/// - offset: How far the **"target price"** of the stop order will be from the `currentPrice`. For example,
38
43
/// suppose the `profitPercentage` is `1.0%` and the `offset` is `0.75%`. The stop order to be placed will be `0.25%`
39
44
/// of the current price (`1.0%` - `0.75%`). Using the same `offset`, if the `profitPercentage` is now `2.0%`, the stop order
40
45
/// will be placed at `1.25%` of the current price (`2.0%` - `0.75%`).
41
- /// - clean: When `true`, all the untriggered stop orders for the `contractSymbol` will be cancelled before placing a new one.
42
- /// Cleaning is done via `SwiftTrader.kucoinFuturesCancelStopOrders(symbol:)`. In case that fails, the execution continues
43
- /// and a new order will be placed regardless.
44
- public init ( exchange: SwiftTraderExchange ,
45
- ticker: String ,
46
- tickerSize: String ,
46
+ /// - profitPercentage: The percentage of the profit at this point, e.g.: "1.5", "0.67".
47
+ public init ( clean: Bool ,
47
48
contractSymbol: String ,
48
- entryPrice: Double ,
49
49
currentPrice: Double ,
50
- profitPercentage: Double ,
50
+ entryPrice: Double ,
51
+ exchange: SwiftTraderExchange ,
52
+ isLong: Bool ,
53
+ ticker: String ,
54
+ tickerSize: String ,
51
55
offset: Double ,
52
- clean: Bool ) {
56
+ profitPercentage: Double
57
+ ) {
58
+ self . clean = clean
59
+ self . contractSymbol = contractSymbol
60
+ self . currentPrice = currentPrice
61
+ self . entryPrice = entryPrice
53
62
self . exchange = exchange
63
+ self . isLong = isLong
54
64
self . ticker = ticker
55
65
self . tickerSize = tickerSize
56
- self . contractSymbol = contractSymbol
57
- self . entryPrice = entryPrice
58
- self . currentPrice = currentPrice
59
- self . profitPercentage = profitPercentage
60
66
self . offset = offset
61
- self . clean = clean
67
+ self . profitPercentage = profitPercentage
62
68
}
63
69
}
0 commit comments