Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoine での 約定数量確認エラーについて #149

Open
ohiro19 opened this issue Dec 12, 2018 · 6 comments
Open

Quoine での 約定数量確認エラーについて #149

ohiro19 opened this issue Dec 12, 2018 · 6 comments

Comments

@ohiro19
Copy link

ohiro19 commented Dec 12, 2018

Quoine に注文後 約定の確認時にエラーが発生し、実際は約定していてもR2からみると約定していないように見えているようです。
具体的にはQuoin買 Coincheck売 の発注をした際、Web上からは両方約定したのが見えたのですが、
R2ではChecking if both legs are done or not...で以下のエラーが発生し、Coincheckで買い戻しされてしまいました。原因ご教示いただけますでしょうか。よろしくお願いします。

R2のコンソール
2018-12-12 23:11:58.002 INFO Expected profit : 1 (0.026%)
2018-12-12 23:11:58.003 INFO >>Found arbitrage oppotunity.
2018-12-12 23:11:58.003 INFO >>Sending order targetting quote Quoine Ask 386,900 0.24...
2018-12-12 23:11:58.005 INFO >>Sending order targetting quote Coincheck Bid 387,000 0.231...
2018-12-12 23:12:00.385 INFO >>Order check attempt 1.
2018-12-12 23:12:00.385 INFO >>Checking if both legs are done or not...
2018-12-12 23:12:00.780 WARN Cannot read property 'toString' of null
2018-12-12 23:12:00.781 WARN >>Pending: Quoine Buy 0.01 BTC sent at 386,900, pending size 0.01 BTC

ログ
018-12-12 23:12:00.662 DEBUG [QuoteAggregator] Aggregator is already running. Skipped iteration.
2018-12-12 23:12:00.779 DEBUG [WebClient] Response from https://api.quoine.com/orders/633540160. Status Code: 200 (OK)
2018-12-12 23:12:00.779 DEBUG [WebClient] Response content from https://api.quoine.com/orders/633540160: {"id":633540160,"order_type":"limit","quantity":"0.01","disc_quantity":"0.0","iceberg_total_quantity":"0.0","side":"buy","filled_quantity":"0.01","price":386900,"created_at":1544623921,"updated_at":1544623921,"status":"filled","leverage_level":1,"source_exchange":"QUOINE","product_id":5,"product_code":"CASH","funding_currency":"JPY","crypto_account_id":null,"currency_pair_code":"BTCJPY","average_price":386900,"target":"spot","order_fee":"0.0","source_action":"manual","unwound_trade_id":null,"trade_id":null,"settings":null,"trailing_stop_type":null,"trailing_stop_value":null,"executions":[{"id":75811780,"quantity":"0.01","price":"386900.0","taker_side":"sell","created_at":1544623921,"my_side":"buy"},{"id":75811780,"quantity":"0.01","price":"386900.0","taker_side":"sell","created_at":1544623921,"my_side":"buy"}],"stop_triggered_time":null}
2018-12-12 23:12:00.780 WARN [PairTrader] Cannot read property 'toString' of null
2018-12-12 23:12:00.780 DEBUG [PairTrader] TypeError: Cannot read property 'toString' of null
at OrdersResponse.convert (C:\Users\aaa\r2\node_modules@bitr\castable\dist\castable.js:41:31)
at Castable.Object.getOwnPropertyNames.forEach.propertyKey (C:\Users\aaa\r2\node_modules@bitr\castable\dist\castable.js:28:38)
at Array.forEach ()
at new Castable (C:\Users\aaa\r2\node_modules@bitr\castable\dist\castable.js:24:44)
at new OrdersResponse (C:\Users\aaa\r2\dist\Quoine\types.js:140:1)
at BrokerApi. (C:\Users\aaa\r2\dist\Quoine\BrokerApi.js:37:20)
at Generator.next ()
at fulfilled (C:\Users\aaa\r2\dist\Quoine\BrokerApi.js:4:58)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
2018-12-12 23:12:00.781 WARN [PairTrader] >>Pending: Quoine Buy 0.01 BTC sent at 386,900, pending size 0.01 BTC
2018-12-12 23:12:00.781 INFO [PairTrader] >>Filled: Coincheck Sell 0.01 BTC filled at 387,310
2018-12-12 23:12:00.830 DEBUG [PositionService] Refreshing positions...

