ビットコインとシステムトレード (Bitcoin & Automated Algorithmic Trading)

ビットコインの自動売買システム構築とトレード実践結果 (Automatic Bitcoin Trading System Implementation and Trading Result)

ビットコインのHFT(高頻度取引)は可能か? - Is Bitcoin HFT (high frequency trading) possible in Japan?

f:id:deshita:20170205210955j:plain

日本のビットコイン取引所でHFT(高頻度取引)は可能なのか、検証してみました。

条件

  • 国内最大規模で取引所システム性能が最も良いであろうbitFlyerが対象
  • Public APIの基本であるTicker取得を利用
  • 非同期処理で400ms間隔で100回のリクエストを送信(100〜300msでリクエストを投げても結果が返ってこず。取引所側でリクエスト制限を設けている模様)
  • 取引所が正常稼働している状態で測定(=gethealthで取得した取引所の状態がNORMAL)

結果

左側:timestampの値とその回数(同じ値が何度も返ってきている)

右側:各秒間において何種類の値が返ってきたかのカウント

f:id:deshita:20170205191552p:plain

右側をグラフ化しました。400ms間隔で投げているので、理論上は1秒間に最低2種類の値が返ってくるはず。しかし、取引所が提供するticker情報の更新はそこまで高速ではないようです。おおよそTPS(ticker per second)=1〜2程度です。

f:id:deshita:20170205185549p:plain

ticker取得でこの速度であるため、板情報取得や注文などはもっと遅いでしょうね。もっとも、内部で膨大な量のオーダーマッチングを行っているわけで、これでも莫大なサーバリソースが投入された末に実現されていることでしょうが。。

結論

株式市場で行われているようなミリ秒レベルのHFTは現状無理。現実的なところは、せいぜい1秒間隔での取引(Realtime APIを駆使すれば多少違うかも)。

気が向いたら日本国内取引所間の比較を行ってみて、「その2」として記事にします。

I tried to verify whether HFT (High Frequency Trading) is possible at the bitcoin exchange in Japan.

Conditions

  • For bitFlyer that is the largest in Japan and would have the best exchange system performance
  • Use Ticker acquisition which is the basis of Public API
  • Sending 100 requests at asynchronous processing at 400 ms intervals (Results are not returned even if I throw requests in 100 - 300 ms , it seems that exchanges have request limits)
  • Measurement with exchanges operating normally (= the state of the exchange acquired with = gethealth is NORMAL)

Result

Left side: timestamp value and its number (same value has been returned many times)

Right side: Count of how many kinds of distinct values ​​are returned in each second

I graphed the right side. Since it is thrown with intervals of 400 ms, in theory at least two kinds of values ​​will be returned in one second. However, it seems that updating the ticker information provided by the exchange is not so fast. Approximately TPS (ticker per second) = about 1 to 2.

Because this speed is acquired by ticker acquisition , board information acquisition and buy/sell order etc might be slower. However, the exchange are doing an enormous amount of order matching internally, so even this performance is achieved after huge server resource introduction. .

Conclusion

Millisecond level HFT as it is done in stock markets is impossible at present. The realistic thing is that at most, trading at 1 second intervals (it may differ somewhat if Realtime API is used).

If you feel like it, I will try comparing performance among domestic exchanges in Japan and write it as "Part 2".