max_exchange_api 2.0.0 → 2.0.1
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/CHANGELOG.md +11 -0
- data/README.md +6 -1303
- data/docs/README.api_v2.md +610 -0
- data/docs/README.api_v3.md +759 -0
- data/lib/max_exchange_api/private_v3/sub_account_api.rb +1 -1
- data/lib/max_exchange_api/version.rb +1 -1
- metadata +3 -1
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
## Documentations
|
|
2
|
+
|
|
3
|
+
* [MAX V3 RESTful API List](https://max-api.maicoin.com/doc/v3.html)
|
|
4
|
+
* [WebSocket API Documentation](https://maicoin.github.io/max-websocket-docs/)
|
|
5
|
+
|
|
6
|
+
## Table of contents
|
|
7
|
+
|
|
8
|
+
<!-- TOC -->
|
|
9
|
+
* [Documentations](#documentations)
|
|
10
|
+
* [Table of contents](#table-of-contents)
|
|
11
|
+
* [Usage](#usage)
|
|
12
|
+
* [Configuration](#configuration)
|
|
13
|
+
* [Set timeout time](#set-timeout-time)
|
|
14
|
+
* [Logging](#logging)
|
|
15
|
+
* [Switch Sub-Account](#switch-sub-account)
|
|
16
|
+
* [Public V3 Api Examples](#public-v3-api-examples)
|
|
17
|
+
* [GET /api/v3/wallet/m/index_prices](#get-apiv3walletmindex_prices)
|
|
18
|
+
* [GET /api/v3/wallet/m/historical_index_prices](#get-apiv3walletmhistorical_index_prices)
|
|
19
|
+
* [GET /api/v3/wallet/m/limits](#get-apiv3walletmlimits)
|
|
20
|
+
* [GET /api/v3/wallet/m/interest_rates](#get-apiv3walletminterest_rates)
|
|
21
|
+
* [GET /api/v3/markets](#get-apiv3markets)
|
|
22
|
+
* [GET /api/v3/currencies](#get-apiv3currencies)
|
|
23
|
+
* [GET /api/v3/timestamp](#get-apiv3timestamp)
|
|
24
|
+
* [GET /api/v3/k](#get-apiv3k)
|
|
25
|
+
* [GET /api/v3/depth](#get-apiv3depth)
|
|
26
|
+
* [GET /api/v3/trades](#get-apiv3trades)
|
|
27
|
+
* [GET /api/v3/tickers](#get-apiv3tickers)
|
|
28
|
+
* [GET /api/v3/ticker](#get-apiv3ticker)
|
|
29
|
+
* [Private V3 Api Examples](#private-v3-api-examples)
|
|
30
|
+
* [User](#user)
|
|
31
|
+
* [GET /api/v3/info](#get-apiv3info)
|
|
32
|
+
* [Account](#account)
|
|
33
|
+
* [GET /api/v3/wallet/{wallet_type}/accounts](#get-apiv3walletwallet_typeaccounts)
|
|
34
|
+
* [M-Wallet](#m-wallet)
|
|
35
|
+
* [GET /api/v3/wallet/m/ad_ratio](#get-apiv3walletmad_ratio)
|
|
36
|
+
* [POST /api/v3/wallet/m/loan](#post-apiv3walletmloan)
|
|
37
|
+
* [POST /api/v3/wallet/m/repayment](#post-apiv3walletmrepayment)
|
|
38
|
+
* [GET /api/v3/wallet/m/loans](#get-apiv3walletmloans)
|
|
39
|
+
* [GET /api/v3/wallet/m/repayments](#get-apiv3walletmrepayments)
|
|
40
|
+
* [GET /api/v3/wallet/m/liquidations](#get-apiv3walletmliquidations)
|
|
41
|
+
* [GET /api/v3/wallet/m/liquidation](#get-apiv3walletmliquidation)
|
|
42
|
+
* [GET /api/v3/wallet/m/interests](#get-apiv3walletminterests)
|
|
43
|
+
* [Convert](#convert)
|
|
44
|
+
* [GET /api/v3/converts](#get-apiv3converts)
|
|
45
|
+
* [GET /api/v3/convert](#get-apiv3convert)
|
|
46
|
+
* [POST /api/v3/convert](#post-apiv3convert)
|
|
47
|
+
* [Order](#order)
|
|
48
|
+
* [GET /api/v3/wallet/{wallet_type}/orders/open](#get-apiv3walletwallet_typeordersopen)
|
|
49
|
+
* [GET /api/v3/wallet/{wallet_type}/orders/closed](#get-apiv3walletwallet_typeordersclosed)
|
|
50
|
+
* [GET /api/v3/wallet/{wallet_type}/orders/history](#get-apiv3walletwallet_typeordershistory)
|
|
51
|
+
* [POST /api/v3/wallet/{wallet_type}/order](#post-apiv3walletwallet_typeorder)
|
|
52
|
+
* [GET /api/v3/order](#get-apiv3order)
|
|
53
|
+
* [DELETE /api/v3/wallet/{wallet_type}/order](#delete-apiv3walletwallet_typeorder)
|
|
54
|
+
* [DELETE /api/v3/order](#delete-apiv3order)
|
|
55
|
+
* [Trade](#trade)
|
|
56
|
+
* [GET /api/v3/order/trades](#get-apiv3ordertrades)
|
|
57
|
+
* [GET /api/v3/wallet/{path_wallet_type}/trades](#get-apiv3walletpath_wallet_typetrades)
|
|
58
|
+
* [Deposit](#deposit)
|
|
59
|
+
* [GET /api/v3/deposit_address](#get-apiv3deposit_address)
|
|
60
|
+
* [GET /api/v3/deposits](#get-apiv3deposits)
|
|
61
|
+
* [GET /api/v3/deposit](#get-apiv3deposit)
|
|
62
|
+
* [Withdraw](#withdraw)
|
|
63
|
+
* [GET /api/v3/withdraw_addresses](#get-apiv3withdraw_addresses)
|
|
64
|
+
* [GET /api/v3/withdrawals](#get-apiv3withdrawals)
|
|
65
|
+
* [GET /api/v3/withdrawal](#get-apiv3withdrawal)
|
|
66
|
+
* [POST /api/v3/withdrawal](#post-apiv3withdrawal)
|
|
67
|
+
* [POST /api/v3/withdrawal/twd](#post-apiv3withdrawaltwd)
|
|
68
|
+
* [Internal Transfer](#internal-transfer)
|
|
69
|
+
* [GET /api/v3/internal_transfers](#get-apiv3internal_transfers)
|
|
70
|
+
* [Reward](#reward)
|
|
71
|
+
* [GET /api/v3/rewards](#get-apiv3rewards)
|
|
72
|
+
* [SubAccount](#subaccount)
|
|
73
|
+
* [GET /api/v3/sub_accounts](#get-apiv3sub_accounts)
|
|
74
|
+
* [GET /api/v3/sub_account](#get-apiv3sub_account)
|
|
75
|
+
* [POST /api/v3/sub_accounts](#post-apiv3sub_accounts)
|
|
76
|
+
* [PUT /api/v3/sub_account](#put-apiv3sub_account)
|
|
77
|
+
* [DELETE /api/v3/sub_account](#delete-apiv3sub_account)
|
|
78
|
+
* [POST /api/v3/sub_account/transfer](#post-apiv3sub_accounttransfer)
|
|
79
|
+
<!-- TOC -->
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
```rb
|
|
84
|
+
@public_v3_api = MaxExchangeApi::PublicV3Api.new
|
|
85
|
+
@public_v3_api.depth('usdttwd')
|
|
86
|
+
|
|
87
|
+
access_key, secret_key = File.read('secret').split(',')
|
|
88
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
89
|
+
@private_v3_api.create_order!('usdttwd', 'sell', 1000, price: 31.35)
|
|
90
|
+
@private_v3_api.create_order!('usdttwd', 'buy', 1000, price: 31.15)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
### Set timeout time
|
|
96
|
+
|
|
97
|
+
```rb
|
|
98
|
+
# Set default timeout time
|
|
99
|
+
MaxExchangeApi.default_config.timeout = 3 # seconds
|
|
100
|
+
|
|
101
|
+
# Create an api instance with custom timeout time
|
|
102
|
+
api = MaxExchangeApi::PublicV3Api.new(config: { timeout: 12 })
|
|
103
|
+
api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key, config: { timeout: 12 })
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Logging
|
|
107
|
+
|
|
108
|
+
```rb
|
|
109
|
+
require 'logger'
|
|
110
|
+
|
|
111
|
+
# Print log to standard output
|
|
112
|
+
MaxExchangeApi.default_config.logger = Logger.new(STDOUT)
|
|
113
|
+
|
|
114
|
+
# Print log to file
|
|
115
|
+
MaxExchangeApi.default_config.logger = Logger.new('log/api.log')
|
|
116
|
+
|
|
117
|
+
# Create an api instance with custom logger
|
|
118
|
+
api = MaxExchangeApi::PublicV3Api.new(config: { logger: Logger.new(STDOUT) })
|
|
119
|
+
api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key, config: { logger: Logger.new(STDOUT) })
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Switch Sub-Account
|
|
123
|
+
|
|
124
|
+
```rb
|
|
125
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
126
|
+
|
|
127
|
+
# Switch to a specific sub-account (e.g., 's1-a7f20f')
|
|
128
|
+
@private_v3_api.current_sub_account_sn = 's1-a7f20f'
|
|
129
|
+
|
|
130
|
+
# Use the default sub-account (determined by the API token owner)
|
|
131
|
+
@private_v3_api.current_sub_account_sn = nil
|
|
132
|
+
|
|
133
|
+
# Switch to the main account
|
|
134
|
+
@private_v3_api.current_sub_account_sn = 'main'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Public V3 Api Examples
|
|
138
|
+
|
|
139
|
+
```rb
|
|
140
|
+
@public_v3_api = MaxExchangeApi::PublicV3Api.new
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### [GET /api/v3/wallet/m/index_prices](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMIndexPrices)
|
|
144
|
+
|
|
145
|
+
> Get latest index prices of m-wallet
|
|
146
|
+
|
|
147
|
+
```rb
|
|
148
|
+
@public_v3_api.index_prices
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### [GET /api/v3/wallet/m/historical_index_prices](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMHistoricalIndexPrices)
|
|
152
|
+
|
|
153
|
+
> Get latest historical index prices
|
|
154
|
+
|
|
155
|
+
```rb
|
|
156
|
+
@public_v3_api.index_prices_histories
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### [GET /api/v3/wallet/m/limits](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMLimits)
|
|
160
|
+
|
|
161
|
+
> Get total available loan amount
|
|
162
|
+
|
|
163
|
+
```rb
|
|
164
|
+
@public_v3_api.available_loan_amount
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### [GET /api/v3/wallet/m/interest_rates](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMInterestRates)
|
|
168
|
+
|
|
169
|
+
> Get latest interest rates of m-wallet
|
|
170
|
+
|
|
171
|
+
```rb
|
|
172
|
+
@public_v3_api.loan_interest_rates
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### [GET /api/v3/markets](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Markets)
|
|
176
|
+
|
|
177
|
+
> Get all available markets.
|
|
178
|
+
|
|
179
|
+
```rb
|
|
180
|
+
@public_v3_api.markets
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### [GET /api/v3/currencies](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Currencies)
|
|
184
|
+
|
|
185
|
+
> Get all available currencies
|
|
186
|
+
|
|
187
|
+
```rb
|
|
188
|
+
@public_v3_api.currencies
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### [GET /api/v3/timestamp](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Timestamp)
|
|
192
|
+
|
|
193
|
+
> Get server current time, in seconds since Unix epoch
|
|
194
|
+
|
|
195
|
+
```rb
|
|
196
|
+
@public_v3_api.timestamp
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### [GET /api/v3/k](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3K)
|
|
200
|
+
|
|
201
|
+
> Get OHLC(k line) of a specific market.
|
|
202
|
+
|
|
203
|
+
```rb
|
|
204
|
+
# use default parameters
|
|
205
|
+
@private_v3_api.k('btctwd')
|
|
206
|
+
|
|
207
|
+
# provide all possible parameters
|
|
208
|
+
@private_v3_api.k('btctwd', limit: 30, period: 1, timestamp: 1624705402)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### [GET /api/v3/depth](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Depth)
|
|
212
|
+
|
|
213
|
+
> Get depth of a specified market.
|
|
214
|
+
|
|
215
|
+
```rb
|
|
216
|
+
# use default parameters
|
|
217
|
+
@private_v3_api.depth('maxtwd')
|
|
218
|
+
|
|
219
|
+
# provide all possible parameters
|
|
220
|
+
@private_v3_api.depth('maxtwd', limit: 10, sort_by_price: true)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### [GET /api/v3/trades](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Trades)
|
|
224
|
+
|
|
225
|
+
> Get recent trades on market, sorted in reverse creation order.
|
|
226
|
+
|
|
227
|
+
```rb
|
|
228
|
+
# use default parameters
|
|
229
|
+
@private_v3_api.trades('btctwd')
|
|
230
|
+
|
|
231
|
+
# provide all possible parameters
|
|
232
|
+
@private_v3_api.trades(
|
|
233
|
+
'maxtwd',
|
|
234
|
+
timestamp: 1624705402,
|
|
235
|
+
limit: 15,
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### [GET /api/v3/tickers](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Tickers)
|
|
240
|
+
|
|
241
|
+
> Get ticker of all markets.
|
|
242
|
+
|
|
243
|
+
```rb
|
|
244
|
+
@private_v3_api.tickers
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### [GET /api/v3/ticker](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Ticker)
|
|
248
|
+
|
|
249
|
+
> Get ticker of specific market.
|
|
250
|
+
|
|
251
|
+
```rb
|
|
252
|
+
@private_v3_api.ticker('btctwd')
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Private V3 Api Examples
|
|
258
|
+
|
|
259
|
+
```rb
|
|
260
|
+
access_key = 'YOUR_ACCESS_KEY'
|
|
261
|
+
secret_key = 'YOUR_SECRET_KEY'
|
|
262
|
+
|
|
263
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### User
|
|
267
|
+
#### [GET /api/v3/info](https://max-api.maicoin.com/doc/v3.html#tag/User/operation/getApiV3Info)
|
|
268
|
+
|
|
269
|
+
> Get user information
|
|
270
|
+
|
|
271
|
+
```rb
|
|
272
|
+
@private_v3_api.member_info
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Account
|
|
276
|
+
#### [GET /api/v3/wallet/{wallet_type}/accounts](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletPathWalletTypeAccounts)
|
|
277
|
+
|
|
278
|
+
> Get your account balance with all supported currencies by different wallet type
|
|
279
|
+
|
|
280
|
+
```rb
|
|
281
|
+
@private_v3_api.accounts
|
|
282
|
+
|
|
283
|
+
# provide all possible parameters
|
|
284
|
+
@private_v3_api.accounts(wallet_type: 'm', currency: 'usdt')
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### M-Wallet
|
|
288
|
+
#### [GET /api/v3/wallet/m/ad_ratio](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMAdRatio)
|
|
289
|
+
|
|
290
|
+
> Get the latest AD ratio of your m-wallet
|
|
291
|
+
|
|
292
|
+
```rb
|
|
293
|
+
@private_v3_api.m_wallet_ad_ratio
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### [POST /api/v3/wallet/m/loan](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/postApiV3WalletMLoan)
|
|
297
|
+
|
|
298
|
+
> Create a loan request for your m-wallet
|
|
299
|
+
|
|
300
|
+
```rb
|
|
301
|
+
@private_v3_api.m_wallet_loan!('30000', 'usdt')
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### [POST /api/v3/wallet/m/repayment](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/postApiV3WalletMRepayment)
|
|
305
|
+
|
|
306
|
+
> Make a repayment for your loan
|
|
307
|
+
|
|
308
|
+
```rb
|
|
309
|
+
@private_v3_api.m_wallet_repay!('30000', 'usdt')
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### [GET /api/v3/wallet/m/loans](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLoans)
|
|
313
|
+
|
|
314
|
+
> Get loan history of your m-wallet
|
|
315
|
+
|
|
316
|
+
```rb
|
|
317
|
+
@private_v3_api.m_wallet_loans('usdt')
|
|
318
|
+
|
|
319
|
+
# provide all possible parameters
|
|
320
|
+
@private_v3_api.m_wallet_loans(
|
|
321
|
+
'usdt',
|
|
322
|
+
timestamp: 1624705402,
|
|
323
|
+
order_by: 'asc',
|
|
324
|
+
limit: 15,
|
|
325
|
+
)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### [GET /api/v3/wallet/m/repayments](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMRepayments)
|
|
329
|
+
|
|
330
|
+
> Get repayment history of your m-wallet
|
|
331
|
+
|
|
332
|
+
```rb
|
|
333
|
+
@private_v3_api.m_wallet_repayments('usdt')
|
|
334
|
+
|
|
335
|
+
# provide all possible parameters
|
|
336
|
+
@private_v3_api.m_wallet_repayments(
|
|
337
|
+
'usdt',
|
|
338
|
+
timestamp: 1624705402,
|
|
339
|
+
order_by: 'asc',
|
|
340
|
+
limit: 15,
|
|
341
|
+
)
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### [GET /api/v3/wallet/m/liquidations](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLiquidations)
|
|
345
|
+
|
|
346
|
+
> Get liquidation history of your m-wallet
|
|
347
|
+
|
|
348
|
+
```rb
|
|
349
|
+
@private_v3_api.m_wallet_liquidations
|
|
350
|
+
|
|
351
|
+
# provide all possible parameters
|
|
352
|
+
@private_v3_api.m_wallet_liquidations(
|
|
353
|
+
timestamp: 1624705402,
|
|
354
|
+
order_by: 'asc',
|
|
355
|
+
limit: 15,
|
|
356
|
+
)
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### [GET /api/v3/wallet/m/liquidation](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLiquidation)
|
|
360
|
+
|
|
361
|
+
> Get detail of one specific liquidation history of your m-wallet
|
|
362
|
+
|
|
363
|
+
```rb
|
|
364
|
+
@private_v3_api.m_wallet_liquidation('210407080800050666')
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
#### [GET /api/v3/wallet/m/interests](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMInterests)
|
|
368
|
+
|
|
369
|
+
> Get interest history of your m-wallet
|
|
370
|
+
|
|
371
|
+
```rb
|
|
372
|
+
@private_v3_api.m_wallet_interests('usdt')
|
|
373
|
+
|
|
374
|
+
# provide all possible parameters
|
|
375
|
+
@private_v3_api.m_wallet_interests(
|
|
376
|
+
'usdt',
|
|
377
|
+
timestamp: 1624705402,
|
|
378
|
+
order_by: 'asc',
|
|
379
|
+
limit: 15,
|
|
380
|
+
)
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Convert
|
|
384
|
+
#### [GET /api/v3/converts](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/getApiV3Converts)
|
|
385
|
+
|
|
386
|
+
> Get convert orders history
|
|
387
|
+
|
|
388
|
+
```rb
|
|
389
|
+
@private_v3_api.convert_orders
|
|
390
|
+
|
|
391
|
+
# provide all possible parameters
|
|
392
|
+
@private_v3_api.convert_orders(
|
|
393
|
+
timestamp: 1624705402,
|
|
394
|
+
order_by: 'asc',
|
|
395
|
+
limit: 15,
|
|
396
|
+
)
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
#### [GET /api/v3/convert](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/getApiV3Convert)
|
|
400
|
+
|
|
401
|
+
> Get details of a specific convert order
|
|
402
|
+
|
|
403
|
+
```rb
|
|
404
|
+
@private_v3_api.convert_order('6322d9bd-736b-4f19-b862-829e75cae1ce')
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
#### [POST /api/v3/convert](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/postApiV3Convert)
|
|
408
|
+
|
|
409
|
+
> Execute a convert (flash exchange) between two currencies
|
|
410
|
+
|
|
411
|
+
```rb
|
|
412
|
+
# Specify from amount
|
|
413
|
+
@private_v3_api.create_convert_order(
|
|
414
|
+
from: ['0.52', 'usdt'],
|
|
415
|
+
to: [nil, 'twd'],
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
# Specify to amount
|
|
419
|
+
@private_v3_api.create_convert_order(
|
|
420
|
+
from: [nil, 'usdt'],
|
|
421
|
+
to: ['16.58', 'twd'],
|
|
422
|
+
)
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Order
|
|
426
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/open](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersOpen)
|
|
427
|
+
|
|
428
|
+
> Get open orders.
|
|
429
|
+
|
|
430
|
+
```rb
|
|
431
|
+
# use default parameters
|
|
432
|
+
@private_v3_api.open_orders('maxtwd')
|
|
433
|
+
|
|
434
|
+
# provide all possible parameters
|
|
435
|
+
@private_v3_api.open_orders(
|
|
436
|
+
'maxtwd',
|
|
437
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
438
|
+
timestamp: 1773734452000,
|
|
439
|
+
order_by: 'desc',
|
|
440
|
+
limit: 15,
|
|
441
|
+
)
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/closed](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersClosed)
|
|
445
|
+
|
|
446
|
+
> Get closed orders.
|
|
447
|
+
|
|
448
|
+
```rb
|
|
449
|
+
# use default parameters
|
|
450
|
+
@private_v3_api.closed_orders('maxtwd')
|
|
451
|
+
|
|
452
|
+
# provide all possible parameters
|
|
453
|
+
@private_v3_api.closed_orders(
|
|
454
|
+
'maxtwd',
|
|
455
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
456
|
+
timestamp: 1773734452000,
|
|
457
|
+
order_by: 'desc',
|
|
458
|
+
limit: 15,
|
|
459
|
+
)
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/history](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersHistory)
|
|
463
|
+
|
|
464
|
+
> Get order history in ascending order from a specific from_id.
|
|
465
|
+
|
|
466
|
+
```rb
|
|
467
|
+
# use default parameters
|
|
468
|
+
@private_v3_api.order_history('maxtwd')
|
|
469
|
+
|
|
470
|
+
# provide all possible parameters
|
|
471
|
+
@private_v3_api.orders_history(
|
|
472
|
+
'maxtwd',
|
|
473
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
474
|
+
from_id: 123456,
|
|
475
|
+
limit: 15,
|
|
476
|
+
)
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
#### [POST /api/v3/wallet/{wallet_type}/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/postApiV3WalletPathWalletTypeOrder)
|
|
480
|
+
|
|
481
|
+
> Create sell/buy order
|
|
482
|
+
|
|
483
|
+
```rb
|
|
484
|
+
# use default parameters
|
|
485
|
+
@private_v3_api.create_order!('maxtwd', 'buy', 1000, price: 7.5)
|
|
486
|
+
|
|
487
|
+
# provide all possible parameters
|
|
488
|
+
@private_v3_api.create_order!(
|
|
489
|
+
'maxtwd',
|
|
490
|
+
'buy',
|
|
491
|
+
1000,
|
|
492
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
493
|
+
price: 7.5,
|
|
494
|
+
client_oid: 'MY_ORDER_ID_12345',
|
|
495
|
+
stop_price: 8,
|
|
496
|
+
ord_type: 'limit',
|
|
497
|
+
group_id: 12345678,
|
|
498
|
+
)
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
#### [GET /api/v3/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3Order)
|
|
502
|
+
|
|
503
|
+
> Get order detail
|
|
504
|
+
|
|
505
|
+
```rb
|
|
506
|
+
# use default parameters
|
|
507
|
+
# use max unique order id
|
|
508
|
+
@private_v3_api.order(123456)
|
|
509
|
+
|
|
510
|
+
# use user specified order id
|
|
511
|
+
@private_v3_api.order(client_oid: 'MY_ORDER_123456')
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
#### [DELETE /api/v3/wallet/{wallet_type}/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/deleteApiV3WalletPathWalletTypeOrders)
|
|
515
|
+
|
|
516
|
+
> Cancel all orders
|
|
517
|
+
|
|
518
|
+
```rb
|
|
519
|
+
# use default parameters
|
|
520
|
+
@private_v3_api.cancel_orders!
|
|
521
|
+
|
|
522
|
+
# provide all possible parameters
|
|
523
|
+
@private_v3_api.cancel_orders!(
|
|
524
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
525
|
+
market: 'maxtwd',
|
|
526
|
+
side: 'sell',
|
|
527
|
+
group_id: '123456',
|
|
528
|
+
)
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
#### [DELETE /api/v3/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/deleteApiV3Order)
|
|
532
|
+
|
|
533
|
+
> Cancel an order
|
|
534
|
+
|
|
535
|
+
```rb
|
|
536
|
+
# use max unique order id
|
|
537
|
+
@private_v3_api.cancel_order!(123456)
|
|
538
|
+
|
|
539
|
+
# use user specified order id
|
|
540
|
+
@private_v3_api.cancel_order!(client_oid: 'MY_ORDER_123456')
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Trade
|
|
544
|
+
#### [GET /api/v3/order/trades](https://max-api.maicoin.com/doc/v3.html#tag/Trade/operation/getApiV3OrderTrades)
|
|
545
|
+
|
|
546
|
+
> Get trade detail by your order info
|
|
547
|
+
|
|
548
|
+
```rb
|
|
549
|
+
# use max unique order id
|
|
550
|
+
@private_v3_api.my_trades_of_order(123456)
|
|
551
|
+
|
|
552
|
+
# use user specified order id
|
|
553
|
+
@private_v3_api.my_trades_of_order(client_oid: 'MY_ORDER_123456')
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
#### [GET /api/v3/wallet/{path_wallet_type}/trades](https://max-api.maicoin.com/doc/v3.html#tag/Trade/operation/getApiV3WalletPathWalletTypeTrades)
|
|
557
|
+
|
|
558
|
+
> Get executed trades
|
|
559
|
+
|
|
560
|
+
```rb
|
|
561
|
+
# use default parameters
|
|
562
|
+
@private_v3_api.my_trades
|
|
563
|
+
|
|
564
|
+
# provide all possible parameters
|
|
565
|
+
@private_v3_api.my_trades(
|
|
566
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
567
|
+
market: 'maxtwd',
|
|
568
|
+
timestamp: 1624705402,
|
|
569
|
+
from_id: 68444,
|
|
570
|
+
order_by: 'asc',
|
|
571
|
+
limit: 15,
|
|
572
|
+
)
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Deposit
|
|
576
|
+
#### [GET /api/v3/deposit_address](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3DepositAddress)
|
|
577
|
+
|
|
578
|
+
> Get user deposit address by currency version
|
|
579
|
+
|
|
580
|
+
```rb
|
|
581
|
+
@private_v3_api.deposit_address('bscusdt')
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
#### [GET /api/v3/deposits](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Deposits)
|
|
585
|
+
|
|
586
|
+
> get your deposits history
|
|
587
|
+
|
|
588
|
+
```rb
|
|
589
|
+
# use default parameters
|
|
590
|
+
@private_v3_api.deposits
|
|
591
|
+
|
|
592
|
+
# provide all possible parameters
|
|
593
|
+
@private_v3_api.deposits(
|
|
594
|
+
currency: 'max',
|
|
595
|
+
timestamp: 1624705402,
|
|
596
|
+
order_by: 'asc',
|
|
597
|
+
limit: 15,
|
|
598
|
+
)
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
#### [GET /api/v3/deposit](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Deposit)
|
|
602
|
+
|
|
603
|
+
> Get details of a specific deposit
|
|
604
|
+
|
|
605
|
+
```rb
|
|
606
|
+
# Query by uuid
|
|
607
|
+
@private_v3_api.deposit(uuid: '18022603540001')
|
|
608
|
+
|
|
609
|
+
# Query by txid
|
|
610
|
+
@private_v3_api.deposit(txid: '0x8daa98e07886985bd6a142cd81b83582d6085f7eb931dc4984c18c84f2a845e0')
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Withdraw
|
|
614
|
+
#### [GET /api/v3/withdraw_addresses](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WithdrawAddresses)
|
|
615
|
+
|
|
616
|
+
> Get withdraw addresses of spot wallet
|
|
617
|
+
|
|
618
|
+
```rb
|
|
619
|
+
@private_v3_api.withdraw_addresses('usdt')
|
|
620
|
+
|
|
621
|
+
# provide all possible parameters
|
|
622
|
+
@private_v3_api.withdraw_addresses('usdt', limit: 10, offset: 5)
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
#### [GET /api/v3/withdrawals](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Withdrawals)
|
|
626
|
+
|
|
627
|
+
> Get external withdrawals history
|
|
628
|
+
|
|
629
|
+
```rb
|
|
630
|
+
# use default parameters
|
|
631
|
+
@private_v3_api.withdraws
|
|
632
|
+
|
|
633
|
+
# provide all possible parameters
|
|
634
|
+
@private_v3_api.withdraws(
|
|
635
|
+
currency: 'max',
|
|
636
|
+
state: 'done',
|
|
637
|
+
timestamp: 1624705402,
|
|
638
|
+
order_by: 'asc',
|
|
639
|
+
limit: 15,
|
|
640
|
+
)
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
#### [GET /api/v3/withdrawal](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Withdrawal)
|
|
644
|
+
|
|
645
|
+
> Get details of a specific external withdraw
|
|
646
|
+
|
|
647
|
+
```rb
|
|
648
|
+
# Query by uuid
|
|
649
|
+
@private_v3_api.withdraw(uuid: '18022603540001')
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
#### [POST /api/v3/withdrawal](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3Withdrawal)
|
|
653
|
+
|
|
654
|
+
> Submit a crypto withdrawal. IP whitelist for api token is required.
|
|
655
|
+
|
|
656
|
+
```rb
|
|
657
|
+
@private_v3_api.create_withdraw!('withdraw_address_id', 100000)
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
#### [POST /api/v3/withdrawal/twd](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3WithdrawalTwd)
|
|
661
|
+
|
|
662
|
+
> Submit twd withdrawal to verified bank account. IP whitelist for api token is required.
|
|
663
|
+
|
|
664
|
+
```rb
|
|
665
|
+
@private_v3_api.create_twd_withdraw!(100000)
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Internal Transfer
|
|
669
|
+
#### [GET /api/v3/internal_transfers](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3InternalTransfers)
|
|
670
|
+
|
|
671
|
+
> Get internal transfers history
|
|
672
|
+
|
|
673
|
+
```rb
|
|
674
|
+
# use default parameters
|
|
675
|
+
@private_v3_api.internal_transfers
|
|
676
|
+
|
|
677
|
+
# provide all possible parameters
|
|
678
|
+
@private_v3_api.internal_transfers(
|
|
679
|
+
currency: 'btc',
|
|
680
|
+
side: 'in',
|
|
681
|
+
timestamp: 1624705402,
|
|
682
|
+
order_by: 'asc',
|
|
683
|
+
limit: 15,
|
|
684
|
+
)
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### Reward
|
|
688
|
+
#### [GET /api/v3/rewards](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Rewards)
|
|
689
|
+
|
|
690
|
+
> Get internal transfers history
|
|
691
|
+
|
|
692
|
+
```rb
|
|
693
|
+
# use default parameters
|
|
694
|
+
@private_v3_api.rewards
|
|
695
|
+
|
|
696
|
+
# provide all possible parameters
|
|
697
|
+
@private_v3_api.rewards(
|
|
698
|
+
currency: 'btc',
|
|
699
|
+
reward_type: 'yield',
|
|
700
|
+
timestamp: 1624705402,
|
|
701
|
+
order_by: 'asc',
|
|
702
|
+
limit: 15,
|
|
703
|
+
)
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
### SubAccount
|
|
707
|
+
#### [GET /api/v3/sub_accounts](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3SubAccounts)
|
|
708
|
+
|
|
709
|
+
> Get sub_accounts
|
|
710
|
+
|
|
711
|
+
```rb
|
|
712
|
+
@private_v3_api.sub_accounts
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
#### [GET /api/v3/sub_account](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3SubAccount)
|
|
716
|
+
|
|
717
|
+
> Get sub_account
|
|
718
|
+
|
|
719
|
+
```rb
|
|
720
|
+
@private_v3_api.sub_account('s1-a7f20f')
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
#### [POST /api/v3/sub_accounts](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3SubAccounts)
|
|
724
|
+
|
|
725
|
+
> Create sub_account
|
|
726
|
+
|
|
727
|
+
```rb
|
|
728
|
+
@private_v3_api.create_sub_account!(name: 'My Test SubAccount')
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
#### [PUT /api/v3/sub_account](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/putApiV3SubAccount)
|
|
732
|
+
|
|
733
|
+
> Update sub_account
|
|
734
|
+
|
|
735
|
+
```rb
|
|
736
|
+
@private_v3_api.update_sub_account!('s1-a7f20f', name: 'My Test SubAccount')
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
#### [DELETE /api/v3/sub_account](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/deleteApiV3SubAccount)
|
|
740
|
+
|
|
741
|
+
> Delete sub_account
|
|
742
|
+
|
|
743
|
+
```rb
|
|
744
|
+
@private_v3_api.delete_sub_account!('s1-a7f20f')
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
#### [POST /api/v3/sub_account/transfer](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/postApiV3SubAccountTransfer)
|
|
748
|
+
|
|
749
|
+
> Submit sub_account transfer
|
|
750
|
+
|
|
751
|
+
```rb
|
|
752
|
+
# Transfer from main to s1 sub-account
|
|
753
|
+
@private_v3_api.current_sub_account_sn = 'main'
|
|
754
|
+
@private_v3_api.create_sub_account_transfer!('s1-a7f20f', 3, 'eth')
|
|
755
|
+
|
|
756
|
+
# Transfer from s1 sub-account to s2 sub-account
|
|
757
|
+
@private_v3_api.current_sub_account_sn = 's1-a7f20f'
|
|
758
|
+
@private_v3_api.create_sub_account_transfer!('s2-jsjwsa', 3, 'eth')
|
|
759
|
+
```
|