1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of Poloniex PHP SDK. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @copyright 2017-2018 Chasovskih Grisha <[email protected]> |
9
|
|
|
* @license https://github.com/signulls/poloniex-php-sdk/blob/master/LICENSE MIT |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Poloniex\Response\TradingApi; |
13
|
|
|
|
14
|
|
|
use Poloniex\Response\{AbstractResponse, Traits\DateTrait}; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class TradeHistory |
18
|
|
|
* |
19
|
|
|
* @author Grisha Chasovskih <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class TradeHistory extends AbstractResponse |
22
|
|
|
{ |
23
|
|
|
use DateTrait; |
24
|
|
|
|
25
|
|
|
public const CATEGORY_EXCHANGE = 'exchange'; |
26
|
|
|
public const CATEGORY_SETTLEMENT = 'settlement'; |
27
|
|
|
public const CATEGORY_MARGIN_TRADE = 'marginTrade'; |
28
|
|
|
|
29
|
|
|
public const CATEGORIES = [ |
30
|
|
|
self::CATEGORY_EXCHANGE, |
31
|
|
|
self::CATEGORY_SETTLEMENT, |
32
|
|
|
self::CATEGORY_MARGIN_TRADE, |
33
|
|
|
]; |
34
|
|
|
|
35
|
|
|
public const TYPE_SELL = 'sell'; |
36
|
|
|
public const TYPE_BUY = 'buy'; |
37
|
|
|
|
38
|
|
|
public const TYPES = [ |
39
|
|
|
self::TYPE_SELL, |
40
|
|
|
self::TYPE_BUY, |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Example: 264105095 |
45
|
|
|
* |
46
|
|
|
* @var int |
47
|
|
|
*/ |
48
|
|
|
public $globalTradeId; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Example: 2376559 |
52
|
|
|
* |
53
|
|
|
* @var int |
54
|
|
|
*/ |
55
|
|
|
public $tradeId; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Example: "0.23500000" |
59
|
|
|
* |
60
|
|
|
* @var float |
61
|
|
|
*/ |
62
|
|
|
public $rate; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Example: "46.81623294" |
66
|
|
|
* |
67
|
|
|
* @var float |
68
|
|
|
*/ |
69
|
|
|
public $amount; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Example: "11.00181474" |
73
|
|
|
* |
74
|
|
|
* @var float |
75
|
|
|
*/ |
76
|
|
|
public $total; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Example: "0.00150000" |
80
|
|
|
* |
81
|
|
|
* @var float |
82
|
|
|
*/ |
83
|
|
|
public $fee; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Example: "64218702142" |
87
|
|
|
* |
88
|
|
|
* @var int |
89
|
|
|
*/ |
90
|
|
|
public $orderNumber; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Example: "sell" or "buy" |
94
|
|
|
* |
95
|
|
|
* @var string |
96
|
|
|
*/ |
97
|
|
|
public $type; |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Example: "exchange" |
101
|
|
|
* |
102
|
|
|
* @var string |
103
|
|
|
*/ |
104
|
|
|
public $category; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @internal |
108
|
|
|
* @param int $globalTradeId |
109
|
|
|
*/ |
110
|
|
|
public function setGlobalTradeId(int $globalTradeId): void |
111
|
|
|
{ |
112
|
|
|
$this->globalTradeId = $globalTradeId; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @internal |
117
|
|
|
* @param int $tradeId |
118
|
|
|
*/ |
119
|
|
|
public function setTradeId(int $tradeId): void |
120
|
|
|
{ |
121
|
|
|
$this->tradeId = $tradeId; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @internal |
126
|
|
|
* @param float $rate |
127
|
|
|
*/ |
128
|
|
|
public function setRate(float $rate): void |
129
|
|
|
{ |
130
|
|
|
$this->rate = $rate; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @internal |
135
|
|
|
* @param float $amount |
136
|
|
|
*/ |
137
|
|
|
public function setAmount(float $amount): void |
138
|
|
|
{ |
139
|
|
|
$this->amount = $amount; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @internal |
144
|
|
|
* @param float $total |
145
|
|
|
*/ |
146
|
|
|
public function setTotal(float $total): void |
147
|
|
|
{ |
148
|
|
|
$this->total = $total; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @internal |
153
|
|
|
* @param float $fee |
154
|
|
|
*/ |
155
|
|
|
public function setFee(float $fee): void |
156
|
|
|
{ |
157
|
|
|
$this->fee = $fee; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @internal |
162
|
|
|
* @param int $orderNumber |
163
|
|
|
*/ |
164
|
|
|
public function setOrderNumber(int $orderNumber): void |
165
|
|
|
{ |
166
|
|
|
$this->orderNumber = $orderNumber; |
167
|
|
|
} |
168
|
|
|
} |