max_exchange_api 1.3.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/.github/workflows/ruby.yml +43 -46
- data/.gitignore +62 -62
- data/.rubocop.yml +1227 -1227
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +49 -49
- data/LICENSE +21 -21
- data/README.md +993 -368
- data/Rakefile +10 -10
- data/bin/console +14 -14
- data/bin/setup +0 -0
- data/gemfiles/2.2.gemfile +11 -0
- data/gemfiles/Gemfile +10 -10
- data/lib/max_exchange_api/base_api.rb +52 -52
- data/lib/max_exchange_api/config.rb +26 -26
- data/lib/max_exchange_api/helper.rb +9 -2
- data/lib/max_exchange_api/private_api.rb +4 -218
- 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 +26 -0
- 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 +32 -0
- data/lib/max_exchange_api/public_api.rb +13 -72
- data/lib/max_exchange_api/public_v2_api.rb +65 -0
- data/lib/max_exchange_api/public_v3_api.rb +69 -0
- data/lib/max_exchange_api/version.rb +3 -3
- data/lib/max_exchange_api.rb +4 -2
- data/max_exchange_api.gemspec +42 -43
- metadata +28 -21
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MAX Exchange API Ruby SDK
|
|
2
2
|
|
|
3
3
|
[](http://rubygems.org/gems/max_exchange_api)
|
|
4
4
|
[](https://github.com/khiav223577/max_exchange_api/actions)
|
|
@@ -14,12 +14,141 @@ 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
|
-
- Ruby 2.2 ~ 2.7, 3.0
|
|
22
|
+
- Ruby 2.2 ~ 2.7, 3.0 ~ 3.3
|
|
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 -->
|
|
23
152
|
|
|
24
153
|
## Installation
|
|
25
154
|
|
|
@@ -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,594 +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
|
|
209
|
+
|
|
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
|
+
```
|
|
68
222
|
|
|
69
|
-
|
|
223
|
+
## Public V3 Api Examples
|
|
70
224
|
|
|
71
225
|
```rb
|
|
72
|
-
@
|
|
226
|
+
@public_v3_api = MaxExchangeApi::PublicV3Api.new
|
|
73
227
|
```
|
|
74
228
|
|
|
75
|
-
#### [GET /api/
|
|
229
|
+
#### [GET /api/v3/wallet/m/index_prices](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMIndexPrices)
|
|
76
230
|
|
|
77
|
-
> Get
|
|
231
|
+
> Get latest index prices of m-wallet
|
|
78
232
|
|
|
79
|
-
<details>
|
|
80
|
-
<summary>Show code</summary>
|
|
81
|
-
|
|
82
233
|
```rb
|
|
83
|
-
@
|
|
234
|
+
@public_v3_api.index_prices
|
|
84
235
|
```
|
|
85
|
-
</details>
|
|
86
236
|
|
|
87
|
-
#### [GET /api/
|
|
237
|
+
#### [GET /api/v3/wallet/m/historical_index_prices](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMHistoricalIndexPrices)
|
|
88
238
|
|
|
89
|
-
> Get
|
|
239
|
+
> Get latest historical index prices
|
|
90
240
|
|
|
91
|
-
<details>
|
|
92
|
-
<summary>Show code</summary>
|
|
93
|
-
|
|
94
241
|
```rb
|
|
95
|
-
@
|
|
242
|
+
@public_v3_api.index_prices_histories
|
|
96
243
|
```
|
|
97
|
-
</details>
|
|
98
244
|
|
|
99
|
-
#### [GET /api/
|
|
245
|
+
#### [GET /api/v3/wallet/m/limits](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3WalletMLimits)
|
|
100
246
|
|
|
101
|
-
> 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
|
|
102
272
|
|
|
103
|
-
<details>
|
|
104
|
-
<summary>Show code</summary>
|
|
105
|
-
|
|
106
273
|
```rb
|
|
107
|
-
@
|
|
274
|
+
@public_v3_api.currencies
|
|
108
275
|
```
|
|
109
|
-
</details>
|
|
110
276
|
|
|
111
|
-
#### [GET /api/
|
|
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
|
|
280
|
+
|
|
281
|
+
```rb
|
|
282
|
+
@public_v3_api.timestamp
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### [GET /api/v3/k](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3K)
|
|
112
286
|
|
|
113
287
|
> Get OHLC(k line) of a specific market.
|
|
114
288
|
|
|
115
|
-
<details>
|
|
116
|
-
<summary>Show code</summary>
|
|
117
|
-
|
|
118
289
|
```rb
|
|
119
290
|
# use default parameters
|
|
120
|
-
@
|
|
291
|
+
@private_v3_api.k('btctwd')
|
|
121
292
|
|
|
122
293
|
# provide all possible parameters
|
|
123
|
-
@
|
|
294
|
+
@private_v3_api.k('btctwd', limit: 30, period: 1, timestamp: 1624705402)
|
|
124
295
|
```
|
|
125
|
-
</details>
|
|
126
296
|
|
|
127
|
-
#### [GET /api/
|
|
297
|
+
#### [GET /api/v3/depth](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Depth)
|
|
128
298
|
|
|
129
299
|
> Get depth of a specified market.
|
|
130
300
|
|
|
131
|
-
<details>
|
|
132
|
-
<summary>Show code</summary>
|
|
133
|
-
|
|
134
301
|
```rb
|
|
135
302
|
# use default parameters
|
|
136
|
-
@
|
|
303
|
+
@private_v3_api.depth('maxtwd')
|
|
137
304
|
|
|
138
305
|
# provide all possible parameters
|
|
139
|
-
@
|
|
306
|
+
@private_v3_api.depth('maxtwd', limit: 10, sort_by_price: true)
|
|
140
307
|
```
|
|
141
|
-
</details>
|
|
142
308
|
|
|
143
|
-
#### [GET /api/
|
|
309
|
+
#### [GET /api/v3/trades](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Trades)
|
|
144
310
|
|
|
145
311
|
> Get recent trades on market, sorted in reverse creation order.
|
|
146
312
|
|
|
147
|
-
<details>
|
|
148
|
-
<summary>Show code</summary>
|
|
149
|
-
|
|
150
313
|
```rb
|
|
151
314
|
# use default parameters
|
|
152
|
-
@
|
|
315
|
+
@private_v3_api.trades('btctwd')
|
|
153
316
|
|
|
154
317
|
# provide all possible parameters
|
|
155
|
-
@
|
|
318
|
+
@private_v3_api.trades(
|
|
156
319
|
'maxtwd',
|
|
157
320
|
timestamp: 1624705402,
|
|
158
|
-
from: 68444,
|
|
159
|
-
to: 69444,
|
|
160
|
-
order_by: 'asc',
|
|
161
|
-
pagination: true,
|
|
162
|
-
page: 3,
|
|
163
321
|
limit: 15,
|
|
164
|
-
offset: 5,
|
|
165
322
|
)
|
|
166
323
|
```
|
|
167
|
-
</details>
|
|
168
324
|
|
|
169
|
-
#### [GET /api/
|
|
325
|
+
#### [GET /api/v3/tickers](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Tickers)
|
|
170
326
|
|
|
171
|
-
> Get all
|
|
327
|
+
> Get ticker of all markets.
|
|
172
328
|
|
|
173
|
-
<details>
|
|
174
|
-
<summary>Show code</summary>
|
|
175
|
-
|
|
176
329
|
```rb
|
|
177
|
-
@
|
|
330
|
+
@private_v3_api.tickers
|
|
178
331
|
```
|
|
179
|
-
</details>
|
|
180
332
|
|
|
181
|
-
#### [GET /api/
|
|
333
|
+
#### [GET /api/v3/ticker](https://max-api.maicoin.com/doc/v3.html#tag/Public/operation/getApiV3Ticker)
|
|
182
334
|
|
|
183
|
-
>
|
|
335
|
+
> Get ticker of specific market.
|
|
184
336
|
|
|
185
|
-
<details>
|
|
186
|
-
<summary>Show code</summary>
|
|
187
|
-
|
|
188
337
|
```rb
|
|
189
|
-
@
|
|
338
|
+
@private_v3_api.ticker('btctwd')
|
|
190
339
|
```
|
|
191
|
-
</details>
|
|
192
340
|
|
|
193
|
-
|
|
341
|
+
---
|
|
194
342
|
|
|
195
|
-
|
|
343
|
+
## Private V3 Api Examples
|
|
196
344
|
|
|
197
|
-
<details>
|
|
198
|
-
<summary>Show code</summary>
|
|
199
|
-
|
|
200
345
|
```rb
|
|
201
|
-
|
|
346
|
+
access_key = 'YOUR_ACCESS_KEY'
|
|
347
|
+
secret_key = 'YOUR_SECRET_KEY'
|
|
348
|
+
|
|
349
|
+
@private_v3_api = MaxExchangeApi::PrivateV3Api.new(access_key, secret_key)
|
|
202
350
|
```
|
|
203
|
-
</details>
|
|
204
351
|
|
|
205
|
-
|
|
352
|
+
### User
|
|
353
|
+
#### [GET /api/v3/info](https://max-api.maicoin.com/doc/v3.html#tag/User/operation/getApiV3Info)
|
|
206
354
|
|
|
207
|
-
> Get
|
|
355
|
+
> Get user information
|
|
208
356
|
|
|
209
|
-
<details>
|
|
210
|
-
<summary>Show code</summary>
|
|
211
|
-
|
|
212
357
|
```rb
|
|
213
|
-
@
|
|
358
|
+
@private_v3_api.member_info
|
|
214
359
|
```
|
|
215
|
-
</details>
|
|
216
360
|
|
|
217
|
-
|
|
361
|
+
### Account
|
|
362
|
+
#### [GET /api/v3/wallet/{wallet_type}/accounts](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletPathWalletTypeAccounts)
|
|
218
363
|
|
|
219
|
-
> Get
|
|
364
|
+
> Get your account balance with all supported currencies by different wallet type
|
|
220
365
|
|
|
221
|
-
<details>
|
|
222
|
-
<summary>Show code</summary>
|
|
223
|
-
|
|
224
366
|
```rb
|
|
225
|
-
@
|
|
367
|
+
@private_v3_api.accounts
|
|
368
|
+
|
|
369
|
+
# provide all possible parameters
|
|
370
|
+
@private_v3_api.accounts(wallet_type: 'm', currency: 'usdt')
|
|
226
371
|
```
|
|
227
|
-
</details>
|
|
228
372
|
|
|
229
|
-
###
|
|
373
|
+
### M-Wallet
|
|
374
|
+
#### [GET /api/v3/wallet/m/ad_ratio](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMAdRatio)
|
|
230
375
|
|
|
231
|
-
|
|
232
|
-
access_key = 'YOUR_ACCESS_KEY'
|
|
233
|
-
secret_key = 'YOUR_SECRET_KEY'
|
|
376
|
+
> Get the latest AD ratio of your m-wallet
|
|
234
377
|
|
|
235
|
-
|
|
378
|
+
```rb
|
|
379
|
+
@private_v3_api.m_wallet_ad_ratio
|
|
236
380
|
```
|
|
237
381
|
|
|
238
|
-
|
|
239
|
-
#### [GET /api/v2/trades/my/of_order](https://max.maicoin.com/documents/api_list#!/private/getApiV2TradesMyOfOrder)
|
|
240
|
-
|
|
241
|
-
> get your executed trades related to a order
|
|
382
|
+
#### [POST /api/v3/wallet/m/loan](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/postApiV3WalletMLoan)
|
|
242
383
|
|
|
243
|
-
|
|
244
|
-
<summary>Show code</summary>
|
|
384
|
+
> Create a loan request for your m-wallet
|
|
245
385
|
|
|
246
386
|
```rb
|
|
247
|
-
|
|
248
|
-
@api.my_trades_of_order(123456)
|
|
249
|
-
|
|
250
|
-
# use user specified order id
|
|
251
|
-
@api.my_trades_of_order('MY_ORDER_123456', use_client_id: true)
|
|
387
|
+
@private_v3_api.m_wallet_loan!('30000', 'usdt')
|
|
252
388
|
```
|
|
253
|
-
</details>
|
|
254
389
|
|
|
255
|
-
#### [
|
|
390
|
+
#### [POST /api/v3/wallet/m/repayment](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/postApiV3WalletMRepayment)
|
|
256
391
|
|
|
257
|
-
>
|
|
392
|
+
> Make a repayment for your loan
|
|
393
|
+
|
|
394
|
+
```rb
|
|
395
|
+
@private_v3_api.m_wallet_repay!('30000', 'usdt')
|
|
396
|
+
```
|
|
258
397
|
|
|
259
|
-
|
|
260
|
-
|
|
398
|
+
#### [GET /api/v3/wallet/m/loans](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLoans)
|
|
399
|
+
|
|
400
|
+
> Get loan history of your m-wallet
|
|
261
401
|
|
|
262
402
|
```rb
|
|
263
|
-
|
|
264
|
-
@api.my_trades('btctwd')
|
|
403
|
+
@private_v3_api.m_wallet_loans('usdt')
|
|
265
404
|
|
|
266
405
|
# provide all possible parameters
|
|
267
|
-
@
|
|
268
|
-
'
|
|
406
|
+
@private_v3_api.m_wallet_loans(
|
|
407
|
+
'usdt',
|
|
269
408
|
timestamp: 1624705402,
|
|
270
|
-
from: 68444,
|
|
271
|
-
to: 69444,
|
|
272
409
|
order_by: 'asc',
|
|
273
|
-
pagination: true,
|
|
274
|
-
page: 3,
|
|
275
410
|
limit: 15,
|
|
276
|
-
offset: 5,
|
|
277
411
|
)
|
|
278
412
|
```
|
|
279
|
-
</details>
|
|
280
|
-
|
|
281
|
-
### Withdrawal
|
|
282
|
-
#### [GET /api/v2/withdrawals](https://max.maicoin.com/documents/api_list#!/private/getApiV2Withdrawals)
|
|
283
413
|
|
|
284
|
-
|
|
414
|
+
#### [GET /api/v3/wallet/m/repayments](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMRepayments)
|
|
285
415
|
|
|
286
|
-
|
|
287
|
-
<summary>Show code</summary>
|
|
416
|
+
> Get repayment history of your m-wallet
|
|
288
417
|
|
|
289
418
|
```rb
|
|
290
|
-
|
|
291
|
-
@api.withdrawals('max')
|
|
419
|
+
@private_v3_api.m_wallet_repayments('usdt')
|
|
292
420
|
|
|
293
421
|
# provide all possible parameters
|
|
294
|
-
@
|
|
295
|
-
'
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
to: 69444,
|
|
299
|
-
state: 'confirmed',
|
|
300
|
-
pagination: true,
|
|
301
|
-
page: 3,
|
|
422
|
+
@private_v3_api.m_wallet_repayments(
|
|
423
|
+
'usdt',
|
|
424
|
+
timestamp: 1624705402,
|
|
425
|
+
order_by: 'asc',
|
|
302
426
|
limit: 15,
|
|
303
|
-
offset: 5,
|
|
304
427
|
)
|
|
305
428
|
```
|
|
306
|
-
</details>
|
|
307
429
|
|
|
308
|
-
#### [GET /api/
|
|
430
|
+
#### [GET /api/v3/wallet/m/liquidations](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLiquidations)
|
|
309
431
|
|
|
310
|
-
>
|
|
311
|
-
|
|
312
|
-
<details>
|
|
313
|
-
<summary>Show code</summary>
|
|
432
|
+
> Get liquidation history of your m-wallet
|
|
314
433
|
|
|
315
434
|
```rb
|
|
316
|
-
@
|
|
317
|
-
```
|
|
318
|
-
</details>
|
|
435
|
+
@private_v3_api.m_wallet_liquidations
|
|
319
436
|
|
|
320
|
-
|
|
437
|
+
# provide all possible parameters
|
|
438
|
+
@private_v3_api.m_wallet_liquidations(
|
|
439
|
+
timestamp: 1624705402,
|
|
440
|
+
order_by: 'asc',
|
|
441
|
+
limit: 15,
|
|
442
|
+
)
|
|
443
|
+
```
|
|
321
444
|
|
|
322
|
-
|
|
445
|
+
#### [GET /api/v3/wallet/m/liquidation](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMLiquidation)
|
|
323
446
|
|
|
324
|
-
|
|
325
|
-
<summary>Show code</summary>
|
|
447
|
+
> Get detail of one specific liquidation history of your m-wallet
|
|
326
448
|
|
|
327
449
|
```rb
|
|
328
|
-
@
|
|
450
|
+
@private_v3_api.m_wallet_liquidation('210407080800050666')
|
|
329
451
|
```
|
|
330
|
-
</details>
|
|
331
452
|
|
|
332
|
-
|
|
333
|
-
#### [GET /api/v2/members/profile](https://max.maicoin.com/documents/api_list#!/private/getApiV2MembersProfile)
|
|
334
|
-
|
|
335
|
-
> get personal profile information
|
|
453
|
+
#### [GET /api/v3/wallet/m/interests](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WalletMInterests)
|
|
336
454
|
|
|
337
|
-
|
|
338
|
-
<summary>Show code</summary>
|
|
455
|
+
> Get interest history of your m-wallet
|
|
339
456
|
|
|
340
457
|
```rb
|
|
341
|
-
@
|
|
342
|
-
```
|
|
343
|
-
</details>
|
|
458
|
+
@private_v3_api.m_wallet_interests('usdt')
|
|
344
459
|
|
|
345
|
-
|
|
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
|
+
```
|
|
346
468
|
|
|
347
|
-
|
|
469
|
+
### Convert
|
|
470
|
+
#### [GET /api/v3/converts](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/getApiV3Converts)
|
|
348
471
|
|
|
349
|
-
|
|
350
|
-
<summary>Show code</summary>
|
|
472
|
+
> Get convert orders history
|
|
351
473
|
|
|
352
474
|
```rb
|
|
353
|
-
@
|
|
354
|
-
```
|
|
355
|
-
</details>
|
|
475
|
+
@private_v3_api.convert_orders
|
|
356
476
|
|
|
357
|
-
|
|
477
|
+
# provide all possible parameters
|
|
478
|
+
@private_v3_api.convert_orders(
|
|
479
|
+
timestamp: 1624705402,
|
|
480
|
+
order_by: 'asc',
|
|
481
|
+
limit: 15,
|
|
482
|
+
)
|
|
483
|
+
```
|
|
358
484
|
|
|
359
|
-
|
|
485
|
+
#### [GET /api/v3/convert](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/getApiV3Convert)
|
|
360
486
|
|
|
361
|
-
|
|
362
|
-
<summary>Show code</summary>
|
|
487
|
+
> Get details of a specific convert order
|
|
363
488
|
|
|
364
489
|
```rb
|
|
365
|
-
@
|
|
490
|
+
@private_v3_api.convert_order('6322d9bd-736b-4f19-b862-829e75cae1ce')
|
|
366
491
|
```
|
|
367
|
-
</details>
|
|
368
492
|
|
|
369
|
-
|
|
370
|
-
#### [GET /api/v2/members/accounts](https://max.maicoin.com/documents/api_list#!/private/getApiV2MembersAccounts)
|
|
371
|
-
|
|
372
|
-
> get personal accounts information
|
|
493
|
+
#### [POST /api/v3/convert](https://max-api.maicoin.com/doc/v3.html#tag/Convert/operation/postApiV3Convert)
|
|
373
494
|
|
|
374
|
-
|
|
375
|
-
<summary>Show code</summary>
|
|
495
|
+
> Execute a convert (flash exchange) between two currencies
|
|
376
496
|
|
|
377
497
|
```rb
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
498
|
+
# Specify from amount
|
|
499
|
+
@private_v3_api.create_convert_order(
|
|
500
|
+
from: ['0.52', 'usdt'],
|
|
501
|
+
to: [nil, 'twd'],
|
|
502
|
+
)
|
|
381
503
|
|
|
382
|
-
|
|
504
|
+
# Specify to amount
|
|
505
|
+
@private_v3_api.create_convert_order(
|
|
506
|
+
from: [nil, 'usdt'],
|
|
507
|
+
to: ['16.58', 'twd'],
|
|
508
|
+
)
|
|
509
|
+
```
|
|
383
510
|
|
|
384
|
-
|
|
511
|
+
### Order
|
|
512
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/open](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersOpen)
|
|
385
513
|
|
|
386
|
-
|
|
387
|
-
<summary>Show code</summary>
|
|
514
|
+
> Get open orders.
|
|
388
515
|
|
|
389
516
|
```rb
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
</details>
|
|
517
|
+
# use default parameters
|
|
518
|
+
@private_v3_api.open_orders('maxtwd')
|
|
393
519
|
|
|
394
|
-
|
|
395
|
-
|
|
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
|
+
```
|
|
396
529
|
|
|
397
|
-
|
|
530
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/closed](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersClosed)
|
|
398
531
|
|
|
399
|
-
|
|
400
|
-
<summary>Show code</summary>
|
|
532
|
+
> Get closed orders.
|
|
401
533
|
|
|
402
534
|
```rb
|
|
403
535
|
# use default parameters
|
|
404
|
-
@
|
|
536
|
+
@private_v3_api.closed_orders('maxtwd')
|
|
405
537
|
|
|
406
538
|
# provide all possible parameters
|
|
407
|
-
@
|
|
408
|
-
'
|
|
409
|
-
'
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
state: 'accepted',
|
|
413
|
-
pagination: true,
|
|
414
|
-
page: 3,
|
|
539
|
+
@private_v3_api.closed_orders(
|
|
540
|
+
'maxtwd',
|
|
541
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
542
|
+
timestamp: 1773734452000,
|
|
543
|
+
order_by: 'desc',
|
|
415
544
|
limit: 15,
|
|
416
|
-
offset: 5,
|
|
417
545
|
)
|
|
418
546
|
```
|
|
419
|
-
</details>
|
|
420
|
-
|
|
421
|
-
#### [GET /api/v2/deposit](https://max.maicoin.com/documents/api_list#!/private/getApiV2Deposit)
|
|
422
547
|
|
|
423
|
-
|
|
548
|
+
#### [GET /api/v3/wallet/{wallet_type}/orders/history](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3WalletPathWalletTypeOrdersHistory)
|
|
424
549
|
|
|
425
|
-
|
|
426
|
-
<summary>Show code</summary>
|
|
550
|
+
> Get order history in ascending order from a specific from_id.
|
|
427
551
|
|
|
428
552
|
```rb
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
</details>
|
|
553
|
+
# use default parameters
|
|
554
|
+
@private_v3_api.order_history('maxtwd')
|
|
432
555
|
|
|
433
|
-
|
|
434
|
-
|
|
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
|
+
```
|
|
435
564
|
|
|
436
|
-
|
|
565
|
+
#### [POST /api/v3/wallet/{wallet_type}/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/postApiV3WalletPathWalletTypeOrder)
|
|
437
566
|
|
|
438
|
-
|
|
439
|
-
<summary>Show code</summary>
|
|
567
|
+
> Create sell/buy order
|
|
440
568
|
|
|
441
569
|
```rb
|
|
442
570
|
# use default parameters
|
|
443
|
-
@
|
|
571
|
+
@private_v3_api.create_order!('maxtwd', 'buy', 1000, price: 7.5)
|
|
444
572
|
|
|
445
573
|
# provide all possible parameters
|
|
446
|
-
@
|
|
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
|
+
)
|
|
447
585
|
```
|
|
448
|
-
</details>
|
|
449
586
|
|
|
450
|
-
#### [
|
|
587
|
+
#### [GET /api/v3/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/getApiV3Order)
|
|
451
588
|
|
|
452
|
-
>
|
|
453
|
-
|
|
454
|
-
<details>
|
|
455
|
-
<summary>Show code</summary>
|
|
589
|
+
> Get order detail
|
|
456
590
|
|
|
457
591
|
```rb
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
592
|
+
# use default parameters
|
|
593
|
+
# use max unique order id
|
|
594
|
+
@private_v3_api.order(123456)
|
|
461
595
|
|
|
462
|
-
|
|
596
|
+
# use user specified order id
|
|
597
|
+
@private_v3_api.order(client_oid: 'MY_ORDER_123456')
|
|
598
|
+
```
|
|
463
599
|
|
|
464
|
-
|
|
600
|
+
#### [DELETE /api/v3/wallet/{wallet_type}/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/deleteApiV3WalletPathWalletTypeOrders)
|
|
465
601
|
|
|
466
|
-
|
|
467
|
-
<summary>Show code</summary>
|
|
602
|
+
> Cancel all orders
|
|
468
603
|
|
|
469
604
|
```rb
|
|
470
605
|
# use default parameters
|
|
471
|
-
@
|
|
606
|
+
@private_v3_api.cancel_orders!
|
|
472
607
|
|
|
473
608
|
# provide all possible parameters
|
|
474
|
-
@
|
|
609
|
+
@private_v3_api.cancel_orders!(
|
|
610
|
+
wallet_type: 'm', # 'spot' or 'm'
|
|
611
|
+
market: 'maxtwd',
|
|
612
|
+
side: 'sell',
|
|
613
|
+
group_id: '123456',
|
|
614
|
+
)
|
|
475
615
|
```
|
|
476
|
-
</details>
|
|
477
|
-
|
|
478
|
-
### Internal Transfer
|
|
479
|
-
#### [GET /api/v2/internal_transfers](https://max.maicoin.com/documents/api_list#!/private/getApiV2InternalTransfers)
|
|
480
616
|
|
|
481
|
-
|
|
617
|
+
#### [DELETE /api/v3/order](https://max-api.maicoin.com/doc/v3.html#tag/Order/operation/deleteApiV3Order)
|
|
482
618
|
|
|
483
|
-
|
|
484
|
-
<summary>Show code</summary>
|
|
619
|
+
> Cancel an order
|
|
485
620
|
|
|
486
621
|
```rb
|
|
487
|
-
# use
|
|
488
|
-
@
|
|
622
|
+
# use max unique order id
|
|
623
|
+
@private_v3_api.cancel_order!(123456)
|
|
489
624
|
|
|
490
|
-
#
|
|
491
|
-
@
|
|
492
|
-
currency: 'btc',
|
|
493
|
-
side: 'in',
|
|
494
|
-
from: 68444,
|
|
495
|
-
to: 69444,
|
|
496
|
-
pagination: true,
|
|
497
|
-
page: 3,
|
|
498
|
-
limit: 15,
|
|
499
|
-
offset: 5,
|
|
500
|
-
)
|
|
625
|
+
# use user specified order id
|
|
626
|
+
@private_v3_api.cancel_order!(client_oid: 'MY_ORDER_123456')
|
|
501
627
|
```
|
|
502
|
-
</details>
|
|
503
|
-
|
|
504
|
-
#### [GET /api/v2/internal_transfer](https://max.maicoin.com/documents/api_list#!/private/getApiV2InternalTransfer)
|
|
505
628
|
|
|
506
|
-
|
|
629
|
+
### Trade
|
|
630
|
+
#### [GET /api/v3/order/trades](https://max-api.maicoin.com/doc/v3.html#tag/Trade/operation/getApiV3OrderTrades)
|
|
507
631
|
|
|
508
|
-
|
|
509
|
-
<summary>Show code</summary>
|
|
632
|
+
> Get trade detail by your order info
|
|
510
633
|
|
|
511
634
|
```rb
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
</details>
|
|
635
|
+
# use max unique order id
|
|
636
|
+
@private_v3_api.my_trades_of_order(123456)
|
|
515
637
|
|
|
516
|
-
|
|
517
|
-
|
|
638
|
+
# use user specified order id
|
|
639
|
+
@private_v3_api.my_trades_of_order(client_oid: 'MY_ORDER_123456')
|
|
640
|
+
```
|
|
518
641
|
|
|
519
|
-
|
|
642
|
+
#### [GET /api/v3/wallet/{path_wallet_type}/trades](https://max-api.maicoin.com/doc/v3.html#tag/Trade/operation/getApiV3WalletPathWalletTypeTrades)
|
|
520
643
|
|
|
521
|
-
|
|
522
|
-
<summary>Show code</summary>
|
|
644
|
+
> Get executed trades
|
|
523
645
|
|
|
524
646
|
```rb
|
|
525
647
|
# use default parameters
|
|
526
|
-
@
|
|
648
|
+
@private_v3_api.my_trades
|
|
527
649
|
|
|
528
650
|
# provide all possible parameters
|
|
529
|
-
@
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
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',
|
|
535
657
|
limit: 15,
|
|
536
|
-
offset: 5,
|
|
537
658
|
)
|
|
538
659
|
```
|
|
539
|
-
</details>
|
|
540
660
|
|
|
541
|
-
|
|
661
|
+
### Deposit
|
|
662
|
+
#### [GET /api/v3/deposit_address](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3DepositAddress)
|
|
542
663
|
|
|
543
|
-
>
|
|
664
|
+
> Get user deposit address by currency version
|
|
665
|
+
|
|
666
|
+
```rb
|
|
667
|
+
@private_v3_api.deposit_address('bscusdt')
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
#### [GET /api/v3/deposits](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Deposits)
|
|
544
671
|
|
|
545
|
-
|
|
546
|
-
<summary>Show code</summary>
|
|
672
|
+
> get your deposits history
|
|
547
673
|
|
|
548
674
|
```rb
|
|
549
675
|
# use default parameters
|
|
550
|
-
@
|
|
676
|
+
@private_v3_api.deposits
|
|
551
677
|
|
|
552
678
|
# provide all possible parameters
|
|
553
|
-
@
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
to: 69444,
|
|
558
|
-
pagination: true,
|
|
559
|
-
page: 3,
|
|
679
|
+
@private_v3_api.deposits(
|
|
680
|
+
currency: 'max',
|
|
681
|
+
timestamp: 1624705402,
|
|
682
|
+
order_by: 'asc',
|
|
560
683
|
limit: 15,
|
|
561
|
-
offset: 5,
|
|
562
684
|
)
|
|
563
685
|
```
|
|
564
|
-
</details>
|
|
565
686
|
|
|
566
|
-
#### [GET /api/
|
|
567
|
-
|
|
568
|
-
> get max rewards yesterday
|
|
687
|
+
#### [GET /api/v3/deposit](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Deposit)
|
|
569
688
|
|
|
570
|
-
|
|
571
|
-
<summary>Show code</summary>
|
|
689
|
+
> Get details of a specific deposit
|
|
572
690
|
|
|
573
691
|
```rb
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
</details>
|
|
692
|
+
# Query by uuid
|
|
693
|
+
@private_v3_api.deposit(uuid: '18022603540001')
|
|
577
694
|
|
|
578
|
-
|
|
695
|
+
# Query by txid
|
|
696
|
+
@private_v3_api.deposit(txid: '0x8daa98e07886985bd6a142cd81b83582d6085f7eb931dc4984c18c84f2a845e0')
|
|
697
|
+
```
|
|
579
698
|
|
|
580
|
-
|
|
699
|
+
### Withdraw
|
|
700
|
+
#### [GET /api/v3/withdraw_addresses](https://max-api.maicoin.com/doc/v3.html#tag/Wallet/operation/getApiV3WithdrawAddresses)
|
|
581
701
|
|
|
582
|
-
|
|
583
|
-
<summary>Show code</summary>
|
|
702
|
+
> Get withdraw addresses of spot wallet
|
|
584
703
|
|
|
585
704
|
```rb
|
|
586
|
-
|
|
587
|
-
@api.yields
|
|
705
|
+
@private_v3_api.withdraw_addresses('usdt')
|
|
588
706
|
|
|
589
707
|
# provide all possible parameters
|
|
590
|
-
@
|
|
591
|
-
currency: 'usdt',
|
|
592
|
-
from: 68444,
|
|
593
|
-
to: 69444,
|
|
594
|
-
pagination: true,
|
|
595
|
-
page: 3,
|
|
596
|
-
limit: 15,
|
|
597
|
-
offset: 5,
|
|
598
|
-
)
|
|
708
|
+
@private_v3_api.withdraw_addresses('usdt', limit: 10, offset: 5)
|
|
599
709
|
```
|
|
600
|
-
</details>
|
|
601
710
|
|
|
602
|
-
|
|
603
|
-
#### [GET /api/v2/orders](https://max.maicoin.com/documents/api_list#!/private/getApiV2Orders)
|
|
604
|
-
|
|
605
|
-
> get your orders, results is paginated.
|
|
711
|
+
#### [GET /api/v3/withdrawals](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Withdrawals)
|
|
606
712
|
|
|
607
|
-
|
|
608
|
-
<summary>Show code</summary>
|
|
713
|
+
> Get external withdrawals history
|
|
609
714
|
|
|
610
715
|
```rb
|
|
611
716
|
# use default parameters
|
|
612
|
-
@
|
|
717
|
+
@private_v3_api.withdraws
|
|
613
718
|
|
|
614
719
|
# provide all possible parameters
|
|
615
|
-
@
|
|
616
|
-
'
|
|
720
|
+
@private_v3_api.withdraws(
|
|
721
|
+
currency: 'max',
|
|
617
722
|
state: 'done',
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
pagination: true,
|
|
621
|
-
page: 3,
|
|
723
|
+
timestamp: 1624705402,
|
|
724
|
+
order_by: 'asc',
|
|
622
725
|
limit: 15,
|
|
623
|
-
offset: 5,
|
|
624
726
|
)
|
|
625
727
|
```
|
|
626
|
-
</details>
|
|
627
728
|
|
|
628
|
-
#### [GET /api/
|
|
729
|
+
#### [GET /api/v3/withdrawal](https://max-api.maicoin.com/doc/v3.html#tag/Transaction/operation/getApiV3Withdrawal)
|
|
629
730
|
|
|
630
|
-
>
|
|
631
|
-
|
|
632
|
-
<details>
|
|
633
|
-
<summary>Show code</summary>
|
|
731
|
+
> Get details of a specific external withdraw
|
|
634
732
|
|
|
635
733
|
```rb
|
|
636
|
-
#
|
|
637
|
-
@
|
|
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
|
|
1042
|
+
@api.order(123456)
|
|
638
1043
|
|
|
639
1044
|
# use user specified order id
|
|
640
1045
|
@api.order('MY_ORDER_123456', use_client_id: true)
|
|
641
1046
|
```
|
|
642
|
-
</details>
|
|
643
1047
|
|
|
644
|
-
#### [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)
|
|
645
1049
|
|
|
646
1050
|
> cancel all your orders with given market and side
|
|
647
1051
|
|
|
648
|
-
<details>
|
|
649
|
-
<summary>Show code</summary>
|
|
650
|
-
|
|
651
1052
|
```rb
|
|
652
1053
|
# use default parameters
|
|
653
1054
|
@api.cancel_orders!
|
|
@@ -655,15 +1056,11 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
655
1056
|
# provide all possible parameters
|
|
656
1057
|
@api.cancel_orders!(market: 'maxtwd', side: 'sell', group_id: '123456')
|
|
657
1058
|
```
|
|
658
|
-
</details>
|
|
659
1059
|
|
|
660
|
-
#### [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)
|
|
661
1061
|
|
|
662
1062
|
> cancel an order
|
|
663
1063
|
|
|
664
|
-
<details>
|
|
665
|
-
<summary>Show code</summary>
|
|
666
|
-
|
|
667
1064
|
```rb
|
|
668
1065
|
# use max unique order id
|
|
669
1066
|
@api.cancel_order!(123456)
|
|
@@ -671,15 +1068,11 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
671
1068
|
# use user specified order id
|
|
672
1069
|
@api.cancel_order!('MY_ORDER_123456', use_client_id: true)
|
|
673
1070
|
```
|
|
674
|
-
</details>
|
|
675
1071
|
|
|
676
|
-
#### [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)
|
|
677
1073
|
|
|
678
1074
|
> create a sell/buy order
|
|
679
1075
|
|
|
680
|
-
<details>
|
|
681
|
-
<summary>Show code</summary>
|
|
682
|
-
|
|
683
1076
|
```rb
|
|
684
1077
|
# use default parameters
|
|
685
1078
|
@api.create_order!('maxtwd', 'buy', 1000, price: 7.5)
|
|
@@ -696,29 +1089,261 @@ secret_key = 'YOUR_SECRET_KEY'
|
|
|
696
1089
|
group_id: 12345678,
|
|
697
1090
|
)
|
|
698
1091
|
```
|
|
699
|
-
</details>
|
|
700
1092
|
|
|
701
|
-
#### [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)
|
|
702
1094
|
|
|
703
1095
|
> Create multiple sell/buy orders, orders may be partially accepted, please put your orders as an array in json body.
|
|
704
1096
|
|
|
705
|
-
<details>
|
|
706
|
-
<summary>Show code</summary>
|
|
707
|
-
|
|
708
1097
|
```rb
|
|
709
1098
|
# use default parameters
|
|
710
1099
|
@api.create_orders!('maxtwd', [
|
|
711
|
-
{ side: 'buy', volume: '1000', price: 7.5 },
|
|
712
|
-
{ side: 'buy', volume: '1500', price: 7.2 },
|
|
1100
|
+
{ side: 'buy', volume: '1000', price: '7.5' },
|
|
1101
|
+
{ side: 'buy', volume: '1500', price: '7.2' },
|
|
713
1102
|
])
|
|
714
1103
|
|
|
715
1104
|
# provide all possible parameters
|
|
716
1105
|
@api.create_orders!('maxtwd', [
|
|
717
|
-
{ side: 'buy', volume: '1000', price: 7.5, client_oid: 'MY_ORDER_ID_12345', stop_price: 8, ord_type: 'limit' },
|
|
718
|
-
{ side: 'buy', volume: '1500', price: 7.2, client_oid: 'MY_ORDER_ID_12346', stop_price: 8, ord_type: 'limit' },
|
|
1106
|
+
{ side: 'buy', volume: '1000', price: '7.5', client_oid: 'MY_ORDER_ID_12345', stop_price: '8', ord_type: 'limit' },
|
|
1107
|
+
{ side: 'buy', volume: '1500', price: '7.2', client_oid: 'MY_ORDER_ID_12346', stop_price: '8', ord_type: 'limit' },
|
|
719
1108
|
], group_id: 12345)
|
|
720
1109
|
```
|
|
721
|
-
|
|
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
|
+
```
|
|
722
1347
|
|
|
723
1348
|
## Development
|
|
724
1349
|
|