-
Notifications
You must be signed in to change notification settings - Fork 0
/
DexTrades.swift
94 lines (83 loc) · 1.96 KB
/
DexTrades.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// Transactions.swift
// PoocoinV2
//
// Created by Pozdnyshev Maksim on 6/28/21.
//
import Foundation
struct TransactionsRoot: Codable {
var dexTrades: [DexTrade]?
}
struct DexTrade: Codable {
let trades: Int?
var maximumPrice: Double?
let tradeAmount: Double?
var quotePrice: Double?
var minimumPrice: Double?
let baseCurrency: Currency?
let sellCurrency: Currency?
let quoteCurrency: Currency?
let buyCurrency: Currency?
var openPrice: String?
var closePrice: String?
let timeInterval: TimeIntervalModel?
let count: Int?
let sellAmount: Double?
let buyAmount: Double?
let block: Block?
let gasValue: Double?
let exchange: Exchange?
let transaction: TransactionEth?
let smartContract: SmartContract?
let date: TokenDate?
// let date: TokenDate?
enum CodingKeys: String, CodingKey {
case trades
case maximumPrice = "maximum_price"
case minimumPrice = "minimum_price"
case tradeAmount
case quotePrice
case baseCurrency
case quoteCurrency
case timeInterval
case count
case openPrice = "open_price"
case closePrice = "close_price"
case sellAmount
case buyAmount
case buyCurrency
case sellCurrency
case gasValue
case exchange
case block
case transaction
case smartContract
case date
}
var lowestPrice: Double {
return minimumPrice ?? 0
}
var highestPrice: Double {
return maximumPrice ?? 0
}
}
struct TokenDate: Codable {
let date: String?
}
struct SmartContract: Codable {
let currency: Currency?
let address: Receiver?
}
struct Exchange: Codable {
let fullName: String?
}
struct Currency: Codable {
let symbol: String?
let address: String?
let name: String?
let decimals: Int?
}
struct TimeIntervalModel: Codable {
let minute: String?
let second: String?
}