Class: MaxExchangeApi::PrivateApi
- Defined in:
- lib/max_exchange_api/private_api.rb
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
- #account(currency) ⇒ Object
- #accounts ⇒ Object
- #cancel_order!(order_id, use_client_id: false) ⇒ Object
- #cancel_orders!(market: nil, side: nil, group_id: nil) ⇒ Object
- #create_deposit_addresses!(currency) ⇒ Object
- #create_order!(market, side, volume, price: nil, client_oid: nil, stop_price: nil, ord_type: nil, group_id: nil) ⇒ Object
- #create_orders!(market, orders, group_id: nil) ⇒ Object
- #create_withdrawal!(currency, withdraw_address_id, amount) ⇒ Object
- #deposit(transaction_id) ⇒ Object
- #deposit_addresses(currency: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
- #deposits(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
-
#initialize(access_key, secret_key, config: nil) ⇒ PrivateApi
constructor
A new instance of PrivateApi.
- #internal_transfer(internal_transfer_id) ⇒ Object
- #internal_transfers(currency: nil, side: 'in', from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
- #max_rewards_yesterday ⇒ Object
- #me ⇒ Object
- #member_profile ⇒ Object
- #my_trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50, offset: 0) ⇒ Object
- #my_trades_of_order(order_id, use_client_id: false) ⇒ Object
- #order(order_id, use_client_id: false) ⇒ Object
- #orders(market, state: nil, order_by: 'asc', group_id: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
- #rewards(reward_type: nil, currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
- #vip_level ⇒ Object
- #withdraw_addresses(currency, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
- #withdrawal(withdraw_id) ⇒ Object
- #withdrawals(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
- #yields(currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
Constructor Details
#initialize(access_key, secret_key, config: nil) ⇒ PrivateApi
Returns a new instance of PrivateApi.
9 10 11 12 13 14 |
# File 'lib/max_exchange_api/private_api.rb', line 9 def initialize(access_key, secret_key, config: nil) super(config: config) @access_key = access_key @secret_key = secret_key end |
Instance Method Details
#account(currency) ⇒ Object
54 55 56 |
# File 'lib/max_exchange_api/private_api.rb', line 54 def account(currency) send_request(:get, "/members/accounts/#{currency}", {}) end |
#accounts ⇒ Object
50 51 52 |
# File 'lib/max_exchange_api/private_api.rb', line 50 def accounts send_request(:get, '/members/accounts', {}) end |
#cancel_order!(order_id, use_client_id: false) ⇒ Object
207 208 209 210 |
# File 'lib/max_exchange_api/private_api.rb', line 207 def cancel_order!(order_id, use_client_id: false) id_params_key = use_client_id ? :client_oid : :id send_request(:post, '/order/delete', id_params_key => order_id) end |
#cancel_orders!(market: nil, side: nil, group_id: nil) ⇒ Object
203 204 205 |
# File 'lib/max_exchange_api/private_api.rb', line 203 def cancel_orders!(market: nil, side: nil, group_id: nil) send_request(:post, '/orders/clear', market: market, side: side, group_id: group_id) end |
#create_deposit_addresses!(currency) ⇒ Object
90 91 92 |
# File 'lib/max_exchange_api/private_api.rb', line 90 def create_deposit_addresses!(currency) send_request(:post, '/deposit_addresses', currency: currency) end |
#create_order!(market, side, volume, price: nil, client_oid: nil, stop_price: nil, ord_type: nil, group_id: nil) ⇒ Object
212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/max_exchange_api/private_api.rb', line 212 def create_order!(market, side, volume, price: nil, client_oid: nil, stop_price: nil, ord_type: nil, group_id: nil) send_request( :post, '/orders', market: market, side: side, volume: volume, price: price, client_oid: client_oid, stop_price: stop_price, ord_type: ord_type, group_id: group_id, ) end |
#create_orders!(market, orders, group_id: nil) ⇒ Object
227 228 229 |
# File 'lib/max_exchange_api/private_api.rb', line 227 def create_orders!(market, orders, group_id: nil) send_request(:post, '/orders/multi/onebyone', market: market, orders: orders, group_id: group_id) end |
#create_withdrawal!(currency, withdraw_address_id, amount) ⇒ Object
126 127 128 |
# File 'lib/max_exchange_api/private_api.rb', line 126 def create_withdrawal!(currency, withdraw_address_id, amount) send_request(:post, '/withdrawal', currency: currency, withdraw_address_uuid: withdraw_address_id, amount: amount) end |
#deposit(transaction_id) ⇒ Object
74 75 76 |
# File 'lib/max_exchange_api/private_api.rb', line 74 def deposit(transaction_id) send_request(:get, '/deposit', txid: transaction_id) end |
#deposit_addresses(currency: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/max_exchange_api/private_api.rb', line 78 def deposit_addresses(currency: nil, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/deposit_addresses', currency: currency, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#deposits(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/max_exchange_api/private_api.rb', line 58 def deposits(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/deposits', currency: currency, from: from, to: to, state: state, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#internal_transfer(internal_transfer_id) ⇒ Object
146 147 148 |
# File 'lib/max_exchange_api/private_api.rb', line 146 def internal_transfer(internal_transfer_id) send_request(:get, '/internal_transfer', uuid: internal_transfer_id) end |
#internal_transfers(currency: nil, side: 'in', from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/max_exchange_api/private_api.rb', line 130 def internal_transfers(currency: nil, side: 'in', from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/internal_transfers', currency: currency, side: side, from: from, to: to, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#max_rewards_yesterday ⇒ Object
179 180 181 |
# File 'lib/max_exchange_api/private_api.rb', line 179 def max_rewards_yesterday send_request(:get, '/max_rewards/yesterday', {}) end |
#me ⇒ Object
42 43 44 |
# File 'lib/max_exchange_api/private_api.rb', line 42 def me send_request(:get, '/members/me', {}) end |
#member_profile ⇒ Object
38 39 40 |
# File 'lib/max_exchange_api/private_api.rb', line 38 def member_profile send_request(:get, '/members/profile', {}) end |
#my_trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50, offset: 0) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/max_exchange_api/private_api.rb', line 21 def my_trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50, offset: 0) send_request( :get, '/trades/my', market: market, timestamp: , from: from, to: to, order_by: order_by, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#my_trades_of_order(order_id, use_client_id: false) ⇒ Object
16 17 18 19 |
# File 'lib/max_exchange_api/private_api.rb', line 16 def my_trades_of_order(order_id, use_client_id: false) id_params_key = use_client_id ? :client_oid : :id send_request(:get, '/trades/my/of_order', id_params_key => order_id) end |
#order(order_id, use_client_id: false) ⇒ Object
198 199 200 201 |
# File 'lib/max_exchange_api/private_api.rb', line 198 def order(order_id, use_client_id: false) id_params_key = use_client_id ? :client_oid : :id send_request(:get, '/order', id_params_key => order_id) end |
#orders(market, state: nil, order_by: 'asc', group_id: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/max_exchange_api/private_api.rb', line 183 def orders(market, state: nil, order_by: 'asc', group_id: nil, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/orders', market: market, state: state, order_by: order_by, group_id: group_id, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#rewards(reward_type: nil, currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/max_exchange_api/private_api.rb', line 150 def rewards(reward_type: nil, currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) path = reward_type ? "/rewards/#{reward_type}" : '/rewards' send_request( :get, path, currency: currency, from: from, to: to, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#vip_level ⇒ Object
46 47 48 |
# File 'lib/max_exchange_api/private_api.rb', line 46 def vip_level send_request(:get, '/members/vip_level', {}) end |
#withdraw_addresses(currency, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/max_exchange_api/private_api.rb', line 94 def withdraw_addresses(currency, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/withdraw_addresses', currency: currency, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#withdrawal(withdraw_id) ⇒ Object
106 107 108 |
# File 'lib/max_exchange_api/private_api.rb', line 106 def withdrawal(withdraw_id) send_request(:get, '/withdrawal', uuid: withdraw_id) end |
#withdrawals(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/max_exchange_api/private_api.rb', line 110 def withdrawals(currency, from: nil, to: nil, state: nil, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/withdrawals', currency: currency, from: from, to: to, state: state, pagination: pagination, page: page, limit: limit, offset: offset, ) end |
#yields(currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/max_exchange_api/private_api.rb', line 165 def yields(currency: nil, from: nil, to: nil, pagination: nil, page: 1, limit: 50, offset: 0) send_request( :get, '/yields', currency: currency, from: from, to: to, pagination: pagination, page: page, limit: limit, offset: offset, ) end |