bitrinjani / r2

R2 Bitcoin Arbitrager is an automatic arbitrage trading system powered by Node.js + TypeScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coincheckのエラーについて

poiudasiope opened this issue · comments

このようなプログラムを作ってくださりありがとうございます。
先日格闘の末、プログラムが走ってオープンとクローズをしてるのを見て感動しました。
WEB UIが視覚的にわかりやすくともて便利だと思いました。

しかしとあるタイミングでCCのエラーが見受けられ、
ポジションを片がけしたまま停止するような挙動になりました。
プログラムは本日付で最新版で、uninstallも試しましたが同様の状態が見受けられます。

エラーは
HTTP request failed. Response from https://coincheck.com/api/exchange/orders. Status Code: 400 (Bad Request) Content: {"success":false,"error":"Amount BTC の所持金額が足りません"}

エラーの意味としては所持してるBTCが足りないとのことだと思うのですが、たしか現物口座でもcashMarginTypeでもCashであればショートは可能ではなかったかなと思った次第です。

config.jsonの当該個所としては

},
"onSingleLeg": {
"action": "Reverse",
"actionOnExit": "Proceed",
"options": {
"limitMovePercent": 8,
"ttl": 5000
}

{
  "broker": "Coincheck",
  "enabled": true,
  "key": "xxxxxxxxxxxxxxx",
  "secret": "xxxxxxxxxxxxxxx",
  "maxLongPosition": 0.015,
  "maxShortPosition": 0.015,
  "cashMarginType": "Cash",
  "commissionPercent": 0
},

を設定しています。

CCの通常の取引アカウントでもショートできたのではなかったかということと、
仮に注文が成立しなかった場合、片がけにはならず反対売買されないので、
コード上設定が間違っている個所があればお教えいただけませんでしょうか。

dubug.logをこちらに貼っておきます。

2018-03-15 01:39:46.993 INFO [Arbitrager] --------------------ARBITRAGER--------------------
2018-03-15 01:39:46.993 INFO [OppotunitySearcher] 裁定機会をチェック中...
2018-03-15 01:39:47.019 DEBUG [WebClient] Response from https://api.quoine.com/trading_accounts. Status Code: 200 (OK)
2018-03-15 01:39:47.022 DEBUG [SpreadAnalyzer] Analysis done. Result: {"bid":{"broker":"Coincheck","side":"Bid","price":918300,"volume":0.6599999999999999},"ask":{"broker":"Quoine","side":"Ask","price":908700,"volume":0.355928},"invertedSpread":9600,"availableVolume":0.355,"targetVolume":0.01,"targetProfit":96,"profitPercentAgainstNotional":1.051}
2018-03-15 01:39:47.022 INFO [OppotunitySearcher] ベストアスク : Quoine Ask 908,700 0.356
2018-03-15 01:39:47.022 INFO [OppotunitySearcher] ベストビッド : Coincheck Bid 918,300 0.66
2018-03-15 01:39:47.022 INFO [OppotunitySearcher] スプレッド : -9600
2018-03-15 01:39:47.022 INFO [OppotunitySearcher] 裁定可能数量 : 0.355
2018-03-15 01:39:47.022 INFO [OppotunitySearcher] 目標数量 : 0.01
2018-03-15 01:39:47.022 INFO [OppotunitySearcher] 予想収益 : 96 (1.051%)
2018-03-15 01:39:47.029 DEBUG [MainLimitChecker] MaxNetExposureLimit passed
2018-03-15 01:39:47.029 DEBUG [MainLimitChecker] InvertedSpreadLimit passed
2018-03-15 01:39:47.029 DEBUG [MainLimitChecker] MinTargetProfitLimit passed
2018-03-15 01:39:47.029 DEBUG [MainLimitChecker] MaxTargetProfitLimit passed
2018-03-15 01:39:47.030 DEBUG [MainLimitChecker] MaxTargetVolumeLimit passed
2018-03-15 01:39:47.030 DEBUG [MainLimitChecker] DemoModeLimit passed
2018-03-15 01:39:47.030 INFO [OppotunitySearcher] >>裁定機会を発見。
2018-03-15 01:39:47.034 INFO [PairTrader] >>オーダーを送信中... 目標価格 Quoine Ask 908,700 0.356
2018-03-15 01:39:47.035 DEBUG [BrokerAdapterRouter] [object Object]
2018-03-15 01:39:47.035 DEBUG [WebClient] Sending HTTP request... URL: https://api.quoine.com/orders/ Request: {"method":"POST","headers":{"Content-Type":"application/json","X-Quoine-API-Version":"2","X-Quoine-Auth":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},"body":"{"order":{"price":908700,"product_id":"5","order_direction":"netout","order_type":"limit","side":"buy","quantity":0.01,"leverage_level":10}}"}
2018-03-15 01:39:47.036 INFO [PairTrader] >>オーダーを送信中... 目標価格 Coincheck Bid 918,300 0.66
2018-03-15 01:39:47.037 DEBUG [BrokerAdapterRouter] [object Object]
2018-03-15 01:39:47.038 DEBUG [WebClient] Sending HTTP request... URL: https://coincheck.com/api/exchange/orders Request: {"method":"POST","headers":{"ACCESS-KEY":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","ACCESS-NONCE":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","ACCESS-SIGNATURE":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","Content-Type":"application/x-www-form-urlencoded"},"body":"pair=btc_jpy&order_type=sell&amount=0.01&rate=918300"}
2018-03-15 01:39:47.048 DEBUG [WebClient] Response content from https://api.quoine.com/trading_accounts: [{"id":944288,"leverage_level":2,"max_leverage_level":2,"current_leverage_level":2,"pnl":"0.0","equity":"0.005","margin":"0.0","free_margin":"0.005","trader_id":217416,"status":"active","product_code":"CASH","currency_pair_code":"ETHBTC","position":0,"balance":"0.005","created_at":1516273171,"updated_at":1516273171,"pusher_channel":"trading_account_944288","margin_percent":"0.1","product_id":37,"funding_currency":"BTC"},{"id":944289,"leverage_level":2,"max_leverage_level":2,"current_leverage_level":2,"pnl":"0.0","equity":"0.0","margin":"0.0","free_margin":"0.0","trader_id":217416,"status":"active","product_code":"CASH","currency_pair_code":"QASHETH","position":0,"balance":"0.0","created_at":1516273171,"updated_at":1516273171,"pusher_channel":"trading_account_944289","margin_percent":"0.1","product_id":51,"funding_currency":"ETH"},{"id":944290,"leverage_level":2,"max_leverage_level":2,"current_leverage_level":2,"pnl":"0.0","equity":"0.0","margin":"0.0","free_margin":"0.0","trader_id":217416,"status":"active","product_code":"CASH","currency_pair_code":"UBTCQASH","position":0,"balance":"0.0","created_at":1516273171,"updated_at":1516273171,"pusher_channel":"trading_account_944290","margin_percent":"0.1","product_id":76,"funding_currency":"QASH"},{"id":944291,"leverage_level":2,"max_leverage_level":2,"current_leverage_level":2,"pnl":"-494.43","equity":"23391.9831","margin":"1877.62698","free_margin":"21514.35612","trader_id":217416,"status":"active","product_code":"CASH","currency_pair_code":"BTCJPY","position":"0.02","balance":"23886.4131","created_at":1516273171,"updated_at":1516273171,"pusher_channel":"trading_account_944291","margin_percent":"0.1","product_id":5,"funding_currency":"JPY"},{"id":944292,"leverage_level":2,"max_leverage_level":2,"current_leverage_level":2,"pnl":"0.0","equity":"0.0","margin":"0.0","free_margin":"0.0","trader_id":217416,"status":"active","product_code":"CASH","currency_pair_code":"BTCUSD","position":0,"balance":"0.0","created_at":1516273171,"updated_at":1516273171,"pusher_channel":"trading_account_944292","margin_percent":"0.1","product_id":1,"funding_currency":"USD"},{"id":944297,"leverage_level":2,"max_leverage_level":2,"current_leverage_level":2,"pnl":"0.0","equity":"0.0","margin":"0.0","free_margin":"0.0","trader_id":217416,"status":"active","product_code":"CASH","currency_pair_code":"BTCSGD","position":0,"balance":"0.0","created_at":1516273212,"updated_at":1516273212,"pusher_channel":"trading_account_944297","margin_percent":"0.1","product_id":7,"funding_currency":"SGD"}]
2018-03-15 01:39:47.164 DEBUG [PositionService] Finished refresh.
2018-03-15 01:39:47.260 DEBUG [WebClient] Response from https://coincheck.com/api/exchange/orders. Status Code: 400 (Bad Request)
2018-03-15 01:39:47.262 ERROR [Arbitrager] HTTP request failed. Response from https://coincheck.com/api/exchange/orders. Status Code: 400 (Bad Request) Content: {"success":false,"error":"Amount BTC の所持金額が足りません"}
2018-03-15 01:39:47.262 DEBUG [Arbitrager] Error: HTTP request failed. Response from https://coincheck.com/api/exchange/orders. Status Code: 400 (Bad Request) Content: {"success":false,"error":"Amount BTC の所持金額が足りません"}
at WebClient. (C:\Users\unitaro\r2-master\dist\WebClient.js:28:23)
at Generator.next ()
at fulfilled (C:\Users\unitaro\r2-master\dist\WebClient.js:4:58)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
2018-03-15 01:39:47.262 INFO [Arbitrager] >>5000 ms スリープ中...

過去のイシューを参照して下さい。
#74

Cashであればショートは可能ではなかったかなと思った次第です。
⇒それは信用取引です。

@Connie-Wild ご親切にご回答いただきましてありがとうございます。
ショートできたと思えたのは勝手な感違いでした。
すみません・・・