Class: Vexapion::Bitflyer
- Inherits:
-
BaseExchanges
- Object
- BaseExchanges
- Vexapion::Bitflyer
- Defined in:
- lib/vexapion/bitflyer.rb
Overview
bitflyerのAPIラッパークラスです 各メソッドの戻り値は下記URLを参照してください
Instance Method Summary collapse
-
#board(pair) ⇒ Hash
(also: #get_board)
板情報.
-
#cancel_all_child_order(pair) ⇒ Hash
すべての注文をキャンセルする.
-
#cancel_child_order(pair, order_id) ⇒ Hash
child_order_idを指定して、注文をキャンセルする.
-
#cancel_child_order_specify_acceptance_id(pair, acceptance_id) ⇒ Hash
child_order_acceptance_idを指定して、注文をキャンセルする.
-
#executions(pair, count = '', before = '', after = '') ⇒ Hash
(also: #get_public_executions)
約定履歴.
-
#get_addresses ⇒ Hash
預入用BTC/ETHアドレス取得.
-
#get_balance ⇒ Hash
資産残高を取得.
-
#get_bank_accounts ⇒ Hash
銀行口座一覧取得.
-
#get_chats(date) ⇒ Hash
チャット.
-
#get_child_orders(pair, state = '', count = '', before = '', after = '') ⇒ Hash
注文の一覧を取得 stateが指定されない場合、ACTIVE, COMPLETED, CANCELED, RXPIRED, REJECTEDのすべてが返されます。.
-
#get_child_orders_parent_order_id(pair, parent_order_id) ⇒ Hash
parent_order_idに関連した注文の一覧を取得.
- #get_coin_ins(count = '', before = '', after = '') ⇒ Hash
-
#get_coin_outs(count = '', before = '', after = '') ⇒ Hash
BTC/ETH送付履歴.
-
#get_coin_outs_id(message_id) ⇒ hash
BTC/ETH送付状況確認.
-
#get_collateral ⇒ Hash
証拠金の状態を取得.
-
#get_deposits(count = '', before = '', after = '') ⇒ Hash
デポジット入金履歴.
-
#get_executions(pair, count = '', before = '', after = '') ⇒ Hash
約定の一覧を取得.
-
#get_executions_acceptance_id(pair, child_order_acceptance_id = '') ⇒ Hash
child_order_acceptance_idに関連した約定の一覧を取得.
-
#get_executions_child_order_id(pair, child_order_id) ⇒ Hash
child_order_idに関連した約定の一覧を取得.
-
#get_health ⇒ Hash
取引所の状態.
-
#get_permissions ⇒ Hash
APIキーの権限を取得.
-
#get_positions(pair) ⇒ Hash
建玉の一覧を取得.
-
#get_withdrawals(count = '', before = '', after = '') ⇒ Hash
デポジット解約履歴(出金).
-
#initialize(key = nil, secret = nil) ⇒ Bitflyer
constructor
:stopdoc:.
-
#send_child_order(pair, side, price, size, expire = '', force = '') ⇒ Hash
指値で新規注文を出す.
-
#send_child_order_market(pair, side, size, expire = '', force = '') ⇒ Hash
成行で新規注文を出す.
-
#sendcoin(currency, amount, address, fee = '', code = '') ⇒ Hash
BTC/ETH外部送付.
-
#ticker(pair) ⇒ Hash
(also: #get_ticker)
Ticker.
-
#withdraw(currency, id, amount, code = '') ⇒ Hash
デポジット解約(出金).
Methods inherited from BaseExchanges
#disconnect, #do_command, #get_nonce, #set_min_interval, #set_verify_mode
Constructor Details
#initialize(key = nil, secret = nil) ⇒ Bitflyer
:stopdoc:
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vexapion/bitflyer.rb', line 13 def initialize(key = nil, secret = nil) super(key, secret) @public_url = 'https://api.bitflyer.jp/v1/' @private_url = 'https://api.bitflyer.jp/v1/me/' set_min_interval(0.3) @available_pair = ['BTC_JPY', 'FX_BTC_JPY', 'ETH_BTC'] end |
Instance Method Details
#board(pair) ⇒ Hash Also known as: get_board
板情報
29 30 31 |
# File 'lib/vexapion/bitflyer.rb', line 29 def board(pair) public_get('board', product_code: pair.upcase) end |
#cancel_all_child_order(pair) ⇒ Hash
すべての注文をキャンセルする
311 312 313 |
# File 'lib/vexapion/bitflyer.rb', line 311 def cancel_all_child_order(pair) post('cancelallchildorders', product_code: pair.upcase) end |
#cancel_child_order(pair, order_id) ⇒ Hash
child_order_idを指定して、注文をキャンセルする
255 256 257 258 259 260 261 262 |
# File 'lib/vexapion/bitflyer.rb', line 255 def cancel_child_order(pair, order_id) params = { product_code: pair.upcase, child_order_id: order_id } post('cancelchildorder', params) end |
#cancel_child_order_specify_acceptance_id(pair, acceptance_id) ⇒ Hash
child_order_acceptance_idを指定して、注文をキャンセルする
268 269 270 271 272 273 274 275 |
# File 'lib/vexapion/bitflyer.rb', line 268 def cancel_child_order_specify_acceptance_id(pair, acceptance_id) params = { product_code: pair.upcase, child_order_acceptance_id: acceptance_id } post('cancelchildorder', params) end |
#executions(pair, count = '', before = '', after = '') ⇒ Hash Also known as: get_public_executions
約定履歴
48 49 50 51 52 53 54 55 56 |
# File 'lib/vexapion/bitflyer.rb', line 48 def executions(pair, count='', before='', after='') params = { product_code: pair.upcase } params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' public_get('executions', params) end |
#get_addresses ⇒ Hash
預入用BTC/ETHアドレス取得
94 95 96 |
# File 'lib/vexapion/bitflyer.rb', line 94 def get_addresses get('getaddresses') end |
#get_balance ⇒ Hash
資産残高を取得
82 83 84 |
# File 'lib/vexapion/bitflyer.rb', line 82 def get_balance get('getbalance') end |
#get_bank_accounts ⇒ Hash
銀行口座一覧取得
159 160 161 |
# File 'lib/vexapion/bitflyer.rb', line 159 def get_bank_accounts get('getbankaccounts') end |
#get_chats(date) ⇒ Hash
チャット
63 64 65 |
# File 'lib/vexapion/bitflyer.rb', line 63 def get_chats(date) public_get('getchats', from_date: date) end |
#get_child_orders(pair, state = '', count = '', before = '', after = '') ⇒ Hash
注文の一覧を取得 stateが指定されない場合、ACTIVE, COMPLETED, CANCELED, RXPIRED, REJECTEDのすべてが返されます。
323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/vexapion/bitflyer.rb', line 323 def get_child_orders(pair, state='', count='', before='', after='') params = { product_code: pair.upcase } params[:child_order_state] = state if state != '' params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' get('getchildorders', params) end |
#get_child_orders_parent_order_id(pair, parent_order_id) ⇒ Hash
parent_order_idに関連した注文の一覧を取得
339 340 341 342 343 344 345 346 |
# File 'lib/vexapion/bitflyer.rb', line 339 def get_child_orders_parent_order_id(pair, parent_order_id) params = { product_code: pair.upcase, parent_order_id: parent_order_id } get('getchildorders', params) end |
#get_coin_ins(count = '', before = '', after = '') ⇒ Hash
103 104 105 106 107 108 109 |
# File 'lib/vexapion/bitflyer.rb', line 103 def get_coin_ins(count='', before='', after='') params = Hash.new params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' get('getcoinins', params) end |
#get_coin_outs(count = '', before = '', after = '') ⇒ Hash
BTC/ETH送付履歴
138 139 140 141 142 143 144 145 146 |
# File 'lib/vexapion/bitflyer.rb', line 138 def get_coin_outs(count='', before='', after='') params = Hash.new #params[:message_id] = id if id != '' params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' get('getcoinouts', params) end |
#get_coin_outs_id(message_id) ⇒ hash
BTC/ETH送付状況確認
151 152 153 154 155 |
# File 'lib/vexapion/bitflyer.rb', line 151 def get_coin_outs_id() params = { message_id: } get('getcoinouts', params) end |
#get_collateral ⇒ Hash
証拠金の状態を取得
88 89 90 |
# File 'lib/vexapion/bitflyer.rb', line 88 def get_collateral get('getcollateral') end |
#get_deposits(count = '', before = '', after = '') ⇒ Hash
デポジット入金履歴
168 169 170 171 172 173 174 175 |
# File 'lib/vexapion/bitflyer.rb', line 168 def get_deposits(count='', before='', after='') params = Hash.new params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' get('getdeposits', params) end |
#get_executions(pair, count = '', before = '', after = '') ⇒ Hash
約定の一覧を取得
387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/vexapion/bitflyer.rb', line 387 def get_executions(pair, count='', before='', after='') #必須パラメータ params = { product_code: pair.upcase } params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' get('getexecutions', params) end |
#get_executions_acceptance_id(pair, child_order_acceptance_id = '') ⇒ Hash
child_order_acceptance_idに関連した約定の一覧を取得
417 418 419 420 421 422 423 424 |
# File 'lib/vexapion/bitflyer.rb', line 417 def get_executions_acceptance_id(pair, child_order_acceptance_id='') params = { product_code: pair.upcase, child_order_acceptance_id: child_order_acceptance_id } get('getexecutions', params) end |
#get_executions_child_order_id(pair, child_order_id) ⇒ Hash
child_order_idに関連した約定の一覧を取得
403 404 405 406 407 408 409 410 411 |
# File 'lib/vexapion/bitflyer.rb', line 403 def get_executions_child_order_id(pair, child_order_id) #必須パラメータ params = { product_code: pair.upcase, child_order_id: child_order_id } get('getexecutions', params) end |
#get_health ⇒ Hash
取引所の状態
69 70 71 |
# File 'lib/vexapion/bitflyer.rb', line 69 def get_health public_get('gethealth') end |
#get_permissions ⇒ Hash
APIキーの権限を取得
76 77 78 |
# File 'lib/vexapion/bitflyer.rb', line 76 def get('getpermissions') end |
#get_positions(pair) ⇒ Hash
建玉の一覧を取得
429 430 431 432 433 434 435 |
# File 'lib/vexapion/bitflyer.rb', line 429 def get_positions(pair) params = { product_code: pair.upcase } get('getpositions', params) end |
#get_withdrawals(count = '', before = '', after = '') ⇒ Hash
デポジット解約履歴(出金)
199 200 201 202 203 204 205 206 |
# File 'lib/vexapion/bitflyer.rb', line 199 def get_withdrawals(count='', before='', after='') params = Hash.new params[:count] = count if count != '' params[:before] = before if before != '' params[:after] = after if after != '' get('getwithdrawals', params) end |
#send_child_order(pair, side, price, size, expire = '', force = '') ⇒ Hash
指値で新規注文を出す
217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/vexapion/bitflyer.rb', line 217 def send_child_order(pair, side, price, size, expire='', force='') params = { product_code: pair.upcase, child_order_type: 'LIMIT', side: side.upcase, price: price, size: size.to_f } params[:minute_to_expire] = expire if expire != '' params[:time_in_force] = force if force != '' post('sendchildorder', params) end |
#send_child_order_market(pair, side, size, expire = '', force = '') ⇒ Hash
成行で新規注文を出す
238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/vexapion/bitflyer.rb', line 238 def send_child_order_market(pair, side, size, expire='', force='') params = { product_code: pair.upcase, child_order_type: 'MARKET', side: side.upcase, size: size.to_f } params[:minute_to_expire] = expire if expire != '' params[:time_in_force] = force if force != '' post('sendchildorder', params) end |
#sendcoin(currency, amount, address, fee = '', code = '') ⇒ Hash
BTC/ETH外部送付
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/vexapion/bitflyer.rb', line 118 def sendcoin(currency, amount, address, fee='', code='') params = { currency_code: currency.upcase, amount: amount.to_f, address: address, } if fee != '' fee = 0.0005 < fee.to_f ? 0.0005 : fee.to_f params[:additional_fee] = fee end params[:code] = code.to_i if code != '' post('sendcoin', params) end |
#ticker(pair) ⇒ Hash Also known as: get_ticker
Ticker
37 38 39 |
# File 'lib/vexapion/bitflyer.rb', line 37 def ticker(pair) public_get('ticker', product_code: pair.upcase) end |
#withdraw(currency, id, amount, code = '') ⇒ Hash
デポジット解約(出金)
183 184 185 186 187 188 189 190 191 192 |
# File 'lib/vexapion/bitflyer.rb', line 183 def withdraw(currency, id, amount, code='') params = { currency_code: currency.upcase, bank_account_id: id, amount: amount } params[:code] = code if code != '' post('withdraw', params) end |