Class: Vexapion::Coincheck
- Inherits:
-
BaseExchanges
- Object
- BaseExchanges
- Vexapion::Coincheck
- Defined in:
- lib/vexapion/coincheck.rb
Overview
coincheckのAPIラッパークラスです。 各メソッドの戻り値は下記URLを参照してください。
Instance Method Summary collapse
-
#accounts ⇒ Hash
アカウント情報.
-
#balance ⇒ Hash
残高.
-
#bank_accounts ⇒ Hash
銀行口座一覧.
-
#bank_withdraw(id, amount, currency = 'JPY', is_fast = false) ⇒ Hash
日本円出金申請.
-
#bank_withdraw_history ⇒ Hash
日本円出金履歴.
-
#borrow(currency, amount) ⇒ Hash
借入申請.
-
#borrow_list ⇒ Hash
借入中一覧.
-
#cancel(id) ⇒ Hash
注文のキャンセル.
-
#cancel_bank_withdraw(id) ⇒ Hash
日本円出金申請のキャンセル.
-
#close_position(pair, close_position, position_id, rate, amount) ⇒ Hash
レバレッジ決済売買.
-
#close_position_market_order(pair, close_position, position_id, amount) ⇒ Hash
(also: #close_position_without_limit)
レバレッジ決済取引(成行).
-
#delete_bank_account(id) ⇒ Hash
銀行口座の削除.
-
#deposit_accelerate(id) ⇒ Hash
ビットコインの高速入金.
-
#deposit_history(currency = 'BTC') ⇒ Hash
ビットコイン受取履歴.
-
#from_leverage(currency, amount) ⇒ Hash
レバレッジアカウントから振替.
-
#initialize(key = nil, secret = nil) ⇒ Coincheck
constructor
:stopdoc:.
-
#leverage_balance ⇒ Hash
レバレッジアカウントの残高.
-
#market_buy(pair, amount_jpy, stop_loss_rate = '') ⇒ Hash
成行注文 buyの時はamountにJPYの数量を指定する(amount_jpy円分買うという指定方法).
-
#market_order_leverage(pair, order_type, amount, stop_loss_rate = '') ⇒ Hash
レバレッジ新規取引(成行).
-
#market_sell(pair, amount, stop_loss_rate = '') ⇒ Hash
成行注文 sellの時はamountにBTCの数量を指定する.
-
#opens ⇒ Hash
未約定の注文一覧.
- #order(pair, order_type, rate, amount, stop_loss_rate = '') ⇒ Hash
-
#order_books ⇒ Hash
板情報.
-
#order_leverage(pair, order_type, rate, amount, stop_loss_rate = '') ⇒ Hash
レバレッジ新規取引.
-
#position(status = '') ⇒ Hash
ポジション一覧.
-
#rate(pair, order_type, price = '', amount = '') ⇒ Hash
レート取得.
-
#regist_bank_account(bank, branch, type, number_str, name) ⇒ Hash
銀行口座の登録.
-
#repayment(id) ⇒ Hash
返済.
-
#sales_rate(pair, price = '', amount = '') ⇒ Hash
販売所レート取得.
-
#send_history(currency = 'BTC') ⇒ Hash
ビットコイン送金履歴.
-
#send_money(address, amount) ⇒ Hash
ビットコインの送金.
-
#ticker ⇒ Hash
ティッカー.
-
#to_leverage(currency, amount) ⇒ Hash
レバレッジアカウントへ振替.
-
#trades ⇒ Array
取引履歴.
-
#transactions ⇒ Hash
約定履歴(ページネーション).
Methods inherited from BaseExchanges
#disconnect, #do_command, #get_nonce, #set_min_interval, #set_verify_mode
Constructor Details
#initialize(key = nil, secret = nil) ⇒ Coincheck
:stopdoc:
14 15 16 17 18 19 20 |
# File 'lib/vexapion/coincheck.rb', line 14 def initialize(key = nil, secret = nil) super(key, secret) @public_url = "https://coincheck.com/api/" @private_url = "https://coincheck.com/api/" set_verify_mode(OpenSSL::SSL::VERIFY_NONE) end |
Instance Method Details
#accounts ⇒ Hash
アカウント情報
297 298 299 |
# File 'lib/vexapion/coincheck.rb', line 297 def accounts get('accounts') end |
#balance ⇒ Hash
残高
256 257 258 |
# File 'lib/vexapion/coincheck.rb', line 256 def balance get('accounts/balance') end |
#bank_accounts ⇒ Hash
銀行口座一覧
306 307 308 |
# File 'lib/vexapion/coincheck.rb', line 306 def bank_accounts get('bank_accounts') end |
#bank_withdraw(id, amount, currency = 'JPY', is_fast = false) ⇒ Hash
日本円出金申請
348 349 350 351 352 353 354 355 356 357 |
# File 'lib/vexapion/coincheck.rb', line 348 def bank_withdraw(id, amount, currency = 'JPY', is_fast = false) params = { 'bank_account_id' => id, 'amount' => amount, 'currency' => currency, 'is_fast' => is_fast } post('withdraws', params) end |
#bank_withdraw_history ⇒ Hash
日本円出金履歴
338 339 340 |
# File 'lib/vexapion/coincheck.rb', line 338 def bank_withdraw_history get('withdraws') end |
#borrow(currency, amount) ⇒ Hash
借入申請
372 373 374 375 376 |
# File 'lib/vexapion/coincheck.rb', line 372 def borrow(currency, amount) params = { 'amount' => amount, 'currency' => currency } post('lending/borrows', params) end |
#borrow_list ⇒ Hash
借入中一覧
380 381 382 |
# File 'lib/vexapion/coincheck.rb', line 380 def borrow_list get('lending/borrows/matches') end |
#cancel(id) ⇒ Hash
注文のキャンセル
229 230 231 |
# File 'lib/vexapion/coincheck.rb', line 229 def cancel(id) delete("exchange/orders/#{id}") end |
#cancel_bank_withdraw(id) ⇒ Hash
日本円出金申請のキャンセル
362 363 364 |
# File 'lib/vexapion/coincheck.rb', line 362 def cancel_bank_withdraw(id) delete("withdraws/#{id}") end |
#close_position(pair, close_position, position_id, rate, amount) ⇒ Hash
レバレッジ決済売買
189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/vexapion/coincheck.rb', line 189 def close_position(pair, close_position, position_id, rate, amount) params = { 'pair' => pair.downcase, 'order_type' => "close_#{close_position.downcase}", 'position_id' => position_id.to_i, 'rate' => rate.to_f, 'amount' => amount.to_f } post('exchange/orders', params) end |
#close_position_market_order(pair, close_position, position_id, amount) ⇒ Hash Also known as: close_position_without_limit
レバレッジ決済取引(成行)
207 208 209 210 211 212 213 214 215 216 |
# File 'lib/vexapion/coincheck.rb', line 207 def close_position_market_order(pair, close_position, position_id, amount) params = { 'pair' => pair.downcase, 'order_type' => "close_#{close_position.downcase}", 'position_id' => position_id.to_i, 'amount' => amount.to_f } post('exchange/orders', params) end |
#delete_bank_account(id) ⇒ Hash
銀行口座の削除
332 333 334 |
# File 'lib/vexapion/coincheck.rb', line 332 def delete_bank_account(id) delete("bank_accounts/#{id}") end |
#deposit_accelerate(id) ⇒ Hash
ビットコインの高速入金
291 292 293 |
# File 'lib/vexapion/coincheck.rb', line 291 def deposit_accelerate(id) post("deposit_money/#{id}/fast") end |
#deposit_history(currency = 'BTC') ⇒ Hash
ビットコイン受取履歴
284 285 286 |
# File 'lib/vexapion/coincheck.rb', line 284 def deposit_history(currency = 'BTC') get('deposit_money', 'currency' => currency) end |
#from_leverage(currency, amount) ⇒ Hash
レバレッジアカウントから振替
407 408 409 410 411 |
# File 'lib/vexapion/coincheck.rb', line 407 def from_leverage(currency, amount) params = { 'currency' => currency, 'amount' => amount } post('exchange/transfers/from_leverage', params) end |
#leverage_balance ⇒ Hash
レバレッジアカウントの残高
262 263 264 |
# File 'lib/vexapion/coincheck.rb', line 262 def leverage_balance get('accounts/leverage_balance') end |
#market_buy(pair, amount_jpy, stop_loss_rate = '') ⇒ Hash
成行注文 buyの時はamountにJPYの数量を指定する(amount_jpy円分買うという指定方法)
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/vexapion/coincheck.rb', line 117 def market_buy(pair, amount_jpy, stop_loss_rate = '') params = { 'pair' => pair.downcase, 'order_type' => "market_buy", 'market_buy_amount' => amount_jpy } params['stop_loss_rate'] = stop_loss_rate if stop_loss_rate != '' post('exchange/orders', params) end |
#market_order_leverage(pair, order_type, amount, stop_loss_rate = '') ⇒ Hash
レバレッジ新規取引(成行)
171 172 173 174 175 176 177 178 179 180 |
# File 'lib/vexapion/coincheck.rb', line 171 def market_order_leverage(pair, order_type, amount, stop_loss_rate = '') params = { 'pair' => pair.downcase, 'amount' => amount.to_f, 'order_type' => "leverage_#{order_type.downcase}" } params['stop_loss_rate'] = stop_loss_rate if stop_loss_rate != '' post('exchange/orders', params) end |
#market_sell(pair, amount, stop_loss_rate = '') ⇒ Hash
成行注文 sellの時はamountにBTCの数量を指定する
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/vexapion/coincheck.rb', line 134 def market_sell(pair, amount, stop_loss_rate = '') params = { 'pair' => pair.downcase, 'order_type' => "market_sell", 'amount' => amount } params['stop_loss_rate'] = stop_loss_rate if stop_loss_rate != '' post('exchange/orders', params) end |
#opens ⇒ Hash
未約定の注文一覧
222 223 224 |
# File 'lib/vexapion/coincheck.rb', line 222 def opens get('exchange/orders/opens') end |
#order(pair, order_type, rate, amount, stop_loss_rate = '') ⇒ Hash
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/vexapion/coincheck.rb', line 99 def order(pair, order_type, rate, amount, stop_loss_rate = '') params = { 'rate' => rate, 'amount' => amount, 'pair' => pair.downcase, 'order_type' => order_type.downcase } params['stop_loss_rate'] = stop_loss_rate if stop_loss_rate != '' post('exchange/orders', params) end |
#order_books ⇒ Hash
板情報
46 47 48 |
# File 'lib/vexapion/coincheck.rb', line 46 def order_books public_get('order_books') end |
#order_leverage(pair, order_type, rate, amount, stop_loss_rate = '') ⇒ Hash
レバレッジ新規取引
153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/vexapion/coincheck.rb', line 153 def order_leverage(pair, order_type, rate, amount, stop_loss_rate = '') params = { 'pair' => pair.downcase, 'rate' => rate.to_f, 'amount' => amount.to_f, 'order_type' => "leverage_#{order_type.downcase}" } params['stop_loss_rate'] = stop_loss_rate if stop_loss_rate != '' post('exchange/orders', params) end |
#position(status = '') ⇒ Hash
ポジション一覧
248 249 250 251 252 |
# File 'lib/vexapion/coincheck.rb', line 248 def position(status='') params = Hash.new params['status'] = status if status != '' get('exchange/leverage/positions', params) end |
#rate(pair, order_type, price = '', amount = '') ⇒ Hash
レート取得
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vexapion/coincheck.rb', line 56 def rate(pair, order_type, price='', amount='') params = { 'pair' => pair.downcase, 'order_type' => order_type, } params['price'] = price if price != '' params['amount'] = amount if amount != '' public_get('exchange/orders/rate') end |
#regist_bank_account(bank, branch, type, number_str, name) ⇒ Hash
銀行口座の登録
317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/vexapion/coincheck.rb', line 317 def regist_bank_account(bank, branch, type, number_str, name) params = { 'bank_name' => bank, 'branch_name' => branch, 'bank_account_type' => type, 'number' => number_str, 'name' => name } post('bank_accounts', params) end |
#repayment(id) ⇒ Hash
返済
387 388 389 |
# File 'lib/vexapion/coincheck.rb', line 387 def repayment(id) post("lending/borrows/#{id}/repay") end |
#sales_rate(pair, price = '', amount = '') ⇒ Hash
販売所レート取得
70 71 72 73 74 75 76 |
# File 'lib/vexapion/coincheck.rb', line 70 def sales_rate(pair, price='', amount='') params = { 'pair' => pair.downcase, } public_get('exchange/orders/rate', params) end |
#send_history(currency = 'BTC') ⇒ Hash
ビットコイン送金履歴
277 278 279 |
# File 'lib/vexapion/coincheck.rb', line 277 def send_history(currency = 'BTC') get('send_money', 'currency' => currency) end |
#send_money(address, amount) ⇒ Hash
ビットコインの送金
270 271 272 |
# File 'lib/vexapion/coincheck.rb', line 270 def send_money(address, amount) post('send_money', 'address' => address, 'amount' => amount) end |
#ticker ⇒ Hash
ティッカー
34 35 36 |
# File 'lib/vexapion/coincheck.rb', line 34 def ticker public_get('ticker') end |
#to_leverage(currency, amount) ⇒ Hash
レバレッジアカウントへ振替
397 398 399 400 401 |
# File 'lib/vexapion/coincheck.rb', line 397 def to_leverage(currency, amount) params = { 'currency' => currency, 'amount' => amount } post('exchange/transfers/to_leverage', params) end |
#trades ⇒ Array
取引履歴
40 41 42 |
# File 'lib/vexapion/coincheck.rb', line 40 def trades public_get('trades') end |
#transactions ⇒ Hash
約定履歴(ページネーション)
235 236 237 |
# File 'lib/vexapion/coincheck.rb', line 235 def transactions get('exchange/orders/transactions') end |