Skip to content

Commit c812487

Browse files
author
Fernando Fernandes
committed
Add the contract symbol
1 parent b902a4a commit c812487

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Sources/SwiftTrader/Model/SwiftTraderOrderInput.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public struct SwiftTraderOrderInput {
1414

1515
public let exchange: SwiftTraderExchange
1616
public let ticker: String
17+
public let contractSymbol: String
1718
public let entryPrice: Double
1819
public let currentPrice: Double
1920
public let profitPercentage: Double
@@ -23,12 +24,14 @@ public struct SwiftTraderOrderInput {
2324

2425
public init(exchange: SwiftTraderExchange,
2526
ticker: String,
27+
contractSymbol: String,
2628
entryPrice: Double,
2729
currentPrice: Double,
2830
profitPercentage: Double,
2931
offset: Double) {
3032
self.exchange = exchange
3133
self.ticker = ticker
34+
self.contractSymbol = contractSymbol
3235
self.entryPrice = entryPrice
3336
self.currentPrice = currentPrice
3437
self.profitPercentage = profitPercentage

Sources/SwiftTrader/SwiftTrader+Offset.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ public extension SwiftTrader {
1818
let targetPercentage: Double = (input.profitPercentage / 100) - (input.offset / 100)
1919
let priceIncrement: Double = input.entryPrice * targetPercentage
2020

21+
#warning("TODO: round up?")
2122
// Why Int? From a Kucoin response: "The parameter shall be a multiple of 1."
2223
let targetPrice = Int(input.entryPrice + priceIncrement)
2324
let targetPriceString = String(targetPrice)
2425

2526
return KucoinOrderParameters(
26-
symbol: input.ticker,
27+
symbol: input.contractSymbol,
2728
side: .sell,
2829
type: .limit,
2930
stop: .down,

0 commit comments

Comments
 (0)