Class: Bitflyer::HTTP::Private::Client
- Inherits:
-
Object
- Object
- Bitflyer::HTTP::Private::Client
- Defined in:
- lib/bitflyer/http/private.rb
Instance Method Summary collapse
- #addresses ⇒ Object
- #balance ⇒ 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: 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.
5 6 7 |
# File 'lib/bitflyer/http/private.rb', line 5 def initialize(key, secret) @connection = Connection.new(key, secret) end |
Instance Method Details
#addresses ⇒ Object
21 22 23 |
# File 'lib/bitflyer/http/private.rb', line 21 def addresses @connection.get('/v1/me/getaddresses').body end |
#balance ⇒ Object
13 14 15 |
# File 'lib/bitflyer/http/private.rb', line 13 def balance @connection.get('/v1/me/getbalance').body end |
#bank_accounts ⇒ Object
33 34 35 |
# File 'lib/bitflyer/http/private.rb', line 33 def bank_accounts @connection.get('/v1/me/getbankaccounts').body end |
#cancel_all_child_orders(product_code: 'BTC_JPY') ⇒ Object
96 97 98 |
# File 'lib/bitflyer/http/private.rb', line 96 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
68 69 70 71 72 73 74 75 |
# File 'lib/bitflyer/http/private.rb', line 68 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
87 88 89 90 91 92 93 94 |
# File 'lib/bitflyer/http/private.rb', line 87 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
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/bitflyer/http/private.rb', line 100 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
25 26 27 |
# File 'lib/bitflyer/http/private.rb', line 25 def coin_ins @connection.get('/v1/me/getcoinins').body end |
#coin_outs ⇒ Object
29 30 31 |
# File 'lib/bitflyer/http/private.rb', line 29 def coin_outs @connection.get('/v1/me/getcoinouts').body end |
#collateral ⇒ Object
17 18 19 |
# File 'lib/bitflyer/http/private.rb', line 17 def collateral @connection.get('/v1/me/getcollateral').body end |
#deposits ⇒ Object
37 38 39 |
# File 'lib/bitflyer/http/private.rb', line 37 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
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/bitflyer/http/private.rb', line 131 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
123 124 125 126 127 128 129 |
# File 'lib/bitflyer/http/private.rb', line 123 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
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/bitflyer/http/private.rb', line 112 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
9 10 11 |
# File 'lib/bitflyer/http/private.rb', line 9 def @connection.get('/v1/me/getpermissions').body end |
#positions(product_code: 'FX_BTC_JPY') ⇒ Object
143 144 145 |
# File 'lib/bitflyer/http/private.rb', line 143 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
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/bitflyer/http/private.rb', line 55 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: parameters) ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/bitflyer/http/private.rb', line 77 def send_parent_order(order_method: nil, minute_to_expire: nil, time_in_force: 'GTC', parameters: 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
147 148 149 |
# File 'lib/bitflyer/http/private.rb', line 147 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
41 42 43 44 45 46 47 48 49 |
# File 'lib/bitflyer/http/private.rb', line 41 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
51 52 53 |
# File 'lib/bitflyer/http/private.rb', line 51 def withdrawals @connection.get('/v1/me/getwithdrawals').body end |