max_exchange_api 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/README.md +981 -372
- data/lib/max_exchange_api/helper.rb +7 -2
- data/lib/max_exchange_api/private_api.rb +3 -1
- data/lib/max_exchange_api/private_v2/account_api.rb +15 -0
- data/lib/max_exchange_api/private_v2/deposit_api.rb +75 -0
- data/lib/max_exchange_api/private_v2/internal_transfer_api.rb +26 -0
- data/lib/max_exchange_api/private_v2/order_api.rb +55 -0
- data/lib/max_exchange_api/private_v2/reward_api.rb +40 -0
- data/lib/max_exchange_api/private_v2/trade_api.rb +28 -0
- data/lib/max_exchange_api/private_v2/user_api.rb +19 -0
- data/lib/max_exchange_api/private_v2/withdraw_api.rb +42 -0
- data/lib/max_exchange_api/private_v2_api.rb +16 -214
- data/lib/max_exchange_api/private_v3/account_api.rb +15 -0
- data/lib/max_exchange_api/private_v3/convert_api.rb +29 -0
- data/lib/max_exchange_api/private_v3/deposit_api.rb +26 -0
- data/lib/max_exchange_api/private_v3/internal_transfer_api.rb +19 -0
- data/lib/max_exchange_api/private_v3/m_wallet_api.rb +76 -0
- data/lib/max_exchange_api/private_v3/order_api.rb +82 -0
- data/lib/max_exchange_api/private_v3/reward_api.rb +19 -0
- data/lib/max_exchange_api/private_v3/sub_account_api.rb +31 -0
- data/lib/max_exchange_api/private_v3/trade_api.rb +27 -0
- data/lib/max_exchange_api/private_v3/user_api.rb +11 -0
- data/lib/max_exchange_api/private_v3/withdraw_api.rb +35 -0
- data/lib/max_exchange_api/private_v3_api.rb +23 -0
- data/lib/max_exchange_api/public_api.rb +13 -14
- data/lib/max_exchange_api/public_v2_api.rb +65 -66
- data/lib/max_exchange_api/public_v3_api.rb +56 -0
- data/lib/max_exchange_api/version.rb +1 -1
- metadata +22 -3
data/README.md
CHANGED
|
@@ -14,13 +14,142 @@ A ruby implementation of MAX exchange API
|
|
|
14
14
|
## Documentations
|
|
15
15
|
|
|
16
16
|
* [REST API Introduction](https://max.maicoin.com/documents/api_v2)
|
|
17
|
-
* [
|
|
17
|
+
* [MAX V3 RESTful API List](https://max-api.maicoin.com/doc/v3.html)
|
|
18
18
|
* [WebSocket API Documentation](https://maicoin.github.io/max-websocket-docs/)
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
## Supports
|
|
22
22
|
- Ruby 2.2 ~ 2.7, 3.0 ~ 3.3
|
|
23
23
|
|
|
24
|
+
## Table of contents
|
|
25
|
+
|
|
26
|
+
<!-- TOC -->
|
|
27
|
+
* [MAX Exchange API Ruby SDK](#max-exchange-api-ruby-sdk)
|
|
28
|
+
* [Documentations](#documentations)
|
|
29
|
+
* [Supports](#supports)
|
|
30
|
+
* [Table of contents](#table-of-contents)
|
|
31
|
+
* [Installation](#installation)
|
|
32
|
+
* [Usage](#usage)
|
|
33
|
+
* [Configuration](#configuration)
|
|
34
|
+
* [Set timeout time](#set-timeout-time)
|
|
35
|
+
* [Logging](#logging)
|
|
36
|
+
* [Switch Sub-Account](#switch-sub-account)
|
|
37
|
+
* [Public V3 Api Examples](#public-v3-api-examples)
|
|
38
|
+
* [GET /api/v3/wallet/m/index_prices](#get-apiv3walletmindex_prices)
|
|
39
|
+
* [GET /api/v3/wallet/m/historical_index_prices](#get-apiv3walletmhistorical_index_prices)
|
|
40
|
+
* [GET /api/v3/wallet/m/limits](#get-apiv3walletmlimits)
|
|
41
|
+
* [GET /api/v3/wallet/m/interest_rates](#get-apiv3walletminterest_rates)
|
|
42
|
+
* [GET /api/v3/markets](#get-apiv3markets)
|
|
43
|
+
* [GET /api/v3/currencies](#get-apiv3currencies)
|
|
44
|
+
* [GET /api/v3/timestamp](#get-apiv3timestamp)
|
|
45
|
+
* [GET /api/v3/k](#get-apiv3k)
|
|
46
|
+
* [GET /api/v3/depth](#get-apiv3depth)
|
|
47
|
+
* [GET /api/v3/trades](#get-apiv3trades)
|
|
48
|
+
* [GET /api/v3/tickers](#get-apiv3tickers)
|
|
49
|
+
* [GET /api/v3/ticker](#get-apiv3ticker)
|
|
50
|
+
* [Private V3 Api Examples](#private-v3-api-examples)
|
|
51
|
+
* [User](#user)
|
|
52
|
+
* [GET /api/v3/info](#get-apiv3info)
|
|
53
|
+
* [Account](#account)
|
|
54
|
+
* [GET /api/v3/wallet/{wallet_type}/accounts](#get-apiv3walletwallet_typeaccounts)
|
|
55
|
+
* [M-Wallet](#m-wallet)
|
|
56
|
+
* [GET /api/v3/wallet/m/ad_ratio](#get-apiv3walletmad_ratio)
|
|
57
|
+
* [POST /api/v3/wallet/m/loan](#post-apiv3walletmloan)
|
|
58
|
+
* [POST /api/v3/wallet/m/repayment](#post-apiv3walletmrepayment)
|
|
59
|
+
* [GET /api/v3/wallet/m/loans](#get-apiv3walletmloans)
|
|
60
|
+
* [GET /api/v3/wallet/m/repayments](#get-apiv3walletmrepayments)
|
|
61
|
+
* [GET /api/v3/wallet/m/liquidations](#get-apiv3walletmliquidations)
|
|
62
|
+
* [GET /api/v3/wallet/m/liquidation](#get-apiv3walletmliquidation)
|
|
63
|
+
* [GET /api/v3/wallet/m/interests](#get-apiv3walletminterests)
|
|
64
|
+
* [Convert](#convert)
|
|
65
|
+
* [GET /api/v3/converts](#get-apiv3converts)
|
|
66
|
+
* [GET /api/v3/convert](#get-apiv3convert)
|
|
67
|
+
* [POST /api/v3/convert](#post-apiv3convert)
|
|
68
|
+
* [Order](#order)
|
|
69
|
+
* [GET /api/v3/wallet/{wallet_type}/orders/open](#get-apiv3walletwallet_typeordersopen)
|
|
70
|
+
* [GET /api/v3/wallet/{wallet_type}/orders/closed](#get-apiv3walletwallet_typeordersclosed)
|
|
71
|
+
* [GET /api/v3/wallet/{wallet_type}/orders/history](#get-apiv3walletwallet_typeordershistory)
|
|
72
|
+
* [POST /api/v3/wallet/{wallet_type}/order](#post-apiv3walletwallet_typeorder)
|
|
73
|
+
* [GET /api/v3/order](#get-apiv3order)
|
|
74
|
+
* [DELETE /api/v3/wallet/{wallet_type}/order](#delete-apiv3walletwallet_typeorder)
|
|
75
|
+
* [DELETE /api/v3/order](#delete-apiv3order)
|
|
76
|
+
* [Trade](#trade)
|
|
77
|
+
* [GET /api/v3/order/trades](#get-apiv3ordertrades)
|
|
78
|
+
* [GET /api/v3/wallet/{path_wallet_type}/trades](#get-apiv3walletpath_wallet_typetrades)
|
|
79
|
+
* [Deposit](#deposit)
|
|
80
|
+
* [GET /api/v3/deposit_address](#get-apiv3deposit_address)
|
|
81
|
+
* [GET /api/v3/deposits](#get-apiv3deposits)
|
|
82
|
+
* [GET /api/v3/deposit](#get-apiv3deposit)
|
|
83
|
+
* [Withdraw](#withdraw)
|
|
84
|
+
* [GET /api/v3/withdraw_addresses](#get-apiv3withdraw_addresses)
|
|
85
|
+
* [GET /api/v3/withdrawals](#get-apiv3withdrawals)
|
|
86
|
+
* [GET /api/v3/withdrawal](#get-apiv3withdrawal)
|
|
87
|
+
* [POST /api/v3/withdrawal](#post-apiv3withdrawal)
|
|
88
|
+
* [POST /api/v3/withdrawal/twd](#post-apiv3withdrawaltwd)
|
|
89
|
+
* [Internal Transfer](#internal-transfer)
|
|
90
|
+
* [GET /api/v3/internal_transfers](#get-apiv3internal_transfers)
|
|
91
|
+
* [Reward](#reward)
|
|
92
|
+
* [GET /api/v3/rewards](#get-apiv3rewards)
|
|
93
|
+
* [SubAccount](#subaccount)
|
|
94
|
+
* [GET /api/v3/sub_accounts](#get-apiv3sub_accounts)
|
|
95
|
+
* [GET /api/v3/sub_account](#get-apiv3sub_account)
|
|
96
|
+
* [POST /api/v3/sub_accounts](#post-apiv3sub_accounts)
|
|
97
|
+
* [PUT /api/v3/sub_account](#put-apiv3sub_account)
|
|
98
|
+
* [DELETE /api/v3/sub_account](#delete-apiv3sub_account)
|
|
99
|
+
* [POST /api/v3/sub_account/transfer](#post-apiv3sub_accounttransfer)
|
|
100
|
+
* [Public V2 Api Examples](#public-v2-api-examples)
|
|
101
|
+
* [GET /api/v2/vip_levels](#get-apiv2vip_levels)
|
|
102
|
+
* [GET /api/v2/vip_levels/{level}](#get-apiv2vip_levelslevel)
|
|
103
|
+
* [GET /api/v2/currencies](#get-apiv2currencies)
|
|
104
|
+
* [GET /api/v2/k](#get-apiv2k)
|
|
105
|
+
* [GET /api/v2/depth](#get-apiv2depth)
|
|
106
|
+
* [GET /api/v2/trades](#get-apiv2trades)
|
|
107
|
+
* [GET /api/v2/markets](#get-apiv2markets)
|
|
108
|
+
* [GET /api/v2/summary](#get-apiv2summary)
|
|
109
|
+
* [GET /api/v2/tickers/{path_market}](#get-apiv2tickerspath_market)
|
|
110
|
+
* [GET /api/v2/tickers](#get-apiv2tickers)
|
|
111
|
+
* [GET /api/v2/timestamp](#get-apiv2timestamp)
|
|
112
|
+
* [Private V2 Api Examples](#private-v2-api-examples)
|
|
113
|
+
* [User](#user-1)
|
|
114
|
+
* [GET /api/v2/members/profile](#get-apiv2membersprofile)
|
|
115
|
+
* [GET /api/v2/members/me](#get-apiv2membersme)
|
|
116
|
+
* [GET /api/v2/members/vip_level](#get-apiv2membersvip_level)
|
|
117
|
+
* [Account](#account-1)
|
|
118
|
+
* [GET /api/v2/members/accounts](#get-apiv2membersaccounts)
|
|
119
|
+
* [GET /api/v2/members/accounts/{path_currency}](#get-apiv2membersaccountspath_currency)
|
|
120
|
+
* [Order](#order-1)
|
|
121
|
+
* [GET /api/v2/orders](#get-apiv2orders)
|
|
122
|
+
* [GET /api/v2/order](#get-apiv2order)
|
|
123
|
+
* [POST /api/v2/orders/clear](#post-apiv2ordersclear)
|
|
124
|
+
* [POST /api/v2/order/delete](#post-apiv2orderdelete)
|
|
125
|
+
* [POST /api/v2/orders](#post-apiv2orders)
|
|
126
|
+
* [POST /api/v2/orders/multi/onebyone](#post-apiv2ordersmultionebyone)
|
|
127
|
+
* [Trade](#trade-1)
|
|
128
|
+
* [GET /api/v2/trades/my/of_order](#get-apiv2tradesmyof_order)
|
|
129
|
+
* [GET /api/v2/trades/my](#get-apiv2tradesmy)
|
|
130
|
+
* [Deposit](#deposit-1)
|
|
131
|
+
* [GET /api/v2/deposits](#get-apiv2deposits)
|
|
132
|
+
* [GET /api/v2/deposit](#get-apiv2deposit)
|
|
133
|
+
* [GET /api/v2/deposit_addresses](#get-apiv2deposit_addresses)
|
|
134
|
+
* [POST /api/v2/deposit_addresses](#post-apiv2deposit_addresses)
|
|
135
|
+
* [Withdrawal](#withdrawal)
|
|
136
|
+
* [GET /api/v2/withdrawals](#get-apiv2withdrawals)
|
|
137
|
+
* [GET /api/v2/withdrawal](#get-apiv2withdrawal)
|
|
138
|
+
* [POST /api/v2/withdrawal](#post-apiv2withdrawal)
|
|
139
|
+
* [GET /api/v2/withdraw_addresses](#get-apiv2withdraw_addresses)
|
|
140
|
+
* [Internal Transfer](#internal-transfer-1)
|
|
141
|
+
* [GET /api/v2/internal_transfers](#get-apiv2internal_transfers)
|
|
142
|
+
* [GET /api/v2/internal_transfer](#get-apiv2internal_transfer)
|
|
143
|
+
* [Reward](#reward-1)
|
|
144
|
+
* [GET /api/v2/rewards](#get-apiv2rewards)
|
|
145
|
+
* [GET /api/v2/rewards/{path_reward_type}](#get-apiv2rewardspath_reward_type)
|
|
146
|
+
* [GET /api/v2/max_rewards/yesterday](#get-apiv2max_rewardsyesterday)
|
|
147
|
+
* [GET /api/v2/yields](#get-apiv2yields)
|
|
148
|
+
* [Development](#development)
|
|
149
|
+
* [Contributing](#contributing)
|
|
150
|
+
* [License](#license)
|
|
151
|
+
<!-- TOC -->
|
|
152
|
+
|
|
24
153
|
## Installation
|
|
25
154
|
|
|
26
155
|
```ruby
|
|
@@ -35,6 +164,18 @@ Or install it yourself as:
|
|
|
35
164
|
|
|
36
165
|
$ gem install max_exchange_api
|
|
37
166
|
|
|
167
|
+
## Usage
|
|
168
|
+
|
|
169
|
+
```rb
|
|
170
|
+
@public_v3_api = MaxExchangeApi::PublicV3Api.new
|
|
171
|
+
@public_v3_api.depth('usdttwd')
|
|
172
|
+
|
|
173
|
+
access_key, secret_key = File.read('secret').split(',')
|
|
174
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
175
|
+
@private_v3_api.create_order!('usdttwd', 'sell', 1000, price: 31.35)
|
|
176
|
+
@private_v3_api.create_order!('usdttwd', 'buy', 1000, price: 31.15)
|
|
177
|
+
```
|
|
178
|
+
|
|
38
179
|
## Configuration
|
|
39
180
|
|
|
40
181
|
### Set timeout time
|
|
@@ -44,8 +185,8 @@ Or install it yourself as:
|
|
|
44
185
|
MaxExchangeApi.default_config.timeout = 3 # seconds
|
|
45
186
|
|
|
46
187
|
# Create an api instance with custom timeout time
|
|
47
|
-
api = MaxExchangeApi::
|
|
48
|
-
api = MaxExchangeApi::
|
|
188
|
+
api = MaxExchangeApi::PublicV3Api.new(config: { timeout: 12 })
|
|
189
|
+
api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key, config: { timeout: 12 })
|
|
49
190
|
```
|
|
50
191
|
|
|
51
192
|
### Logging
|
|
@@ -60,610 +201,854 @@ MaxExchangeApi.default_config.logger = Logger.new(STDOUT)
|
|
|
60
201
|
MaxExchangeApi.default_config.logger = Logger.new('log/api.log')
|
|
61
202
|
|
|
62
203
|
# Create an api instance with custom logger
|
|
63
|
-
api = MaxExchangeApi::
|
|
64
|
-
api = MaxExchangeApi::
|
|
204
|
+
api = MaxExchangeApi::PublicV3Api.new(config: { logger: Logger.new(STDOUT) })
|
|
205
|
+
api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key, config: { logger: Logger.new(STDOUT) })
|
|
65
206
|
```
|
|
66
207
|
|
|
67
|
-
|
|
208
|
+
### Switch Sub-Account
|
|
68
209
|
|
|
69
|
-
|
|
210
|
+
```rb
|
|
211
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
212
|
+
|
|
213
|
+
# Switch to a specific sub-account (e.g., 's1-a7f20f')
|
|
214
|
+
@private_v3_api.current_sub_account_sn = 's1-a7f20f'
|
|
215
|
+
|
|
216
|
+
# Use the default sub-account (determined by the API token owner)
|
|
217
|
+
@private_v3_api.current_sub_account_sn = nil
|
|
218
|
+
|
|
219
|
+
# Switch to the main account
|
|
220
|
+
@private_v3_api.current_sub_account_sn = 'main'
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Public V3 Api Examples
|
|
70
224
|
|
|
71
225
|
```rb
|
|
72
|
-
@
|
|
73
|
-
@api_v3 = MaxExchangeApi::PublicV3Api.new
|
|
226
|
+
@public_v3_api = MaxExchangeApi::PublicV3Api.new
|
|
74
227
|
```
|
|
75
228
|
|
|
76
|
-
#### [GET /api/
|
|
229
|
+
#### [GET /api/v3/wallet/m/index_prices](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMIndexPrices)
|
|
77
230
|
|
|
78
|
-
> Get
|
|
231
|
+
> Get latest index prices of m-wallet
|
|
79
232
|
|
|
80
|
-
<details>
|
|
81
|
-
<summary>Show code</summary>
|
|
82
|
-
|
|
83
233
|
```rb
|
|
84
|
-
@
|
|
234
|
+
@public_v3_api.index_prices
|
|
85
235
|
```
|
|
86
|
-
</details>
|
|
87
236
|
|
|
88
|
-
#### [GET /api/
|
|
237
|
+
#### [GET /api/v3/wallet/m/historical_index_prices](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMHistoricalIndexPrices)
|
|
89
238
|
|
|
90
|
-
> Get
|
|
239
|
+
> Get latest historical index prices
|
|
91
240
|
|
|
92
|
-
<details>
|
|
93
|
-
<summary>Show code</summary>
|
|
94
|
-
|
|
95
241
|
```rb
|
|
96
|
-
@
|
|
242
|
+
@public_v3_api.index_prices_histories
|
|
97
243
|
```
|
|
98
|
-
</details>
|
|
99
244
|
|
|
100
|
-
#### [GET /api/
|
|
245
|
+
#### [GET /api/v3/wallet/m/limits](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMLimits)
|
|
101
246
|
|
|
102
|
-
> Get
|
|
247
|
+
> Get total available loan amount
|
|
248
|
+
|
|
249
|
+
```rb
|
|
250
|
+
@public_v3_api.available_loan_amount
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### [GET /api/v3/wallet/m/interest_rates](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMInterestRates)
|
|
254
|
+
|
|
255
|
+
> Get latest interest rates of m-wallet
|
|
256
|
+
|
|
257
|
+
```rb
|
|
258
|
+
@public_v3_api.loan_interest_rates
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### [GET /api/v3/markets](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Markets)
|
|
262
|
+
|
|
263
|
+
> Get all available markets.
|
|
264
|
+
|
|
265
|
+
```rb
|
|
266
|
+
@public_v3_api.markets
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
#### [GET /api/v3/currencies](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Currencies)
|
|
270
|
+
|
|
271
|
+
> Get all available currencies
|
|
272
|
+
|
|
273
|
+
```rb
|
|
274
|
+
@public_v3_api.currencies
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### [GET /api/v3/timestamp](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Timestamp)
|
|
278
|
+
|
|
279
|
+
> Get server current time, in seconds since Unix epoch
|
|
103
280
|
|
|
104
|
-
<details>
|
|
105
|
-
<summary>Show code</summary>
|
|
106
|
-
|
|
107
281
|
```rb
|
|
108
|
-
@
|
|
282
|
+
@public_v3_api.timestamp
|
|
109
283
|
```
|
|
110
|
-
</details>
|
|
111
284
|
|
|
112
|
-
#### [GET /api/
|
|
285
|
+
#### [GET /api/v3/k](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3K)
|
|
113
286
|
|
|
114
287
|
> Get OHLC(k line) of a specific market.
|
|
115
288
|
|
|
116
|
-
<details>
|
|
117
|
-
<summary>Show code</summary>
|
|
118
|
-
|
|
119
289
|
```rb
|
|
120
290
|
# use default parameters
|
|
121
|
-
@
|
|
291
|
+
@private_v3_api.k('btctwd')
|
|
122
292
|
|
|
123
293
|
# provide all possible parameters
|
|
124
|
-
@
|
|
294
|
+
@private_v3_api.k('btctwd', limit: 30, period: 1, timestamp: 1624705402)
|
|
125
295
|
```
|
|
126
|
-
</details>
|
|
127
296
|
|
|
128
|
-
#### [GET /api/
|
|
297
|
+
#### [GET /api/v3/depth](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Depth)
|
|
129
298
|
|
|
130
299
|
> Get depth of a specified market.
|
|
131
300
|
|
|
132
|
-
<details>
|
|
133
|
-
<summary>Show code</summary>
|
|
134
|
-
|
|
135
301
|
```rb
|
|
136
302
|
# use default parameters
|
|
137
|
-
@
|
|
303
|
+
@private_v3_api.depth('maxtwd')
|
|
138
304
|
|
|
139
305
|
# provide all possible parameters
|
|
140
|
-
@
|
|
306
|
+
@private_v3_api.depth('maxtwd', limit: 10, sort_by_price: true)
|
|
141
307
|
```
|
|
142
|
-
</details>
|
|
143
308
|
|
|
144
|
-
#### [GET /api/
|
|
309
|
+
#### [GET /api/v3/trades](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Trades)
|
|
145
310
|
|
|
146
311
|
> Get recent trades on market, sorted in reverse creation order.
|
|
147
312
|
|
|
148
|
-
<details>
|
|
149
|
-
<summary>Show code</summary>
|
|
150
|
-
|
|
151
313
|
```rb
|
|
152
314
|
# use default parameters
|
|
153
|
-
@
|
|
315
|
+
@private_v3_api.trades('btctwd')
|
|
154
316
|
|
|
155
317
|
# provide all possible parameters
|
|
156
|
-
@
|
|
318
|
+
@private_v3_api.trades(
|
|
157
319
|
'maxtwd',
|
|
158
320
|
timestamp: 1624705402,
|
|
159
|
-
from: 68444,
|
|
160
|
-
to: 69444,
|
|
161
|
-
order_by: 'asc',
|
|
162
|
-
pagination: true,
|
|
163
|
-
page: 3,
|
|
164
321
|
limit: 15,
|
|
165
|
-
offset: 5,
|
|
166
322
|
)
|
|
167
323
|
```
|
|
168
|
-
</details>
|
|
169
324
|
|
|
170
|
-
#### [GET /api/
|
|
325
|
+
#### [GET /api/v3/tickers](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Tickers)
|
|
171
326
|
|
|
172
|
-
> Get all
|
|
327
|
+
> Get ticker of all markets.
|
|
173
328
|
|
|
174
|
-
<details>
|
|
175
|
-
<summary>Show code</summary>
|
|
176
|
-
|
|
177
329
|
```rb
|
|
178
|
-
@
|
|
330
|
+
@private_v3_api.tickers
|
|
179
331
|
```
|
|
180
|
-
</details>
|
|
181
332
|
|
|
182
|
-
#### [GET /api/
|
|
333
|
+
#### [GET /api/v3/ticker](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Ticker)
|
|
183
334
|
|
|
184
|
-
>
|
|
335
|
+
> Get ticker of specific market.
|
|
185
336
|
|
|
186
|
-
<details>
|
|
187
|
-
<summary>Show code</summary>
|
|
188
|
-
|
|
189
337
|
```rb
|
|
190
|
-
@
|
|
338
|
+
@private_v3_api.ticker('btctwd')
|
|
191
339
|
```
|
|
192
|
-
</details>
|
|
193
340
|
|
|
194
|
-
|
|
341
|
+
---
|
|
195
342
|
|
|
196
|
-
|
|
343
|
+
## Private V3 Api Examples
|
|
197
344
|
|
|
198
|
-
<details>
|
|
199
|
-
<summary>Show code</summary>
|
|
200
|
-
|
|
201
345
|
```rb
|
|
202
|
-
|
|
346
|
+
access_key = 'YOUR_ACCESS_KEY'
|
|
347
|
+
secret_key = 'YOUR_SECRET_KEY'
|
|
348
|
+
|
|
349
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
203
350
|
```
|
|
204
|
-
</details>
|
|
205
351
|
|
|
206
|
-
|
|
352
|
+
### User
|
|
353
|
+
#### [GET /api/v3/info](https://max-api.maicoin.com/doc/v3.html#tag/User/operation/getApiV3Info)
|
|
207
354
|
|
|
208
|
-
> Get
|
|
355
|
+
> Get user information
|
|
209
356
|
|
|
210
|
-
<details>
|
|
211
|
-
<summary>Show code</summary>
|
|
212
|
-
|
|
213
357
|
```rb
|
|
214
|
-
@
|
|
358
|
+
@private_v3_api.member_info
|
|
215
359
|
```
|
|
216
|
-
</details>
|
|
217
360
|
|
|
218
|
-
|
|
361
|
+
### Account
|
|
362
|
+
#### [GET /api/v3/wallet/{wallet_type}/accounts](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletPathWalletTypeAccounts)
|
|
219
363
|
|
|
220
|
-
> Get
|
|
364
|
+
> Get your account balance with all supported currencies by different wallet type
|
|
221
365
|
|
|
222
|
-
<details>
|
|
223
|
-
<summary>Show code</summary>
|
|
224
|
-
|
|
225
366
|
```rb
|
|
226
|
-
@
|
|
367
|
+
@private_v3_api.accounts
|
|
368
|
+
|
|
369
|
+
# provide all possible parameters
|
|
370
|
+
@private_v3_api.accounts(wallet_type: 'm', currency: 'usdt')
|
|
227
371
|
```
|
|
228
|
-
</details>
|
|
229
372
|
|
|
230
|
-
|
|
373
|
+
### M-Wallet
|
|
374
|
+
#### [GET /api/v3/wallet/m/ad_ratio](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMAdRatio)
|
|
231
375
|
|
|
232
|
-
> Get
|
|
376
|
+
> Get the latest AD ratio of your m-wallet
|
|
233
377
|
|
|
234
|
-
<details>
|
|
235
|
-
<summary>Show code</summary>
|
|
236
|
-
|
|
237
378
|
```rb
|
|
238
|
-
@
|
|
379
|
+
@private_v3_api.m_wallet_ad_ratio
|
|
239
380
|
```
|
|
240
|
-
</details>
|
|
241
381
|
|
|
242
|
-
|
|
382
|
+
#### [POST /api/v3/wallet/m/loan](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/postApiV3WalletMLoan)
|
|
243
383
|
|
|
244
|
-
|
|
384
|
+
> Create a loan request for your m-wallet
|
|
245
385
|
|
|
246
386
|
```rb
|
|
247
|
-
|
|
248
|
-
secret_key = 'YOUR_SECRET_KEY'
|
|
249
|
-
|
|
250
|
-
@api_v2 = MaxExchangeApi::PrivateV2Api.new(access_key, secret_key)
|
|
251
|
-
@api_v3 = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
387
|
+
@private_v3_api.m_wallet_loan!('30000', 'usdt')
|
|
252
388
|
```
|
|
253
389
|
|
|
254
|
-
|
|
255
|
-
#### [GET /api/v2/trades/my/of_order](https://max.maicoin.com/documents/api_list#!/private/getApiV2TradesMyOfOrder)
|
|
256
|
-
|
|
257
|
-
> get your executed trades related to a order
|
|
390
|
+
#### [POST /api/v3/wallet/m/repayment](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/postApiV3WalletMRepayment)
|
|
258
391
|
|
|
259
|
-
|
|
260
|
-
<summary>Show code</summary>
|
|
392
|
+
> Make a repayment for your loan
|
|
261
393
|
|
|
262
394
|
```rb
|
|
263
|
-
|
|
264
|
-
@api_v2my_trades_of_order(123456)
|
|
265
|
-
|
|
266
|
-
# use user specified order id
|
|
267
|
-
@api_v2my_trades_of_order('MY_ORDER_123456', use_client_id: true)
|
|
395
|
+
@private_v3_api.m_wallet_repay!('30000', 'usdt')
|
|
268
396
|
```
|
|
269
|
-
</details>
|
|
270
397
|
|
|
271
|
-
#### [GET /api/
|
|
272
|
-
|
|
273
|
-
> get your executed trades, sorted in reverse creation order
|
|
398
|
+
#### [GET /api/v3/wallet/m/loans](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLoans)
|
|
274
399
|
|
|
275
|
-
|
|
276
|
-
<summary>Show code</summary>
|
|
400
|
+
> Get loan history of your m-wallet
|
|
277
401
|
|
|
278
402
|
```rb
|
|
279
|
-
|
|
280
|
-
@api_v2my_trades('btctwd')
|
|
403
|
+
@private_v3_api.m_wallet_loans('usdt')
|
|
281
404
|
|
|
282
405
|
# provide all possible parameters
|
|
283
|
-
@
|
|
284
|
-
'
|
|
406
|
+
@private_v3_api.m_wallet_loans(
|
|
407
|
+
'usdt',
|
|
285
408
|
timestamp: 1624705402,
|
|
286
|
-
from: 68444,
|
|
287
|
-
to: 69444,
|
|
288
409
|
order_by: 'asc',
|
|
289
|
-
pagination: true,
|
|
290
|
-
page: 3,
|
|
291
410
|
limit: 15,
|
|
292
|
-
offset: 5,
|
|
293
411
|
)
|
|
294
412
|
```
|
|
295
|
-
</details>
|
|
296
|
-
|
|
297
|
-
### Withdrawal
|
|
298
|
-
#### [GET /api/v2/withdrawals](https://max.maicoin.com/documents/api_list#!/private/getApiV2Withdrawals)
|
|
299
413
|
|
|
300
|
-
|
|
414
|
+
#### [GET /api/v3/wallet/m/repayments](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMRepayments)
|
|
301
415
|
|
|
302
|
-
|
|
303
|
-
<summary>Show code</summary>
|
|
416
|
+
> Get repayment history of your m-wallet
|
|
304
417
|
|
|
305
418
|
```rb
|
|
306
|
-
|
|
307
|
-
@api_v2withdrawals('max')
|
|
419
|
+
@private_v3_api.m_wallet_repayments('usdt')
|
|
308
420
|
|
|
309
421
|
# provide all possible parameters
|
|
310
|
-
@
|
|
311
|
-
'
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
to: 69444,
|
|
315
|
-
state: 'confirmed',
|
|
316
|
-
pagination: true,
|
|
317
|
-
page: 3,
|
|
422
|
+
@private_v3_api.m_wallet_repayments(
|
|
423
|
+
'usdt',
|
|
424
|
+
timestamp: 1624705402,
|
|
425
|
+
order_by: 'asc',
|
|
318
426
|
limit: 15,
|
|
319
|
-
offset: 5,
|
|
320
427
|
)
|
|
321
428
|
```
|
|
322
|
-
</details>
|
|
323
|
-
|
|
324
|
-
#### [GET /api/v2/withdrawal](https://max.maicoin.com/documents/api_list#!/private/getApiV2Withdrawal)
|
|
325
429
|
|
|
326
|
-
|
|
430
|
+
#### [GET /api/v3/wallet/m/liquidations](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLiquidations)
|
|
327
431
|
|
|
328
|
-
|
|
329
|
-
<summary>Show code</summary>
|
|
432
|
+
> Get liquidation history of your m-wallet
|
|
330
433
|
|
|
331
434
|
```rb
|
|
332
|
-
@
|
|
333
|
-
```
|
|
334
|
-
</details>
|
|
435
|
+
@private_v3_api.m_wallet_liquidations
|
|
335
436
|
|
|
336
|
-
|
|
437
|
+
# provide all possible parameters
|
|
438
|
+
@private_v3_api.m_wallet_liquidations(
|
|
439
|
+
timestamp: 1624705402,
|
|
440
|
+
order_by: 'asc',
|
|
441
|
+
limit: 15,
|
|
442
|
+
)
|
|
443
|
+
```
|
|
337
444
|
|
|
338
|
-
|
|
445
|
+
#### [GET /api/v3/wallet/m/liquidation](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLiquidation)
|
|
339
446
|
|
|
340
|
-
|
|
341
|
-
<summary>Show code</summary>
|
|
447
|
+
> Get detail of one specific liquidation history of your m-wallet
|
|
342
448
|
|
|
343
449
|
```rb
|
|
344
|
-
@
|
|
450
|
+
@private_v3_api.m_wallet_liquidation('210407080800050666')
|
|
345
451
|
```
|
|
346
|
-
</details>
|
|
347
|
-
|
|
348
|
-
### Profile
|
|
349
|
-
#### [GET /api/v2/members/profile](https://max.maicoin.com/documents/api_list#!/private/getApiV2MembersProfile)
|
|
350
452
|
|
|
351
|
-
|
|
453
|
+
#### [GET /api/v3/wallet/m/interests](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMInterests)
|
|
352
454
|
|
|
353
|
-
|
|
354
|
-
<summary>Show code</summary>
|
|
455
|
+
> Get interest history of your m-wallet
|
|
355
456
|
|
|
356
457
|
```rb
|
|
357
|
-
@
|
|
358
|
-
```
|
|
359
|
-
</details>
|
|
458
|
+
@private_v3_api.m_wallet_interests('usdt')
|
|
360
459
|
|
|
361
|
-
|
|
460
|
+
# provide all possible parameters
|
|
461
|
+
@private_v3_api.m_wallet_interests(
|
|
462
|
+
'usdt',
|
|
463
|
+
timestamp: 1624705402,
|
|
464
|
+
order_by: 'asc',
|
|
465
|
+
limit: 15,
|
|
466
|
+
)
|
|
467
|
+
```
|
|
362
468
|
|
|
363
|
-
|
|
469
|
+
### Convert
|
|
470
|
+
#### [GET /api/v3/converts](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/getApiV3Converts)
|
|
364
471
|
|
|
365
|
-
|
|
366
|
-
<summary>Show code</summary>
|
|
472
|
+
> Get convert orders history
|
|
367
473
|
|
|
368
474
|
```rb
|
|
369
|
-
@
|
|
370
|
-
```
|
|
371
|
-
</details>
|
|
475
|
+
@private_v3_api.convert_orders
|
|
372
476
|
|
|
373
|
-
|
|
477
|
+
# provide all possible parameters
|
|
478
|
+
@private_v3_api.convert_orders(
|
|
479
|
+
timestamp: 1624705402,
|
|
480
|
+
order_by: 'asc',
|
|
481
|
+
limit: 15,
|
|
482
|
+
)
|
|
483
|
+
```
|
|
374
484
|
|
|
375
|
-
|
|
485
|
+
#### [GET /api/v3/convert](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/getApiV3Convert)
|
|
376
486
|
|
|
377
|
-
|
|
378
|
-
<summary>Show code</summary>
|
|
487
|
+
> Get details of a specific convert order
|
|
379
488
|
|
|
380
489
|
```rb
|
|
381
|
-
@
|
|
490
|
+
@private_v3_api.convert_order('6322d9bd-736b-4f19-b862-829e75cae1ce')
|
|
382
491
|
```
|
|
383
|
-
</details>
|
|
384
|
-
|
|
385
|
-
### Account
|
|
386
|
-
#### [GET /api/v2/members/accounts](https://max.maicoin.com/documents/api_list#!/private/getApiV2MembersAccounts)
|
|
387
492
|
|
|
388
|
-
|
|
493
|
+
#### [POST /api/v3/convert](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/postApiV3Convert)
|
|
389
494
|
|
|
390
|
-
|
|
391
|
-
<summary>Show code</summary>
|
|
495
|
+
> Execute a convert (flash exchange) between two currencies
|
|
392
496
|
|
|
393
497
|
```rb
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
498
|
+
# Specify from amount
|
|
499
|
+
@private_v3_api.create_convert_order(
|
|
500
|
+
from: ['0.52', 'usdt'],
|
|
501
|
+
to: [nil, 'twd'],
|
|
502
|
+
)
|
|
397
503
|
|
|
398
|
-
|
|
504
|
+
# Specify to amount
|
|
505
|
+
@private_v3_api.create_convert_order(
|
|
506
|
+
from: [nil, 'usdt'],
|
|
507
|
+
to: ['16.58', 'twd'],
|
|
508
|
+
)
|
|
509
|
+
```
|
|
399
510
|
|
|
400
|
-
|
|
511
|
+
### Order
|
|
512
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/open](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersOpen)
|
|
401
513
|
|
|
402
|
-
|
|
403
|
-
<summary>Show code</summary>
|
|
514
|
+
> Get open orders.
|
|
404
515
|
|
|
405
516
|
```rb
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
</details>
|
|
517
|
+
# use default parameters
|
|
518
|
+
@private_v3_api.open_orders('maxtwd')
|
|
409
519
|
|
|
410
|
-
|
|
411
|
-
|
|
520
|
+
# provide all possible parameters
|
|
521
|
+
@private_v3_api.open_orders(
|
|
522
|
+
'maxtwd',
|
|
523
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
524
|
+
timestamp: 1773734452000,
|
|
525
|
+
order_by: 'desc',
|
|
526
|
+
limit: 15,
|
|
527
|
+
)
|
|
528
|
+
```
|
|
412
529
|
|
|
413
|
-
|
|
530
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/closed](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersClosed)
|
|
414
531
|
|
|
415
|
-
|
|
416
|
-
<summary>Show code</summary>
|
|
532
|
+
> Get closed orders.
|
|
417
533
|
|
|
418
534
|
```rb
|
|
419
535
|
# use default parameters
|
|
420
|
-
@
|
|
536
|
+
@private_v3_api.closed_orders('maxtwd')
|
|
421
537
|
|
|
422
538
|
# provide all possible parameters
|
|
423
|
-
@
|
|
424
|
-
'
|
|
425
|
-
'
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
state: 'accepted',
|
|
429
|
-
pagination: true,
|
|
430
|
-
page: 3,
|
|
539
|
+
@private_v3_api.closed_orders(
|
|
540
|
+
'maxtwd',
|
|
541
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
542
|
+
timestamp: 1773734452000,
|
|
543
|
+
order_by: 'desc',
|
|
431
544
|
limit: 15,
|
|
432
|
-
offset: 5,
|
|
433
545
|
)
|
|
434
546
|
```
|
|
435
|
-
</details>
|
|
436
547
|
|
|
437
|
-
#### [GET /api/
|
|
438
|
-
|
|
439
|
-
> get details of a specific deposit
|
|
548
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/history](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersHistory)
|
|
440
549
|
|
|
441
|
-
|
|
442
|
-
<summary>Show code</summary>
|
|
550
|
+
> Get order history in ascending order from a specific from_id.
|
|
443
551
|
|
|
444
552
|
```rb
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
</details>
|
|
553
|
+
# use default parameters
|
|
554
|
+
@private_v3_api.order_history('maxtwd')
|
|
448
555
|
|
|
449
|
-
|
|
450
|
-
|
|
556
|
+
# provide all possible parameters
|
|
557
|
+
@private_v3_api.orders_history(
|
|
558
|
+
'maxtwd',
|
|
559
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
560
|
+
from_id: 123456,
|
|
561
|
+
limit: 15,
|
|
562
|
+
)
|
|
563
|
+
```
|
|
451
564
|
|
|
452
|
-
|
|
565
|
+
#### [POST /api/v3/wallet/{wallet_type}/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/postApiV3WalletPathWalletTypeOrder)
|
|
453
566
|
|
|
454
|
-
|
|
455
|
-
<summary>Show code</summary>
|
|
567
|
+
> Create sell/buy order
|
|
456
568
|
|
|
457
569
|
```rb
|
|
458
570
|
# use default parameters
|
|
459
|
-
@
|
|
571
|
+
@private_v3_api.create_order!('maxtwd', 'buy', 1000, price: 7.5)
|
|
460
572
|
|
|
461
573
|
# provide all possible parameters
|
|
462
|
-
@
|
|
574
|
+
@private_v3_api.create_order!(
|
|
575
|
+
'maxtwd',
|
|
576
|
+
'buy',
|
|
577
|
+
1000,
|
|
578
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
579
|
+
price: 7.5,
|
|
580
|
+
client_oid: 'MY_ORDER_ID_12345',
|
|
581
|
+
stop_price: 8,
|
|
582
|
+
ord_type: 'limit',
|
|
583
|
+
group_id: 12345678,
|
|
584
|
+
)
|
|
463
585
|
```
|
|
464
|
-
</details>
|
|
465
|
-
|
|
466
|
-
#### [POST /api/v2/deposit_addresses](https://max.maicoin.com/documents/api_list#!/private/postApiV2DepositAddresses)
|
|
467
586
|
|
|
468
|
-
|
|
587
|
+
#### [GET /api/v3/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3Order)
|
|
469
588
|
|
|
470
|
-
|
|
471
|
-
<summary>Show code</summary>
|
|
589
|
+
> Get order detail
|
|
472
590
|
|
|
473
591
|
```rb
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
592
|
+
# use default parameters
|
|
593
|
+
# use max unique order id
|
|
594
|
+
@private_v3_api.order(123456)
|
|
477
595
|
|
|
478
|
-
|
|
596
|
+
# use user specified order id
|
|
597
|
+
@private_v3_api.order(client_oid: 'MY_ORDER_123456')
|
|
598
|
+
```
|
|
479
599
|
|
|
480
|
-
|
|
600
|
+
#### [DELETE /api/v3/wallet/{wallet_type}/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/deleteApiV3WalletPathWalletTypeOrders)
|
|
481
601
|
|
|
482
|
-
|
|
483
|
-
<summary>Show code</summary>
|
|
602
|
+
> Cancel all orders
|
|
484
603
|
|
|
485
604
|
```rb
|
|
486
605
|
# use default parameters
|
|
487
|
-
@
|
|
606
|
+
@private_v3_api.cancel_orders!
|
|
488
607
|
|
|
489
608
|
# provide all possible parameters
|
|
490
|
-
@
|
|
609
|
+
@private_v3_api.cancel_orders!(
|
|
610
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
611
|
+
market: 'maxtwd',
|
|
612
|
+
side: 'sell',
|
|
613
|
+
group_id: '123456',
|
|
614
|
+
)
|
|
491
615
|
```
|
|
492
|
-
</details>
|
|
493
|
-
|
|
494
|
-
### Internal Transfer
|
|
495
|
-
#### [GET /api/v2/internal_transfers](https://max.maicoin.com/documents/api_list#!/private/getApiV2InternalTransfers)
|
|
496
616
|
|
|
497
|
-
|
|
617
|
+
#### [DELETE /api/v3/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/deleteApiV3Order)
|
|
498
618
|
|
|
499
|
-
|
|
500
|
-
<summary>Show code</summary>
|
|
619
|
+
> Cancel an order
|
|
501
620
|
|
|
502
621
|
```rb
|
|
503
|
-
# use
|
|
504
|
-
@
|
|
622
|
+
# use max unique order id
|
|
623
|
+
@private_v3_api.cancel_order!(123456)
|
|
505
624
|
|
|
506
|
-
#
|
|
507
|
-
@
|
|
508
|
-
currency: 'btc',
|
|
509
|
-
side: 'in',
|
|
510
|
-
from: 68444,
|
|
511
|
-
to: 69444,
|
|
512
|
-
pagination: true,
|
|
513
|
-
page: 3,
|
|
514
|
-
limit: 15,
|
|
515
|
-
offset: 5,
|
|
516
|
-
)
|
|
625
|
+
# use user specified order id
|
|
626
|
+
@private_v3_api.cancel_order!(client_oid: 'MY_ORDER_123456')
|
|
517
627
|
```
|
|
518
|
-
</details>
|
|
519
628
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
> get details of a specific internal transfer
|
|
629
|
+
### Trade
|
|
630
|
+
#### [GET /api/v3/order/trades](https://max-api.maicoin.com/doc/v3.html#tag/Trade/operation/getApiV3OrderTrades)
|
|
523
631
|
|
|
524
|
-
|
|
525
|
-
<summary>Show code</summary>
|
|
632
|
+
> Get trade detail by your order info
|
|
526
633
|
|
|
527
634
|
```rb
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
</details>
|
|
635
|
+
# use max unique order id
|
|
636
|
+
@private_v3_api.my_trades_of_order(123456)
|
|
531
637
|
|
|
532
|
-
|
|
533
|
-
|
|
638
|
+
# use user specified order id
|
|
639
|
+
@private_v3_api.my_trades_of_order(client_oid: 'MY_ORDER_123456')
|
|
640
|
+
```
|
|
534
641
|
|
|
535
|
-
|
|
642
|
+
#### [GET /api/v3/wallet/{path_wallet_type}/trades](https://max-api.maicoin.com/doc/v3.html#tag/Trade/operation/getApiV3WalletPathWalletTypeTrades)
|
|
536
643
|
|
|
537
|
-
|
|
538
|
-
<summary>Show code</summary>
|
|
644
|
+
> Get executed trades
|
|
539
645
|
|
|
540
646
|
```rb
|
|
541
647
|
# use default parameters
|
|
542
|
-
@
|
|
648
|
+
@private_v3_api.my_trades
|
|
543
649
|
|
|
544
650
|
# provide all possible parameters
|
|
545
|
-
@
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
651
|
+
@private_v3_api.my_trades(
|
|
652
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
653
|
+
market: 'maxtwd',
|
|
654
|
+
timestamp: 1624705402,
|
|
655
|
+
from_id: 68444,
|
|
656
|
+
order_by: 'asc',
|
|
551
657
|
limit: 15,
|
|
552
|
-
offset: 5,
|
|
553
658
|
)
|
|
554
659
|
```
|
|
555
|
-
</details>
|
|
556
660
|
|
|
557
|
-
|
|
661
|
+
### Deposit
|
|
662
|
+
#### [GET /api/v3/deposit_address](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3DepositAddress)
|
|
663
|
+
|
|
664
|
+
> Get user deposit address by currency version
|
|
558
665
|
|
|
559
|
-
|
|
666
|
+
```rb
|
|
667
|
+
@private_v3_api.deposit_address('bscusdt')
|
|
668
|
+
```
|
|
560
669
|
|
|
561
|
-
|
|
562
|
-
|
|
670
|
+
#### [GET /api/v3/deposits](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Deposits)
|
|
671
|
+
|
|
672
|
+
> get your deposits history
|
|
563
673
|
|
|
564
674
|
```rb
|
|
565
675
|
# use default parameters
|
|
566
|
-
@
|
|
676
|
+
@private_v3_api.deposits
|
|
567
677
|
|
|
568
678
|
# provide all possible parameters
|
|
569
|
-
@
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
to: 69444,
|
|
574
|
-
pagination: true,
|
|
575
|
-
page: 3,
|
|
679
|
+
@private_v3_api.deposits(
|
|
680
|
+
currency: 'max',
|
|
681
|
+
timestamp: 1624705402,
|
|
682
|
+
order_by: 'asc',
|
|
576
683
|
limit: 15,
|
|
577
|
-
offset: 5,
|
|
578
684
|
)
|
|
579
685
|
```
|
|
580
|
-
</details>
|
|
581
|
-
|
|
582
|
-
#### [GET /api/v2/max_rewards/yesterday](https://max.maicoin.com/documents/api_list#!/private/getApiV2MaxRewardsYesterday)
|
|
583
686
|
|
|
584
|
-
|
|
687
|
+
#### [GET /api/v3/deposit](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Deposit)
|
|
585
688
|
|
|
586
|
-
|
|
587
|
-
<summary>Show code</summary>
|
|
689
|
+
> Get details of a specific deposit
|
|
588
690
|
|
|
589
691
|
```rb
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
</details>
|
|
692
|
+
# Query by uuid
|
|
693
|
+
@private_v3_api.deposit(uuid: '18022603540001')
|
|
593
694
|
|
|
594
|
-
|
|
695
|
+
# Query by txid
|
|
696
|
+
@private_v3_api.deposit(txid: '0x8daa98e07886985bd6a142cd81b83582d6085f7eb931dc4984c18c84f2a845e0')
|
|
697
|
+
```
|
|
595
698
|
|
|
596
|
-
|
|
699
|
+
### Withdraw
|
|
700
|
+
#### [GET /api/v3/withdraw_addresses](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WithdrawAddresses)
|
|
597
701
|
|
|
598
|
-
|
|
599
|
-
<summary>Show code</summary>
|
|
702
|
+
> Get withdraw addresses of spot wallet
|
|
600
703
|
|
|
601
704
|
```rb
|
|
602
|
-
|
|
603
|
-
@api_v2yields
|
|
705
|
+
@private_v3_api.withdraw_addresses('usdt')
|
|
604
706
|
|
|
605
707
|
# provide all possible parameters
|
|
606
|
-
@
|
|
607
|
-
currency: 'usdt',
|
|
608
|
-
from: 68444,
|
|
609
|
-
to: 69444,
|
|
610
|
-
pagination: true,
|
|
611
|
-
page: 3,
|
|
612
|
-
limit: 15,
|
|
613
|
-
offset: 5,
|
|
614
|
-
)
|
|
708
|
+
@private_v3_api.withdraw_addresses('usdt', limit: 10, offset: 5)
|
|
615
709
|
```
|
|
616
|
-
</details>
|
|
617
|
-
|
|
618
|
-
### Order
|
|
619
|
-
#### [GET /api/v2/orders](https://max.maicoin.com/documents/api_list#!/private/getApiV2Orders)
|
|
620
710
|
|
|
621
|
-
|
|
711
|
+
#### [GET /api/v3/withdrawals](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Withdrawals)
|
|
622
712
|
|
|
623
|
-
|
|
624
|
-
<summary>Show code</summary>
|
|
713
|
+
> Get external withdrawals history
|
|
625
714
|
|
|
626
715
|
```rb
|
|
627
716
|
# use default parameters
|
|
628
|
-
@
|
|
717
|
+
@private_v3_api.withdraws
|
|
629
718
|
|
|
630
719
|
# provide all possible parameters
|
|
631
|
-
@
|
|
632
|
-
'
|
|
720
|
+
@private_v3_api.withdraws(
|
|
721
|
+
currency: 'max',
|
|
633
722
|
state: 'done',
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
pagination: true,
|
|
637
|
-
page: 3,
|
|
723
|
+
timestamp: 1624705402,
|
|
724
|
+
order_by: 'asc',
|
|
638
725
|
limit: 15,
|
|
639
|
-
offset: 5,
|
|
640
726
|
)
|
|
641
727
|
```
|
|
642
|
-
</details>
|
|
643
|
-
|
|
644
|
-
#### [GET /api/v2/order](https://max.maicoin.com/documents/api_list#!/private/getApiV2Order)
|
|
645
728
|
|
|
646
|
-
|
|
729
|
+
#### [GET /api/v3/withdrawal](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Withdrawal)
|
|
647
730
|
|
|
648
|
-
|
|
649
|
-
<summary>Show code</summary>
|
|
731
|
+
> Get details of a specific external withdraw
|
|
650
732
|
|
|
651
733
|
```rb
|
|
652
|
-
#
|
|
734
|
+
# Query by uuid
|
|
735
|
+
@private_v3_api.withdraw(uuid: '18022603540001')
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
#### [POST /api/v3/withdrawal](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2Withdrawal)
|
|
739
|
+
|
|
740
|
+
> Submit a crypto withdrawal. IP whitelist for api token is required.
|
|
741
|
+
|
|
742
|
+
```rb
|
|
743
|
+
@private_v3_api.create_withdraw!('withdraw_address_id', 100000)
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
#### [POST /api/v3/withdrawal/twd](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3WithdrawalTwd)
|
|
747
|
+
|
|
748
|
+
> Submit twd withdrawal to verified bank account. IP whitelist for api token is required.
|
|
749
|
+
|
|
750
|
+
```rb
|
|
751
|
+
@private_v3_api.create_twd_withdraw!(100000)
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
### Internal Transfer
|
|
755
|
+
#### [GET /api/v3/internal_transfers](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3InternalTransfers)
|
|
756
|
+
|
|
757
|
+
> Get internal transfers history
|
|
758
|
+
|
|
759
|
+
```rb
|
|
760
|
+
# use default parameters
|
|
761
|
+
@private_v3_api.internal_transfers
|
|
762
|
+
|
|
763
|
+
# provide all possible parameters
|
|
764
|
+
@private_v2_api.internal_transfers(
|
|
765
|
+
currency: 'btc',
|
|
766
|
+
side: 'in',
|
|
767
|
+
timestamp: 1624705402,
|
|
768
|
+
order_by: 'asc',
|
|
769
|
+
limit: 15,
|
|
770
|
+
)
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### Reward
|
|
774
|
+
#### [GET /api/v3/rewards](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Rewards)
|
|
775
|
+
|
|
776
|
+
> Get internal transfers history
|
|
777
|
+
|
|
778
|
+
```rb
|
|
779
|
+
# use default parameters
|
|
780
|
+
@private_v3_api.rewards
|
|
781
|
+
|
|
782
|
+
# provide all possible parameters
|
|
783
|
+
@private_v2_api.rewards(
|
|
784
|
+
currency: 'btc',
|
|
785
|
+
reward_type: 'yield',
|
|
786
|
+
timestamp: 1624705402,
|
|
787
|
+
order_by: 'asc',
|
|
788
|
+
limit: 15,
|
|
789
|
+
)
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
## SubAccount
|
|
793
|
+
#### [GET /api/v3/sub_accounts](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3SubAccounts)
|
|
794
|
+
|
|
795
|
+
> Get sub_accounts
|
|
796
|
+
|
|
797
|
+
```rb
|
|
798
|
+
@private_v3_api.sub_accounts
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
#### [GET /api/v3/sub_account](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3SubAccount)
|
|
802
|
+
|
|
803
|
+
> Get sub_account
|
|
804
|
+
|
|
805
|
+
```rb
|
|
806
|
+
@private_v3_api.sub_account('s1-a7f20f')
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
#### [POST /api/v3/sub_accounts](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3SubAccounts)
|
|
810
|
+
|
|
811
|
+
> Create sub_account
|
|
812
|
+
|
|
813
|
+
```rb
|
|
814
|
+
@private_v3_api.create_sub_account!(name: 'My Test SubAccount')
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
#### [PUT /api/v3/sub_account](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/putApiV3SubAccount)
|
|
818
|
+
|
|
819
|
+
> Update sub_account
|
|
820
|
+
|
|
821
|
+
```rb
|
|
822
|
+
@private_v3_api.update_sub_account!('s1-a7f20f', name: 'My Test SubAccount')
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
#### [DELETE /api/v3/sub_account](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/deleteApiV3SubAccount)
|
|
826
|
+
|
|
827
|
+
> Delete sub_account
|
|
828
|
+
|
|
829
|
+
```rb
|
|
830
|
+
@private_v3_api.delete_sub_account!('s1-a7f20f')
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
#### [POST /api/v3/sub_account/transfer](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3SubAccountTransfer)
|
|
834
|
+
|
|
835
|
+
> Submit sub_account transfer
|
|
836
|
+
|
|
837
|
+
```rb
|
|
838
|
+
# Transfer from main to s1 sub-account
|
|
839
|
+
@private_v3_api.current_sub_account_sn = 'main'
|
|
840
|
+
@private_v3_api.create_sub_account_transfer!('s1-a7f20f', 3, 'eth')
|
|
841
|
+
|
|
842
|
+
# Transfer from s1 sub-account to s2 sub-account
|
|
843
|
+
@private_v3_api.current_sub_account_sn = 's1-a7f20f'
|
|
844
|
+
@private_v3_api.create_sub_account_transfer!('s2-jsjwsa', 3, 'eth')
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
## Public V2 Api Examples
|
|
848
|
+
|
|
849
|
+
```rb
|
|
850
|
+
@public_v2_api = MaxExchangeApi::PublicV2Api.new
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
#### [GET /api/v2/vip_levels](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2VipLevels)
|
|
854
|
+
|
|
855
|
+
> Get all VIP level fees.
|
|
856
|
+
|
|
857
|
+
```rb
|
|
858
|
+
@public_v2_api.vip_levels
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
#### [GET /api/v2/vip_levels/{level}](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2VipLevelsLevel)
|
|
862
|
+
|
|
863
|
+
> Get VIP level fee by level.
|
|
864
|
+
|
|
865
|
+
```rb
|
|
866
|
+
@public_v2_api.vip_levels(2)
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
#### [GET /api/v2/currencies](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Currencies)
|
|
870
|
+
|
|
871
|
+
> Get all available currencies.
|
|
872
|
+
|
|
873
|
+
```rb
|
|
874
|
+
@public_v2_api.currencies
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
#### [GET /api/v2/k](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2K)
|
|
878
|
+
|
|
879
|
+
> Get OHLC(k line) of a specific market.
|
|
880
|
+
|
|
881
|
+
```rb
|
|
882
|
+
# use default parameters
|
|
883
|
+
@public_v2_api.k('btctwd')
|
|
884
|
+
|
|
885
|
+
# provide all possible parameters
|
|
886
|
+
@public_v2_api.k('btctwd', limit: 30, period: 1, timestamp: 1624705402)
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
#### [GET /api/v2/depth](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Depth)
|
|
890
|
+
|
|
891
|
+
> Get depth of a specified market.
|
|
892
|
+
|
|
893
|
+
```rb
|
|
894
|
+
# use default parameters
|
|
895
|
+
@public_v2_api.depth('maxtwd')
|
|
896
|
+
|
|
897
|
+
# provide all possible parameters
|
|
898
|
+
@public_v2_api.depth('maxtwd', limit: 10, sort_by_price: true)
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
#### [GET /api/v2/trades](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Trades)
|
|
902
|
+
|
|
903
|
+
> Get recent trades on market, sorted in reverse creation order.
|
|
904
|
+
|
|
905
|
+
```rb
|
|
906
|
+
# use default parameters
|
|
907
|
+
@public_v2_api.trades('btctwd')
|
|
908
|
+
|
|
909
|
+
# provide all possible parameters
|
|
910
|
+
@public_v2_api.trades(
|
|
911
|
+
'maxtwd',
|
|
912
|
+
timestamp: 1624705402,
|
|
913
|
+
from: 68444,
|
|
914
|
+
to: 69444,
|
|
915
|
+
order_by: 'asc',
|
|
916
|
+
pagination: true,
|
|
917
|
+
page: 3,
|
|
918
|
+
limit: 15,
|
|
919
|
+
offset: 5,
|
|
920
|
+
)
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
#### [GET /api/v2/markets](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Markets)
|
|
924
|
+
|
|
925
|
+
> Get all available markets.
|
|
926
|
+
|
|
927
|
+
```rb
|
|
928
|
+
@public_v2_api.markets
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
#### [GET /api/v2/summary](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Summary)
|
|
932
|
+
|
|
933
|
+
> Overview of market data for all tickers.
|
|
934
|
+
|
|
935
|
+
```rb
|
|
936
|
+
@public_v2_api.summary
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
#### [GET /api/v2/tickers/{path_market}](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2TickersPathMarket)
|
|
940
|
+
|
|
941
|
+
> Get ticker of specific market.
|
|
942
|
+
|
|
943
|
+
```rb
|
|
944
|
+
@public_v2_api.tickers('btctwd')
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
#### [GET /api/v2/tickers](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Tickers)
|
|
948
|
+
|
|
949
|
+
> Get ticker of all markets.
|
|
950
|
+
|
|
951
|
+
```rb
|
|
952
|
+
@public_v2_api.tickers
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
#### [GET /api/v2/timestamp](https://max-api.maicoin.com/doc/v2.html#tag/public/operation/getApiV2Timestamp)
|
|
956
|
+
|
|
957
|
+
> Get server current time, in seconds since Unix epoch.
|
|
958
|
+
|
|
959
|
+
```rb
|
|
960
|
+
@public_v2_api.timestamp
|
|
961
|
+
```
|
|
962
|
+
|
|
963
|
+
## Private V2 Api Examples
|
|
964
|
+
|
|
965
|
+
```rb
|
|
966
|
+
access_key = 'YOUR_ACCESS_KEY'
|
|
967
|
+
secret_key = 'YOUR_SECRET_KEY'
|
|
968
|
+
|
|
969
|
+
@private_v2_api = MaxExchangeApi::PrivateV2Api.new(access_key, secret_key)
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
### User
|
|
973
|
+
#### [GET /api/v2/members/profile](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2MembersProfile)
|
|
974
|
+
|
|
975
|
+
> get personal profile information
|
|
976
|
+
|
|
977
|
+
```rb
|
|
978
|
+
@private_v2_api.member_profile
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
#### [GET /api/v2/members/me](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2MembersMe)
|
|
982
|
+
|
|
983
|
+
> get your profile and accounts information
|
|
984
|
+
|
|
985
|
+
```rb
|
|
986
|
+
@private_v2_api.me
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
#### [GET /api/v2/members/vip_level](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2MembersVipLevel)
|
|
990
|
+
|
|
991
|
+
> get VIP level info
|
|
992
|
+
|
|
993
|
+
```rb
|
|
994
|
+
@private_v2_api.vip_level
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
### Account
|
|
998
|
+
#### [GET /api/v2/members/accounts](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2MembersAccounts)
|
|
999
|
+
|
|
1000
|
+
> get personal accounts information
|
|
1001
|
+
|
|
1002
|
+
```rb
|
|
1003
|
+
@private_v2_api.accounts
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
#### [GET /api/v2/members/accounts/{path_currency}](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2MembersAccountsPathCurrency)
|
|
1007
|
+
|
|
1008
|
+
> get personal accounts information of a currency
|
|
1009
|
+
|
|
1010
|
+
```rb
|
|
1011
|
+
@private_v2_api.account(currnecy)
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
### Order
|
|
1015
|
+
#### [GET /api/v2/orders](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Orders)
|
|
1016
|
+
|
|
1017
|
+
> get your orders, results is paginated.
|
|
1018
|
+
|
|
1019
|
+
```rb
|
|
1020
|
+
# use default parameters
|
|
1021
|
+
@private_v2_api.orders('maxtwd')
|
|
1022
|
+
|
|
1023
|
+
# provide all possible parameters
|
|
1024
|
+
@api.orders(
|
|
1025
|
+
'maxtwd',
|
|
1026
|
+
state: 'done',
|
|
1027
|
+
order_by: 'desc',
|
|
1028
|
+
group_id: 12345,
|
|
1029
|
+
pagination: true,
|
|
1030
|
+
page: 3,
|
|
1031
|
+
limit: 15,
|
|
1032
|
+
offset: 5,
|
|
1033
|
+
)
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
#### [GET /api/v2/order](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Order)
|
|
1037
|
+
|
|
1038
|
+
> get a specific order.
|
|
1039
|
+
|
|
1040
|
+
```rb
|
|
1041
|
+
# use max unique order id
|
|
653
1042
|
@api.order(123456)
|
|
654
1043
|
|
|
655
1044
|
# use user specified order id
|
|
656
1045
|
@api.order('MY_ORDER_123456', use_client_id: true)
|
|
657
1046
|
```
|
|
658
|
-
</details>
|
|
659
1047
|
|
|
660
|
-
#### [POST /api/v2/orders/clear](https://max.maicoin.com/
|
|
1048
|
+
#### [POST /api/v2/orders/clear](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2OrdersClear)
|
|
661
1049
|
|
|
662
1050
|
> cancel all your orders with given market and side
|
|
663
1051
|
|
|
664
|
-
<details>
|
|
665
|
-
<summary>Show code</summary>
|
|
666
|
-
|
|
667
1052
|
```rb
|
|
668
1053
|
# use default parameters
|
|
669
1054
|
@api.cancel_orders!
|
|
@@ -671,15 +1056,11 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
671
1056
|
# provide all possible parameters
|
|
672
1057
|
@api.cancel_orders!(market: 'maxtwd', side: 'sell', group_id: '123456')
|
|
673
1058
|
```
|
|
674
|
-
</details>
|
|
675
1059
|
|
|
676
|
-
#### [POST /api/v2/order/delete](https://max.maicoin.com/
|
|
1060
|
+
#### [POST /api/v2/order/delete](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2OrderDelete)
|
|
677
1061
|
|
|
678
1062
|
> cancel an order
|
|
679
1063
|
|
|
680
|
-
<details>
|
|
681
|
-
<summary>Show code</summary>
|
|
682
|
-
|
|
683
1064
|
```rb
|
|
684
1065
|
# use max unique order id
|
|
685
1066
|
@api.cancel_order!(123456)
|
|
@@ -687,15 +1068,11 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
687
1068
|
# use user specified order id
|
|
688
1069
|
@api.cancel_order!('MY_ORDER_123456', use_client_id: true)
|
|
689
1070
|
```
|
|
690
|
-
</details>
|
|
691
1071
|
|
|
692
|
-
#### [POST /api/v2/orders](https://max.maicoin.com/
|
|
1072
|
+
#### [POST /api/v2/orders](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2Orders)
|
|
693
1073
|
|
|
694
1074
|
> create a sell/buy order
|
|
695
1075
|
|
|
696
|
-
<details>
|
|
697
|
-
<summary>Show code</summary>
|
|
698
|
-
|
|
699
1076
|
```rb
|
|
700
1077
|
# use default parameters
|
|
701
1078
|
@api.create_order!('maxtwd', 'buy', 1000, price: 7.5)
|
|
@@ -712,15 +1089,11 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
712
1089
|
group_id: 12345678,
|
|
713
1090
|
)
|
|
714
1091
|
```
|
|
715
|
-
</details>
|
|
716
1092
|
|
|
717
|
-
#### [POST /api/v2/orders/multi/onebyone](https://max.maicoin.com/
|
|
1093
|
+
#### [POST /api/v2/orders/multi/onebyone](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2OrdersMultiOnebyone)
|
|
718
1094
|
|
|
719
1095
|
> Create multiple sell/buy orders, orders may be partially accepted, please put your orders as an array in json body.
|
|
720
1096
|
|
|
721
|
-
<details>
|
|
722
|
-
<summary>Show code</summary>
|
|
723
|
-
|
|
724
1097
|
```rb
|
|
725
1098
|
# use default parameters
|
|
726
1099
|
@api.create_orders!('maxtwd', [
|
|
@@ -734,7 +1107,243 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
734
1107
|
{ side: 'buy', volume: '1500', price: '7.2', client_oid: 'MY_ORDER_ID_12346', stop_price: '8', ord_type: 'limit' },
|
|
735
1108
|
], group_id: 12345)
|
|
736
1109
|
```
|
|
737
|
-
|
|
1110
|
+
|
|
1111
|
+
### Trade
|
|
1112
|
+
#### [GET /api/v2/trades/my/of_order](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2TradesMyOfOrder)
|
|
1113
|
+
|
|
1114
|
+
> get your executed trades related to a order
|
|
1115
|
+
|
|
1116
|
+
```rb
|
|
1117
|
+
# use max unique order id
|
|
1118
|
+
@private_v2_api.my_trades_of_order(123456)
|
|
1119
|
+
|
|
1120
|
+
# use user specified order id
|
|
1121
|
+
@private_v2_api.my_trades_of_order('MY_ORDER_123456', use_client_id: true)
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
#### [GET /api/v2/trades/my](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2TradesMy)
|
|
1125
|
+
|
|
1126
|
+
> get your executed trades, sorted in reverse creation order
|
|
1127
|
+
|
|
1128
|
+
```rb
|
|
1129
|
+
# use default parameters
|
|
1130
|
+
@private_v2_api.my_trades('btctwd')
|
|
1131
|
+
|
|
1132
|
+
# provide all possible parameters
|
|
1133
|
+
@private_v2_api.my_trades(
|
|
1134
|
+
'maxtwd',
|
|
1135
|
+
timestamp: 1624705402,
|
|
1136
|
+
from: 68444,
|
|
1137
|
+
to: 69444,
|
|
1138
|
+
order_by: 'asc',
|
|
1139
|
+
pagination: true,
|
|
1140
|
+
page: 3,
|
|
1141
|
+
limit: 15,
|
|
1142
|
+
offset: 5,
|
|
1143
|
+
)
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
### Deposit
|
|
1147
|
+
#### [GET /api/v2/deposits](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Deposits)
|
|
1148
|
+
|
|
1149
|
+
> get your deposits history
|
|
1150
|
+
|
|
1151
|
+
```rb
|
|
1152
|
+
# use default parameters
|
|
1153
|
+
@private_v2_api.deposits('max')
|
|
1154
|
+
|
|
1155
|
+
# provide all possible parameters
|
|
1156
|
+
@private_v2_api.deposits(
|
|
1157
|
+
'max',
|
|
1158
|
+
'confirmed',
|
|
1159
|
+
from: 68444,
|
|
1160
|
+
to: 69444,
|
|
1161
|
+
state: 'accepted',
|
|
1162
|
+
pagination: true,
|
|
1163
|
+
page: 3,
|
|
1164
|
+
limit: 15,
|
|
1165
|
+
offset: 5,
|
|
1166
|
+
)
|
|
1167
|
+
```
|
|
1168
|
+
|
|
1169
|
+
#### [GET /api/v2/deposit](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Deposit)
|
|
1170
|
+
|
|
1171
|
+
> get details of a specific deposit
|
|
1172
|
+
|
|
1173
|
+
```rb
|
|
1174
|
+
@private_v2_api.deposit('transaction_id')
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
#### [GET /api/v2/deposit_addresses](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2DepositAddresses)
|
|
1178
|
+
|
|
1179
|
+
> The addresses could be empty before generated, please call POST /deposit_addresses in that case
|
|
1180
|
+
|
|
1181
|
+
```rb
|
|
1182
|
+
# use default parameters
|
|
1183
|
+
@private_v2_api.deposit_addresses
|
|
1184
|
+
|
|
1185
|
+
# provide all possible parameters
|
|
1186
|
+
@private_v2_api.deposit_addresses(currency: 'twd', pagination: true, page: 3, limit: 15, offset: 5)
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
#### [POST /api/v2/deposit_addresses](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2DepositAddresses)
|
|
1190
|
+
|
|
1191
|
+
> Address creation is asynchronous, please call GET /deposit_addresses later to get generated addresses
|
|
1192
|
+
|
|
1193
|
+
```rb
|
|
1194
|
+
@private_v2_api.create_deposit_addresses!('twd')
|
|
1195
|
+
```
|
|
1196
|
+
|
|
1197
|
+
### Withdrawal
|
|
1198
|
+
#### [GET /api/v2/withdrawals](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Withdrawals)
|
|
1199
|
+
|
|
1200
|
+
> get your external withdrawals history
|
|
1201
|
+
|
|
1202
|
+
```rb
|
|
1203
|
+
# use default parameters
|
|
1204
|
+
@private_v2_api.withdrawals('max')
|
|
1205
|
+
|
|
1206
|
+
# provide all possible parameters
|
|
1207
|
+
@private_v2_api.withdrawals(
|
|
1208
|
+
'max',
|
|
1209
|
+
'confirmed',
|
|
1210
|
+
from: 68444,
|
|
1211
|
+
to: 69444,
|
|
1212
|
+
state: 'confirmed',
|
|
1213
|
+
pagination: true,
|
|
1214
|
+
page: 3,
|
|
1215
|
+
limit: 15,
|
|
1216
|
+
offset: 5,
|
|
1217
|
+
)
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
#### [GET /api/v2/withdrawal](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Withdrawal)
|
|
1221
|
+
|
|
1222
|
+
> get details of a specific external withdraw
|
|
1223
|
+
|
|
1224
|
+
```rb
|
|
1225
|
+
@private_v2_api.withdrawal('withdraw_id')
|
|
1226
|
+
```
|
|
1227
|
+
|
|
1228
|
+
#### [POST /api/v2/withdrawal](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/postApiV2Withdrawal)
|
|
1229
|
+
|
|
1230
|
+
> submit a withdrawal. IP whitelist for api token is required.
|
|
1231
|
+
|
|
1232
|
+
```rb
|
|
1233
|
+
@private_v2_api.create_withdrawal!('twd', 'withdraw_address_id', 100000)
|
|
1234
|
+
```
|
|
1235
|
+
|
|
1236
|
+
#### [GET /api/v2/withdraw_addresses](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2WithdrawAddresses)
|
|
1237
|
+
|
|
1238
|
+
> get withdraw addresses
|
|
1239
|
+
|
|
1240
|
+
```rb
|
|
1241
|
+
# use default parameters
|
|
1242
|
+
@private_v2_api.withdraw_addresses('twd')
|
|
1243
|
+
|
|
1244
|
+
# provide all possible parameters
|
|
1245
|
+
@private_v2_api.withdraw_addresses('usdt', pagination: true, page: 3, limit: 15, offset: 5)
|
|
1246
|
+
```
|
|
1247
|
+
|
|
1248
|
+
### Internal Transfer
|
|
1249
|
+
#### [GET /api/v2/internal_transfers](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2InternalTransfers)
|
|
1250
|
+
|
|
1251
|
+
> get internal transfers history
|
|
1252
|
+
|
|
1253
|
+
```rb
|
|
1254
|
+
# use default parameters
|
|
1255
|
+
@private_v2_api.internal_transfers
|
|
1256
|
+
|
|
1257
|
+
# provide all possible parameters
|
|
1258
|
+
@private_v2_api.internal_transfers(
|
|
1259
|
+
currency: 'btc',
|
|
1260
|
+
side: 'in',
|
|
1261
|
+
from: 68444,
|
|
1262
|
+
to: 69444,
|
|
1263
|
+
pagination: true,
|
|
1264
|
+
page: 3,
|
|
1265
|
+
limit: 15,
|
|
1266
|
+
offset: 5,
|
|
1267
|
+
)
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
#### [GET /api/v2/internal_transfer](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2InternalTransfer)
|
|
1271
|
+
|
|
1272
|
+
> get details of a specific internal transfer
|
|
1273
|
+
|
|
1274
|
+
```rb
|
|
1275
|
+
@private_v2_api.internal_transfer('internal_transfer_id')
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
### Reward
|
|
1279
|
+
#### [GET /api/v2/rewards](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Rewards)
|
|
1280
|
+
|
|
1281
|
+
> get rewards history
|
|
1282
|
+
|
|
1283
|
+
```rb
|
|
1284
|
+
# use default parameters
|
|
1285
|
+
@private_v2_api.rewards
|
|
1286
|
+
|
|
1287
|
+
# provide all possible parameters
|
|
1288
|
+
@private_v2_api.rewards(
|
|
1289
|
+
currency: 'btc',
|
|
1290
|
+
from: 68444,
|
|
1291
|
+
to: 69444,
|
|
1292
|
+
pagination: true,
|
|
1293
|
+
page: 3,
|
|
1294
|
+
limit: 15,
|
|
1295
|
+
offset: 5,
|
|
1296
|
+
)
|
|
1297
|
+
```
|
|
1298
|
+
|
|
1299
|
+
#### [GET /api/v2/rewards/{path_reward_type}](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2RewardsPathRewardType)
|
|
1300
|
+
|
|
1301
|
+
> get specific rewards history
|
|
1302
|
+
|
|
1303
|
+
```rb
|
|
1304
|
+
# use default parameters
|
|
1305
|
+
@private_v2_api.rewards(reward_type: 'airdrop_rewards')
|
|
1306
|
+
|
|
1307
|
+
# provide all possible parameters
|
|
1308
|
+
@private_v2_api.rewards(
|
|
1309
|
+
reward_type: 'airdrop_rewards',
|
|
1310
|
+
currency: 'btc',
|
|
1311
|
+
from: 68444,
|
|
1312
|
+
to: 69444,
|
|
1313
|
+
pagination: true,
|
|
1314
|
+
page: 3,
|
|
1315
|
+
limit: 15,
|
|
1316
|
+
offset: 5,
|
|
1317
|
+
)
|
|
1318
|
+
```
|
|
1319
|
+
|
|
1320
|
+
#### [GET /api/v2/max_rewards/yesterday](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2MaxRewardsYesterday)
|
|
1321
|
+
|
|
1322
|
+
> get max rewards yesterday
|
|
1323
|
+
|
|
1324
|
+
```rb
|
|
1325
|
+
@private_v2_api.max_rewards_yesterday
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
#### [GET /api/v2/yields](https://max-api.maicoin.com/doc/v2.html#tag/private/operation/getApiV2Yields)
|
|
1329
|
+
|
|
1330
|
+
> get yields history
|
|
1331
|
+
|
|
1332
|
+
```rb
|
|
1333
|
+
# use default parameters
|
|
1334
|
+
@private_v2_api.yields
|
|
1335
|
+
|
|
1336
|
+
# provide all possible parameters
|
|
1337
|
+
@private_v2_api.yields(
|
|
1338
|
+
currency: 'usdt',
|
|
1339
|
+
from: 68444,
|
|
1340
|
+
to: 69444,
|
|
1341
|
+
pagination: true,
|
|
1342
|
+
page: 3,
|
|
1343
|
+
limit: 15,
|
|
1344
|
+
offset: 5,
|
|
1345
|
+
)
|
|
1346
|
+
```
|
|
738
1347
|
|
|
739
1348
|
## Development
|
|
740
1349
|
|