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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV2
|
|
5
|
+
module RewardApi
|
|
6
|
+
def rewards(reward_type: nil, currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0)
|
|
7
|
+
path = reward_type ? "/rewards/#{reward_type}" : '/rewards'
|
|
8
|
+
send_request(
|
|
9
|
+
:get,
|
|
10
|
+
path,
|
|
11
|
+
currency: currency,
|
|
12
|
+
from: from,
|
|
13
|
+
to: to,
|
|
14
|
+
pagination: pagination,
|
|
15
|
+
page: page,
|
|
16
|
+
limit: limit,
|
|
17
|
+
offset: offset,
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def yields(currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0)
|
|
22
|
+
send_request(
|
|
23
|
+
:get,
|
|
24
|
+
'/yields',
|
|
25
|
+
currency: currency,
|
|
26
|
+
from: from,
|
|
27
|
+
to: to,
|
|
28
|
+
pagination: pagination,
|
|
29
|
+
page: page,
|
|
30
|
+
limit: limit,
|
|
31
|
+
offset: offset,
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def max_rewards_yesterday
|
|
36
|
+
send_request(:get, '/max_rewards/yesterday', {})
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV2
|
|
5
|
+
module TradeApi
|
|
6
|
+
def my_trades_of_order(order_id, use_client_id: false)
|
|
7
|
+
id_params_key = use_client_id ? :client_oid : :id
|
|
8
|
+
send_request(:get, '/trades/my/of_order', id_params_key => order_id)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def my_trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50, offset: 0)
|
|
12
|
+
send_request(
|
|
13
|
+
:get,
|
|
14
|
+
'/trades/my',
|
|
15
|
+
market: market,
|
|
16
|
+
timestamp: timestamp,
|
|
17
|
+
from: from,
|
|
18
|
+
to: to,
|
|
19
|
+
order_by: order_by,
|
|
20
|
+
pagination: pagination,
|
|
21
|
+
page: page,
|
|
22
|
+
limit: limit,
|
|
23
|
+
offset: offset,
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV2
|
|
5
|
+
module UserApi
|
|
6
|
+
def member_profile
|
|
7
|
+
send_request(:get, '/members/profile', {})
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def me
|
|
11
|
+
send_request(:get, '/members/me', {})
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def vip_level
|
|
15
|
+
send_request(:get, '/members/vip_level', {})
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV2
|
|
5
|
+
module WithdrawApi
|
|
6
|
+
def withdrawal(withdraw_id)
|
|
7
|
+
send_request(:get, '/withdrawal', uuid: withdraw_id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def withdrawals(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0)
|
|
11
|
+
send_request(
|
|
12
|
+
:get,
|
|
13
|
+
'/withdrawals',
|
|
14
|
+
currency: currency,
|
|
15
|
+
from: from,
|
|
16
|
+
to: to,
|
|
17
|
+
state: state,
|
|
18
|
+
pagination: pagination,
|
|
19
|
+
page: page,
|
|
20
|
+
limit: limit,
|
|
21
|
+
offset: offset,
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create_withdrawal!(currency, withdraw_address_id, amount)
|
|
26
|
+
send_request(:post, '/withdrawal', currency: currency, withdraw_address_uuid: withdraw_address_id, amount: amount)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def withdraw_addresses(currency, pagination: nil, page: 1, limit: 50, offset: 0)
|
|
30
|
+
send_request(
|
|
31
|
+
:get,
|
|
32
|
+
'/withdraw_addresses',
|
|
33
|
+
currency: currency,
|
|
34
|
+
pagination: pagination,
|
|
35
|
+
page: page,
|
|
36
|
+
limit: limit,
|
|
37
|
+
offset: offset,
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'max_exchange_api/private_api'
|
|
4
|
+
require 'max_exchange_api/private_v2/user_api'
|
|
5
|
+
require 'max_exchange_api/private_v2/account_api'
|
|
6
|
+
require 'max_exchange_api/private_v2/order_api'
|
|
7
|
+
require 'max_exchange_api/private_v2/trade_api'
|
|
8
|
+
require 'max_exchange_api/private_v2/deposit_api'
|
|
9
|
+
require 'max_exchange_api/private_v2/withdraw_api'
|
|
10
|
+
require 'max_exchange_api/private_v2/internal_transfer_api'
|
|
11
|
+
require 'max_exchange_api/private_v2/reward_api'
|
|
12
|
+
|
|
13
|
+
module MaxExchangeApi
|
|
14
|
+
class PrivateV2Api < PrivateApi
|
|
15
|
+
base_uri 'https://max-api.maicoin.com/api/v2'
|
|
16
|
+
|
|
17
|
+
include PrivateV2::UserApi
|
|
18
|
+
include PrivateV2::AccountApi
|
|
19
|
+
include PrivateV2::OrderApi
|
|
20
|
+
include PrivateV2::TradeApi
|
|
21
|
+
include PrivateV2::DepositApi
|
|
22
|
+
include PrivateV2::WithdrawApi
|
|
23
|
+
include PrivateV2::InternalTransferApi
|
|
24
|
+
include PrivateV2::RewardApi
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module AccountApi
|
|
6
|
+
def accounts(wallet_type: 'spot', currency: nil)
|
|
7
|
+
send_request(
|
|
8
|
+
:get,
|
|
9
|
+
"/wallet/#{wallet_type}/accounts",
|
|
10
|
+
currency: currency,
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module ConvertApi
|
|
6
|
+
def convert_orders(timestamp: nil, order_by: 'desc', limit: 50)
|
|
7
|
+
send_request(:get, '/converts', timestamp: timestamp, order: order_by, limit: limit)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def convert_order(sn)
|
|
11
|
+
send_request(:get, '/convert', sn: sn)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_convert_order(from: [], to: [])
|
|
15
|
+
from_amount, from_currency = from
|
|
16
|
+
to_amount, to_currency = to
|
|
17
|
+
|
|
18
|
+
send_request(
|
|
19
|
+
:post,
|
|
20
|
+
'/convert',
|
|
21
|
+
from_amount: from_amount,
|
|
22
|
+
from_currency: from_currency,
|
|
23
|
+
to_amount: to_amount,
|
|
24
|
+
to_currency: to_currency,
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module DepositApi
|
|
6
|
+
def deposit_address(currency_version)
|
|
7
|
+
send_request(:get, '/deposit_address', currency_version: currency_version)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def deposits(currency: nil, timestamp: nil, order_by: 'desc', limit: 50)
|
|
11
|
+
send_request(
|
|
12
|
+
:get,
|
|
13
|
+
'/deposits',
|
|
14
|
+
currency: currency,
|
|
15
|
+
timestamp: timestamp,
|
|
16
|
+
order: order_by,
|
|
17
|
+
limit: limit,
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def deposit(txid: nil, uuid: nil)
|
|
22
|
+
send_request(:get, '/deposit', txid: txid, uuid: uuid)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module InternalTransferApi
|
|
6
|
+
def internal_transfers(currency: nil, side: 'in', timestamp: nil, order_by: 'desc', limit: 50)
|
|
7
|
+
send_request(
|
|
8
|
+
:get,
|
|
9
|
+
'/internal_transfers',
|
|
10
|
+
currency: currency,
|
|
11
|
+
side: side,
|
|
12
|
+
timestamp: timestamp,
|
|
13
|
+
order: order_by,
|
|
14
|
+
limit: limit,
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module MWalletApi
|
|
6
|
+
def m_wallet_ad_ratio
|
|
7
|
+
send_request(:get, '/wallet/m/ad_ratio', {})
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def m_wallet_loan!(amount, currency)
|
|
11
|
+
send_request(
|
|
12
|
+
:post,
|
|
13
|
+
'/wallet/m/loan',
|
|
14
|
+
currency: currency,
|
|
15
|
+
amount: amount,
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def m_wallet_repay!(amount, currency)
|
|
20
|
+
send_request(
|
|
21
|
+
:post,
|
|
22
|
+
'/wallet/m/repayment',
|
|
23
|
+
currency: currency,
|
|
24
|
+
amount: amount,
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def m_wallet_loans(currency, timestamp: nil, order_by: 'desc', limit: 50)
|
|
29
|
+
send_request(
|
|
30
|
+
:get,
|
|
31
|
+
'/wallet/m/loans',
|
|
32
|
+
currency: currency,
|
|
33
|
+
timestamp: timestamp,
|
|
34
|
+
order: order_by,
|
|
35
|
+
limit: limit,
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def m_wallet_repayments(currency, timestamp: nil, order_by: 'desc', limit: 50)
|
|
40
|
+
send_request(
|
|
41
|
+
:get,
|
|
42
|
+
'/wallet/m/repayments',
|
|
43
|
+
currency: currency,
|
|
44
|
+
timestamp: timestamp,
|
|
45
|
+
order: order_by,
|
|
46
|
+
limit: limit,
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def m_wallet_liquidations(timestamp: nil, order_by: 'desc', limit: 50)
|
|
51
|
+
send_request(
|
|
52
|
+
:get,
|
|
53
|
+
'/wallet/m/liquidations',
|
|
54
|
+
timestamp: timestamp,
|
|
55
|
+
order: order_by,
|
|
56
|
+
limit: limit,
|
|
57
|
+
)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def m_wallet_liquidation(sn)
|
|
61
|
+
send_request(:get, '/wallet/m/liquidation', sn: sn)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def m_wallet_interests(currency, timestamp: nil, order_by: 'desc', limit: 50)
|
|
65
|
+
send_request(
|
|
66
|
+
:get,
|
|
67
|
+
'/wallet/m/interests',
|
|
68
|
+
currency: currency,
|
|
69
|
+
timestamp: timestamp,
|
|
70
|
+
order: order_by,
|
|
71
|
+
limit: limit,
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module OrderApi
|
|
6
|
+
def open_orders(market, timestamp: nil, order_by: 'desc', limit: 50, wallet_type: 'spot')
|
|
7
|
+
send_request(
|
|
8
|
+
:get,
|
|
9
|
+
"/wallet/#{wallet_type}/orders/open",
|
|
10
|
+
market: market,
|
|
11
|
+
state: state,
|
|
12
|
+
timestamp: timestamp,
|
|
13
|
+
order_by: order_by,
|
|
14
|
+
limit: limit,
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def closed_orders(market, timestamp: nil, order_by: 'desc', limit: 50, wallet_type: 'spot')
|
|
19
|
+
send_request(
|
|
20
|
+
:get,
|
|
21
|
+
"/wallet/#{wallet_type}/orders/closed",
|
|
22
|
+
market: market,
|
|
23
|
+
state: state,
|
|
24
|
+
timestamp: timestamp,
|
|
25
|
+
order_by: order_by,
|
|
26
|
+
limit: limit,
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def orders_history(market, from_id: 1, limit: 50, wallet_type: 'spot')
|
|
31
|
+
send_request(
|
|
32
|
+
:get,
|
|
33
|
+
"/wallet/#{wallet_type}/orders/history",
|
|
34
|
+
market,
|
|
35
|
+
from_id: from_id,
|
|
36
|
+
limit: limit,
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def create_order!(market, side, volume, price: nil, client_oid: nil, stop_price: nil, ord_type: nil, group_id: nil, wallet_type: 'spot')
|
|
41
|
+
send_request(
|
|
42
|
+
:post,
|
|
43
|
+
"/wallet/#{wallet_type}/order",
|
|
44
|
+
market: market,
|
|
45
|
+
side: side,
|
|
46
|
+
volume: volume,
|
|
47
|
+
price: price,
|
|
48
|
+
client_oid: client_oid,
|
|
49
|
+
stop_price: stop_price,
|
|
50
|
+
ord_type: ord_type,
|
|
51
|
+
group_id: group_id,
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def order(order_id = nil, client_oid: nil)
|
|
56
|
+
if order_id
|
|
57
|
+
send_request(:get, '/order', id: order_id)
|
|
58
|
+
else
|
|
59
|
+
send_request(:get, '/order', client_oid: client_oid)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def cancel_orders!(market: nil, side: nil, group_id: nil, wallet_type: 'spot')
|
|
64
|
+
send_request(
|
|
65
|
+
:delete,
|
|
66
|
+
"/wallet/#{wallet_type}/orders/clear",
|
|
67
|
+
market: market,
|
|
68
|
+
side: side,
|
|
69
|
+
group_id: group_id,
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def cancel_order!(order_id = nil, client_oid: nil)
|
|
74
|
+
if order_id
|
|
75
|
+
send_request(:delete, '/order', id: order_id)
|
|
76
|
+
else
|
|
77
|
+
send_request(:delete, '/order', client_oid: client_oid)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module RewardApi
|
|
6
|
+
def rewards(currency: nil, reward_type: nil, timestamp: nil, order_by: 'desc', limit: 50)
|
|
7
|
+
send_request(
|
|
8
|
+
:get,
|
|
9
|
+
'/internal_transfers',
|
|
10
|
+
currency: currency,
|
|
11
|
+
reward_type: reward_type,
|
|
12
|
+
timestamp: timestamp,
|
|
13
|
+
order: order_by,
|
|
14
|
+
limit: limit,
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module SubAccountApi
|
|
6
|
+
def sub_accounts
|
|
7
|
+
send_request(:get, '/sub_accounts')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def sub_account(sn)
|
|
11
|
+
send_request(:get, '/sub_account', sn: sn)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_sub_account!(name:)
|
|
15
|
+
send_request(:post, '/sub_accounts', name: name)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def update_sub_account!(sn, name:)
|
|
19
|
+
send_request(:put, '/sub_account', sn: sn, name: name)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def delete_sub_account!(sn)
|
|
23
|
+
send_request(:delete, '/sub_account', sn: sn)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create_sub_account_transfer!(to_sn, amount, currency)
|
|
27
|
+
send_request(:post, '/sub_account/transfer', to_sn: to_sn, currency: currency, amount: amount)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module TradeApi
|
|
6
|
+
def my_trades_of_order(order_id = nil, client_oid: nil)
|
|
7
|
+
if order_id
|
|
8
|
+
send_request(:get, '/order/trades', order_id: order_id)
|
|
9
|
+
else
|
|
10
|
+
send_request(:get, '/order/trades', client_oid: client_oid)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def my_trades(wallet_type: 'spot', market: nil, timestamp: nil, from_id: nil, order_by: 'desc', limit: 50)
|
|
15
|
+
send_request(
|
|
16
|
+
:get,
|
|
17
|
+
"/wallet/#{wallet_type}/trades",
|
|
18
|
+
market: market,
|
|
19
|
+
timestamp: timestamp,
|
|
20
|
+
from_id: from_id,
|
|
21
|
+
order: order_by,
|
|
22
|
+
limit: limit,
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MaxExchangeApi
|
|
4
|
+
module PrivateV3
|
|
5
|
+
module WithdrawApi
|
|
6
|
+
def withdraw_addresses(currency, limit: 50, offset: 0)
|
|
7
|
+
send_request(:get, '/withdraw_addresses', currency: currency, limit: limit, offset: offset)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def withdraws(currency: nil, state: nil, timestamp: nil, order_by: 'desc', limit: 50)
|
|
11
|
+
send_request(
|
|
12
|
+
:get,
|
|
13
|
+
'/withdrawals',
|
|
14
|
+
currency: currency,
|
|
15
|
+
state: state,
|
|
16
|
+
timestamp: timestamp,
|
|
17
|
+
order: order_by,
|
|
18
|
+
limit: limit,
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def withdraw(uuid:)
|
|
23
|
+
send_request(:get, '/withdrawal', uuid: uuid)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create_withdraw!(withdraw_address_uuid, amount)
|
|
27
|
+
send_request(:post, '/withdrawal', withdraw_address_uuid: withdraw_address_uuid, amount: amount)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def create_twd_withdraw!(amount)
|
|
31
|
+
send_request(:post, '/withdrawal/twd', amount: amount)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'max_exchange_api/private_api'
|
|
4
|
+
require 'max_exchange_api/private_v3/user_api'
|
|
5
|
+
require 'max_exchange_api/private_v3/account_api'
|
|
6
|
+
require 'max_exchange_api/private_v3/m_wallet_api'
|
|
7
|
+
require 'max_exchange_api/private_v3/convert_api'
|
|
8
|
+
require 'max_exchange_api/private_v3/order_api'
|
|
9
|
+
require 'max_exchange_api/private_v3/trade_api'
|
|
10
|
+
require 'max_exchange_api/private_v3/deposit_api'
|
|
11
|
+
require 'max_exchange_api/private_v3/withdraw_api'
|
|
12
|
+
require 'max_exchange_api/private_v3/internal_transfer_api'
|
|
13
|
+
require 'max_exchange_api/private_v3/reward_api'
|
|
14
|
+
require 'max_exchange_api/private_v3/sub_account_api'
|
|
15
|
+
|
|
16
|
+
module MaxExchangeApi
|
|
17
|
+
class PrivateV3Api < PrivateApi
|
|
18
|
+
base_uri 'https://max-api.maicoin.com/api/v3'
|
|
19
|
+
|
|
20
|
+
include PrivateV3::UserApi
|
|
21
|
+
include PrivateV3::AccountApi
|
|
22
|
+
include PrivateV3::MWalletApi
|
|
23
|
+
include PrivateV3::ConvertApi
|
|
24
|
+
include PrivateV3::OrderApi
|
|
25
|
+
include PrivateV3::TradeApi
|
|
26
|
+
include PrivateV3::DepositApi
|
|
27
|
+
include PrivateV3::WithdrawApi
|
|
28
|
+
include PrivateV3::InternalTransferApi
|
|
29
|
+
include PrivateV3::RewardApi
|
|
30
|
+
include PrivateV3::SubAccountApi
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,72 +1,13 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'max_exchange_api/base_api'
|
|
4
|
-
|
|
5
|
-
module MaxExchangeApi
|
|
6
|
-
class PublicApi < BaseApi
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def currencies
|
|
18
|
-
send_request(:get, '/currencies', {})
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def k(market, limit: 30, period: 1, timestamp: nil)
|
|
22
|
-
send_request(:get, '/k', market: market, limit: limit, period: period, timestamp: timestamp)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def depth(market, limit: 10, sort_by_price: true)
|
|
26
|
-
send_request(:get, '/depth', market: market, limit: limit, sort_by_price: sort_by_price)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50,
|
|
30
|
-
offset: 0)
|
|
31
|
-
send_request(
|
|
32
|
-
:get,
|
|
33
|
-
'/trades',
|
|
34
|
-
market: market,
|
|
35
|
-
timestamp: timestamp,
|
|
36
|
-
from: from,
|
|
37
|
-
to: to,
|
|
38
|
-
order_by: order_by,
|
|
39
|
-
pagination: pagination,
|
|
40
|
-
page: page,
|
|
41
|
-
limit: limit,
|
|
42
|
-
offset: offset,
|
|
43
|
-
)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def markets
|
|
47
|
-
send_request(:get, '/markets', {})
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def summary
|
|
51
|
-
send_request(:get, '/summary', {})
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def tickers(market = nil)
|
|
55
|
-
if market
|
|
56
|
-
send_request(:get, "/tickers/#{market}", {})
|
|
57
|
-
else
|
|
58
|
-
send_request(:get, '/tickers', {})
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def timestamp
|
|
63
|
-
send_request(:get, '/timestamp', {})
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
protected
|
|
67
|
-
|
|
68
|
-
def send_request(method, path, query)
|
|
69
|
-
super(method, path, {}, query)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'max_exchange_api/base_api'
|
|
4
|
+
|
|
5
|
+
module MaxExchangeApi
|
|
6
|
+
class PublicApi < BaseApi
|
|
7
|
+
protected
|
|
8
|
+
|
|
9
|
+
def send_request(method, path, query)
|
|
10
|
+
super(method, path, {}, query)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|