@Otomaru3
Copy link

私も同じ事象が発生しています。
最近で12/8には正常に動作していたのですが、今日12/20は複数回連続で失敗しています。Quoine側のレスポンスが変わった様に思えますが、成功時のログは流れてしまったので定かではないです。。

@ohiro19
Copy link
Author

ohiro19 commented Dec 22, 2018

Otomaru3 さん

成功時のレスポンス引っ張り出してきました。filled_quaitityのところが違うかなーと思っていたのですが、以前と変わりないですね。。(上:成功時 下:失敗時)

{"id":405788586,"order_type":"limit","quantity":"0.01","disc_quantity":"0.0","iceberg_total_quantity":"0.0","side":"sell","filled_quantity":"0.01","price":702000,"created_at":1534096045,"updated_at":1534096045,"status":"filled","leverage_level":1,"source_exchange":"QUOINE","product_id":5,"product_code":"CASH","funding_currency":"JPY","crypto_account_id":null,"currency_pair_code":"BTCJPY","average_price":"702070.05","target":"spot","order_fee":"0.0","source_action":"manual","unwound_trade_id":null,"trade_id":null,"settings":null,"trailing_stop_type":false,"trailing_stop_value":false,"executions":[{"id":49232522,"quantity":"0.01","price":"702070.05","taker_side":"sell","created_at":1534096045,"my_side":"sell"}],"stop_triggered_time":null}

{"id":633540160,"order_type":"limit","quantity":"0.01","disc_quantity":"0.0","iceberg_total_quantity":"0.0","side":"buy","filled_quantity":"0.01","price":386900,"created_at":1544623921,"updated_at":1544623921,"status":"filled","leverage_level":1,"source_exchange":"QUOINE","product_id":5,"product_code":"CASH","funding_currency":"JPY","crypto_account_id":null,"currency_pair_code":"BTCJPY","average_price":386900,"target":"spot","order_fee":"0.0","source_action":"manual","unwound_trade_id":null,"trade_id":null,"settings":null,"trailing_stop_type":null,"trailing_stop_value":null,"executions":[{"id":75811780,"quantity":"0.01","price":"386900.0","taker_side":"sell","created_at":1544623921,"my_side":"buy"},{"id":75811780,"quantity":"0.01","price":"386900.0","taker_side":"sell","created_at":1544623921,"my_side":"buy"}],"stop_triggered_time":null}

@Otomaru3
Copy link

Otomaru3 commented Dec 25, 2018

ohiro19さん

成功時のレスポンスありがとうございます。

成功時には

"trailing_stop_type":false,
"trailing_stop_value":false,

となっているレスポンスが

失敗時には

"trailing_stop_type":null,
"trailing_stop_value":null,

となっていると思います。

trailing_stop_type, trailing_stop_value は以下でbooleanであることが定義されていて、そこでエラーになっているようです。

@cast trailing_stop_type: boolean;

この値がなんの判定にも使われていないのであれば、ここを boolean から any に変えてしまってもいいかもしれませんが、わかりません。

21日時点でQuoineから「APIの仕様変更はない」と回答をもらっていますが、怪しいのでもう一回聞いてみます。

@ohiro19
Copy link
Author

ohiro19 commented Dec 25, 2018

Otomaru3さん

対応方法まで記載いただいてありがとうございます。
anyに変えてしばらく動かしてみましたが、正しく動いているように見えますね。
また問題があれば報告します。

@tazima3469
Copy link

Liquid(Quoine)の同じ悩みでたどり着きました。
anyに変更してみましたが、また同じような現象が発生しておりますが皆さんはどのような状態でしょうか?

@ohiro19
Copy link
Author

ohiro19 commented Dec 29, 2018

anyに変更してからは問題なく稼働しています

coin-comachi added a commit to coin-comachi/r2 that referenced this issue Jan 24, 2019
「TypeError: Cannot read property 'toString' of null」
約定数量確認時に上記エラーが発生した。
対応として
- APIで定義されていないレスポンスを、any へ変更した。
- trailing_stop_type、trailing_stop_value については type.ts上ではboolean型で定義されており、APIでは、何も定義されていない。かなり怪しいので定義自体を削除しました。

参考:
bitrinjani#149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants