Skip to content

Commit 27e6556

Browse files
author
Fernando Fernandes
committed
Handle short orders
1 parent da73558 commit 27e6556

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Sources/SwiftTrader/Model/SwiftTraderOrderInput.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public struct SwiftTraderStopLimitOrderInput {
1818
public let entryPrice: Double
1919
public let exchange: SwiftTraderExchange
2020
public let isLong: Bool
21-
public let ticker: String
22-
public let tickerSize: String
2321
public let offset: Double
2422
public let profitPercentage: Double
23+
public let ticker: String
24+
public let tickerSize: String
2525

2626
// MARK: - Lifecycle
2727

@@ -35,35 +35,34 @@ public struct SwiftTraderStopLimitOrderInput {
3535
/// - currentPrice: The current price of the asset.
3636
/// - entryPrice: E.g.: "42.856", "43567.98", "127.01".
3737
/// - 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
38+
/// - isLong: Indicates the side of the position. `true` indicates "long". `false` indicates "short". The side is taken into consideration
3939
/// when performing trailing stop logic.
40-
/// - ticker: E.g.: BTCUSDT
41-
/// - tickerSize: E.g.: "1", "0.05", "0.00001"
4240
/// - offset: How far the **"target price"** of the stop order will be from the `currentPrice`. For example,
4341
/// suppose the `profitPercentage` is `1.0%` and the `offset` is `0.75%`. The stop order to be placed will be `0.25%`
4442
/// of the current price (`1.0%` - `0.75%`). Using the same `offset`, if the `profitPercentage` is now `2.0%`, the stop order
4543
/// will be placed at `1.25%` of the current price (`2.0%` - `0.75%`).
4644
/// - profitPercentage: The percentage of the profit at this point, e.g.: "1.5", "0.67".
45+
/// - ticker: E.g.: BTCUSDT
46+
/// - tickerSize: E.g.: "1", "0.05", "0.00001"
4747
public init(clean: Bool,
4848
contractSymbol: String,
4949
currentPrice: Double,
5050
entryPrice: Double,
5151
exchange: SwiftTraderExchange,
5252
isLong: Bool,
53-
ticker: String,
54-
tickerSize: String,
5553
offset: Double,
56-
profitPercentage: Double
57-
) {
54+
profitPercentage: Double,
55+
ticker: String,
56+
tickerSize: String) {
5857
self.clean = clean
5958
self.contractSymbol = contractSymbol
6059
self.currentPrice = currentPrice
6160
self.entryPrice = entryPrice
6261
self.exchange = exchange
6362
self.isLong = isLong
64-
self.ticker = ticker
65-
self.tickerSize = tickerSize
6663
self.offset = offset
6764
self.profitPercentage = profitPercentage
65+
self.ticker = ticker
66+
self.tickerSize = tickerSize
6867
}
6968
}

0 commit comments

Comments
 (0)