Skip to content

Commit fb48637

Browse files
author
Fernando Fernandes
committed
Fix null price in production issue
1 parent f4e70e5 commit fb48637

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/SwiftTrader/Model/Kucoin/Order/KucoinFuturesOrderList.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public struct KucoinFuturesOrder: Codable {
3636
public let type: KucoinOrderType
3737
public let side: KucoinOrderSide
3838

39-
/// The price of one asset's unit.
40-
public let price: String
39+
/// The price of one asset's unit. Although this is returned in Sandbox,
40+
/// it returns `null` in production. Therefore it's an optional.
41+
public let price: String?
4142

4243
/// How much assets were bought.
4344
public let size: Int
@@ -112,7 +113,7 @@ public struct KucoinFuturesOrder: Codable {
112113
self.symbol = try container.decode(String.self, forKey: .symbol)
113114
self.type = try container.decode(KucoinOrderType.self, forKey: .type)
114115
self.side = try container.decode(KucoinOrderSide.self, forKey: .side)
115-
self.price = try container.decode(String.self, forKey: .price)
116+
self.price = try container.decodeIfPresent(String.self, forKey: .price)
116117
self.size = try container.decode(Int.self, forKey: .size)
117118
self.value = try container.decode(String.self, forKey: .value)
118119
self.filledValue = try container.decode(String.self, forKey: .filledValue)

0 commit comments

Comments
 (0)