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
A new instance of Coincheck.
-
#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
#do_command, #error_check, #get_nonce, #set_min_interval, #set_verify_mode
Constructor Details
#initialize(key = nil, secret = nil) ⇒ Coincheck
Returns a new instance of Coincheck.
13 14 15 16 17 18 19 |
# File 'lib/vexapion/coincheck.rb', line 13 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
アカウント情報
295 296 297 |
# File 'lib/vexapion/coincheck.rb', line 295 def accounts get('accounts') end |
#balance ⇒ Hash
残高
254 255 256 |
# File 'lib/vexapion/coincheck.rb', line 254 def balance get('accounts/balance') end |
#bank_accounts ⇒ Hash
銀行口座一覧
304 305 306 |
# File 'lib/vexapion/coincheck.rb', line 304 def bank_accounts get('bank_accounts') end |
#bank_withdraw(id, amount, currency = 'JPY', is_fast = false) ⇒ Hash
日本円出金申請
346 347 348 349 350 351 352 353 354 355 |
# File 'lib/vexapion/coincheck.rb', line 346 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
日本円出金履歴
336 337 338 |
# File 'lib/vexapion/coincheck.rb', line 336 def bank_withdraw_history get('withdraws') end |
#borrow(currency, amount) ⇒ Hash
借入申請
370 371 372 373 374 |
# File 'lib/vexapion/coincheck.rb', line 370 def borrow(currency, amount) params = { 'amount' => amount, 'currency' => currency } post('lending/borrows', params) end |
#borrow_list ⇒ Hash
借入中一覧
378 379 380 |
# File 'lib/vexapion/coincheck.rb', line 378 def borrow_list get('lending/borrows/matches') end |
#cancel(id) ⇒ Hash
注文のキャンセル
227 228 229 |
# File 'lib/vexapion/coincheck.rb', line 227 def cancel(id) delete("exchange/orders/#{id}") end |
#cancel_bank_withdraw(id) ⇒ Hash
日本円出金申請のキャンセル
360 361 362 |
# File 'lib/vexapion/coincheck.rb', line 360 def cancel_bank_withdraw(id) delete("withdraws/#{id}") end |
#close_position(pair, close_position, position_id, rate, amount) ⇒ Hash
レバレッジ決済売買
187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/vexapion/coincheck.rb', line 187 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
レバレッジ決済取引(成行)
205 206 207 208 209 210 211 212 213 214 |
# File 'lib/vexapion/coincheck.rb', line 205 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
銀行口座の削除
330 331 332 |
# File 'lib/vexapion/coincheck.rb', line 330 def delete_bank_account(id) delete("bank_accounts/#{id}") end |
#deposit_accelerate(id) ⇒ Hash
ビットコインの高速入金
289 290 291 |
# File 'lib/vexapion/coincheck.rb', line 289 def deposit_accelerate(id) post("deposit_money/#{id}/fast") end |
#deposit_history(currency = 'BTC') ⇒ Hash
ビットコイン受取履歴
282 283 284 |
# File 'lib/vexapion/coincheck.rb', line 282 def deposit_history(currency = 'BTC') get('deposit_money', 'currency' => currency) end |
#from_leverage(currency, amount) ⇒ Hash
レバレッジアカウントから振替
405 406 407 408 409 |
# File 'lib/vexapion/coincheck.rb', line 405 def from_leverage(currency, amount) params = { 'currency' => currency, 'amount' => amount } post('exchange/transfers/from_leverage', params) end |
#leverage_balance ⇒ Hash
レバレッジアカウントの残高
260 261 262 |
# File 'lib/vexapion/coincheck.rb', line 260 def leverage_balance get('accounts/leverage_balance') end |
#market_buy(pair, amount_jpy, stop_loss_rate = '') ⇒ Hash
成行注文buyの時はamountにJPYの数量を指定する(amount_jpy円分買うという指定方法)
115 116 117 118 119 120 121 122 123 124 |
# File 'lib/vexapion/coincheck.rb', line 115 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
レバレッジ新規取引(成行)
169 170 171 172 173 174 175 176 177 178 |
# File 'lib/vexapion/coincheck.rb', line 169 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の数量を指定する
132 133 134 135 136 137 138 139 140 141 |
# File 'lib/vexapion/coincheck.rb', line 132 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
未約定の注文一覧
220 221 222 |
# File 'lib/vexapion/coincheck.rb', line 220 def opens get('exchange/orders/opens') end |
#order(pair, order_type, rate, amount, stop_loss_rate = '') ⇒ Hash
97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/vexapion/coincheck.rb', line 97 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
板情報
44 45 46 |
# File 'lib/vexapion/coincheck.rb', line 44 def order_books public_get('order_books') end |
#order_leverage(pair, order_type, rate, amount, stop_loss_rate = '') ⇒ Hash
レバレッジ新規取引
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/vexapion/coincheck.rb', line 151 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
ポジション一覧
246 247 248 249 250 |
# File 'lib/vexapion/coincheck.rb', line 246 def position(status='') params = Hash.new params['status'] = status if status != '' get('exchange/leverage/positions', params) end |
#rate(pair, order_type, price = '', amount = '') ⇒ Hash
レート取得
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vexapion/coincheck.rb', line 54 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
銀行口座の登録
315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/vexapion/coincheck.rb', line 315 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
返済
385 386 387 |
# File 'lib/vexapion/coincheck.rb', line 385 def repayment(id) post("lending/borrows/#{id}/repay") end |
#sales_rate(pair, price = '', amount = '') ⇒ Hash
販売所レート取得
68 69 70 71 72 73 74 |
# File 'lib/vexapion/coincheck.rb', line 68 def sales_rate(pair, price='', amount='') params = { 'pair' => pair.downcase, } public_get('exchange/orders/rate', params) end |
#send_history(currency = 'BTC') ⇒ Hash
ビットコイン送金履歴
275 276 277 |
# File 'lib/vexapion/coincheck.rb', line 275 def send_history(currency = 'BTC') get('send_money', 'currency' => currency) end |
#send_money(address, amount) ⇒ Hash
ビットコインの送金
268 269 270 |
# File 'lib/vexapion/coincheck.rb', line 268 def send_money(address, amount) post('send_money', 'address' => address, 'amount' => amount) end |
#ticker ⇒ Hash
ティッカー
32 33 34 |
# File 'lib/vexapion/coincheck.rb', line 32 def ticker public_get('ticker') end |
#to_leverage(currency, amount) ⇒ Hash
レバレッジアカウントへ振替
395 396 397 398 399 |
# File 'lib/vexapion/coincheck.rb', line 395 def to_leverage(currency, amount) params = { 'currency' => currency, 'amount' => amount } post('exchange/transfers/to_leverage', params) end |
#trades ⇒ Array
取引履歴
38 39 40 |
# File 'lib/vexapion/coincheck.rb', line 38 def trades public_get('trades') end |
#transactions ⇒ Hash
約定履歴(ページネーション)
233 234 235 |
# File 'lib/vexapion/coincheck.rb', line 233 def transactions get('exchange/orders/transactions') end |