Class: Bitflyer::HTTP::Private::Client
- Inherits:
-
Object
- Object
- Bitflyer::HTTP::Private::Client
- Defined in:
- lib/bitflyer/http/private.rb
Overview
rubocop:disable Metrics/ClassLength
Instance Method Summary collapse
- #addresses ⇒ Object
- #balance ⇒ Object
- #balance_history(currency_code: nil, count: nil, before: nil, after: nil) ⇒ Object
- #bank_accounts ⇒ Object
- #cancel_all_child_orders(product_code: 'BTC_JPY') ⇒ Object
- #cancel_child_order(product_code: 'BTC_JPY', child_order_id: nil, child_order_acceptance_id: nil) ⇒ Object
- #cancel_parent_order(product_code: 'BTC_JPY', parent_order_id: nil, parent_order_acceptance_id: nil) ⇒ Object
- #child_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_state: nil, parent_order_id: nil) ⇒ Object
- #coin_ins ⇒ Object
- #coin_outs ⇒ Object
- #collateral ⇒ Object
- #deposits ⇒ Object
- #executions(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_id: nil, child_order_acceptance_id: nil) ⇒ Object
-
#initialize(key, secret) ⇒ Client
constructor
A new instance of Client.
- #parent_order(parent_order_id: nil, parent_order_acceptance_id: nil) ⇒ Object
- #parent_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, parent_order_state: nil) ⇒ Object
- #permissions ⇒ Object
- #positions(product_code: 'FX_BTC_JPY') ⇒ Object
- #send_child_order(product_code: 'BTC_JPY', child_order_type: nil, side: nil, price: nil, size: nil, minute_to_expire: nil, time_in_force: 'GTC') ⇒ Object
- #send_parent_order(order_method: nil, minute_to_expire: nil, time_in_force: 'GTC', parameters: {}) ⇒ Object
- #trading_commission(product_code: 'BTC_JPY') ⇒ Object
- #withdraw(currency_code: 'JPY', bank_account_id: nil, amount: nil, code: nil) ⇒ Object
- #withdrawals ⇒ Object
Constructor Details
#initialize(key, secret) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/bitflyer/http/private.rb', line 7 def initialize(key, secret) @connection = Connection.new(key, secret) end |
Instance Method Details
#addresses ⇒ Object
23 24 25 |
# File 'lib/bitflyer/http/private.rb', line 23 def addresses @connection.get('/v1/me/getaddresses').body end |
#balance ⇒ Object
15 16 17 |
# File 'lib/bitflyer/http/private.rb', line 15 def balance @connection.get('/v1/me/getbalance').body end |
#balance_history(currency_code: nil, count: nil, before: nil, after: nil) ⇒ Object
167 168 169 170 171 172 173 174 175 |
# File 'lib/bitflyer/http/private.rb', line 167 def balance_history(currency_code: nil, count: nil, before: nil, after: nil) query = { currency_code: currency_code, count: count, before: before, after: after }.delete_if { |_, v| v.nil? } @connection.get('/v1/me/getbalancehistory', query).body end |
#bank_accounts ⇒ Object
35 36 37 |
# File 'lib/bitflyer/http/private.rb', line 35 def bank_accounts @connection.get('/v1/me/getbankaccounts').body end |
#cancel_all_child_orders(product_code: 'BTC_JPY') ⇒ Object
106 107 108 |
# File 'lib/bitflyer/http/private.rb', line 106 def cancel_all_child_orders(product_code: 'BTC_JPY') @connection.post('/v1/me/cancelallchildorders', product_code: product_code).body end |
#cancel_child_order(product_code: 'BTC_JPY', child_order_id: nil, child_order_acceptance_id: nil) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/bitflyer/http/private.rb', line 78 def cancel_child_order(product_code: 'BTC_JPY', child_order_id: nil, child_order_acceptance_id: nil) body = { product_code: product_code, child_order_id: child_order_id, child_order_acceptance_id: child_order_acceptance_id }.delete_if { |_, v| v.nil? } @connection.post('/v1/me/cancelchildorder', body).body end |
#cancel_parent_order(product_code: 'BTC_JPY', parent_order_id: nil, parent_order_acceptance_id: nil) ⇒ Object
97 98 99 100 101 102 103 104 |
# File 'lib/bitflyer/http/private.rb', line 97 def cancel_parent_order(product_code: 'BTC_JPY', parent_order_id: nil, parent_order_acceptance_id: nil) body = { product_code: product_code, parent_order_id: parent_order_id, parent_order_acceptance_id: parent_order_acceptance_id }.delete_if { |_, v| v.nil? } @connection.post('/v1/me/cancelparentorder', body).body end |
#child_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_state: nil, parent_order_id: nil) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/bitflyer/http/private.rb', line 110 def child_orders( product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_state: nil, parent_order_id: nil ) query = { product_code: product_code, count: count, before: before, after: after, child_order_state: child_order_state, parent_order_id: parent_order_id }.delete_if { |_, v| v.nil? } @connection.get('/v1/me/getchildorders', query).body end |
#coin_ins ⇒ Object
27 28 29 |
# File 'lib/bitflyer/http/private.rb', line 27 def coin_ins @connection.get('/v1/me/getcoinins').body end |
#coin_outs ⇒ Object
31 32 33 |
# File 'lib/bitflyer/http/private.rb', line 31 def coin_outs @connection.get('/v1/me/getcoinouts').body end |
#collateral ⇒ Object
19 20 21 |
# File 'lib/bitflyer/http/private.rb', line 19 def collateral @connection.get('/v1/me/getcollateral').body end |
#deposits ⇒ Object
39 40 41 |
# File 'lib/bitflyer/http/private.rb', line 39 def deposits @connection.get('/v1/me/getdeposits').body end |
#executions(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_id: nil, child_order_acceptance_id: nil) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/bitflyer/http/private.rb', line 148 def executions( product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_id: nil, child_order_acceptance_id: nil ) query = { product_code: product_code, count: count, before: before, after: after, child_order_id: child_order_id, child_order_acceptance_id: child_order_acceptance_id }.delete_if { |_, v| v.nil? } @connection.get('/v1/me/getexecutions', query).body end |
#parent_order(parent_order_id: nil, parent_order_acceptance_id: nil) ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/bitflyer/http/private.rb', line 140 def parent_order(parent_order_id: nil, parent_order_acceptance_id: nil) query = { parent_order_id: parent_order_id, parent_order_acceptance_id: parent_order_acceptance_id }.delete_if { |_, v| v.nil? } @connection.get('/v1/me/getparentorder', query).body end |
#parent_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, parent_order_state: nil) ⇒ Object
129 130 131 132 133 134 135 136 137 138 |
# File 'lib/bitflyer/http/private.rb', line 129 def parent_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, parent_order_state: nil) query = { product_code: product_code, count: count, before: before, after: after, parent_order_state: parent_order_state }.delete_if { |_, v| v.nil? } @connection.get('/v1/me/getparentorders', query).body end |
#permissions ⇒ Object
11 12 13 |
# File 'lib/bitflyer/http/private.rb', line 11 def @connection.get('/v1/me/getpermissions').body end |
#positions(product_code: 'FX_BTC_JPY') ⇒ Object
177 178 179 |
# File 'lib/bitflyer/http/private.rb', line 177 def positions(product_code: 'FX_BTC_JPY') @connection.get('/v1/me/getpositions', product_code: product_code).body end |
#send_child_order(product_code: 'BTC_JPY', child_order_type: nil, side: nil, price: nil, size: nil, minute_to_expire: nil, time_in_force: 'GTC') ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bitflyer/http/private.rb', line 57 def send_child_order( product_code: 'BTC_JPY', child_order_type: nil, side: nil, price: nil, size: nil, minute_to_expire: nil, time_in_force: 'GTC' ) body = { product_code: product_code, child_order_type: child_order_type, side: side, price: price, size: size, minute_to_expire: minute_to_expire, time_in_force: time_in_force }.delete_if { |_, v| v.nil? } @connection.post('/v1/me/sendchildorder', body).body end |
#send_parent_order(order_method: nil, minute_to_expire: nil, time_in_force: 'GTC', parameters: {}) ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/bitflyer/http/private.rb', line 87 def send_parent_order(order_method: nil, minute_to_expire: nil, time_in_force: 'GTC', parameters: {}) body = { order_method: order_method, minute_to_expire: minute_to_expire, time_in_force: time_in_force, parameters: parameters }.delete_if { |_, v| v.nil? } @connection.post('/v1/me/sendparentorder', body).body end |
#trading_commission(product_code: 'BTC_JPY') ⇒ Object
181 182 183 |
# File 'lib/bitflyer/http/private.rb', line 181 def trading_commission(product_code: 'BTC_JPY') @connection.get('v1/me/gettradingcommission', product_code: product_code).body end |
#withdraw(currency_code: 'JPY', bank_account_id: nil, amount: nil, code: nil) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/bitflyer/http/private.rb', line 43 def withdraw(currency_code: 'JPY', bank_account_id: nil, amount: nil, code: nil) body = { currency_code: currency_code, bank_account_id: bank_account_id, amount: amount, code: code }.delete_if { |_, v| v.nil? } @connection.post('/v1/me/withdraw', body).body end |
#withdrawals ⇒ Object
53 54 55 |
# File 'lib/bitflyer/http/private.rb', line 53 def withdrawals @connection.get('/v1/me/getwithdrawals').body end |