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

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

Quoine, BtcBox, coincheck, zaif, そしてbitFlyer その2 - The latest situation of Japanese Bitcoin exchange competition Part 2






bitFlyer >>> Quoine > coincheck = zaif >>> BTCBOX >>> Kraken


Quoine = coincheck = zaif > bitFlyer >>> BtcBox >>> Kraken

  • bitFlyerはFX部分で解決すべき問題があるはずで、FXはここでは考慮から除外。
  • Quoineは恒常的に割安だったことが多く、そこがトレーダーの不安を掻き立てていた部分があったかと。最近は落ち着いてきて、不安が払拭されつつある(はず)。トレード画面の使い勝手は良いが、痒いところに手が届いていない印象。
  • coincheckは読みどおり躍進。地道な改良を積み重ねて攻めモード。
  • zaifは正直どの部分が支持されているのか、まだあまりわかっていません。。
  • BtcBox/Krakenは今後の取引所競争に勝ち抜いていくにはもう厳しいのではないか(撤退もありえる?)



As the situation in JP Bitcoin market has been changed since I wrote my previous entry , I wrote this part 2 post. My forecast was that in February and March it seemed that the following volume-share composition would continue.

BitFlyer >>> Quoine > coincheck = zaif >>> BTCBOX >>> Kraken

However, it has changed significantly just in one month, and at this time it looks like this.

Quoine = coincheck = zaif > bitFlyer >>> BtcBox >>> Kraken

  • Since bitFlyer seems to have problems to be solved in the FX part, FX is excluded from consideration here.
  • Quoine's price was often cheap on a permanent basis, and there was a part that was stirring up traders' anxiety. Recently it has calmed down, anxiety is being dispelled (should be). Usability of the trade screen is good, but my impression that hands have not reached the itchy place.
  • Coincheck has increased its presence as I expected. Steady improvements are accumulated and they are in attacking mode.
  • Honestly speaking about Zaif, I am not sure what part is supported by traders..
  • Is not BtcBox / Kraken severe enough to win exchange competition. (I think there is a possiblity of exit from JP market)

Also, looking overseas, after the collapse of the CNY zone, it seems that the following price composition is continuing. It is unsure whether effective arbitrage transaction can be done considering deposit from fiat, overseas remmittance fee, and the required number of days for overseas remittance. This is the topic I want to continue verifying more.


日本のビットコイン相場を暴落させるために必要な資金量 - The amount of funds necessary to crash Japanese largest bitcoin market






Crash after continued rising. It is a typical movement in bitcoin market. Does the day when we can use bitcoin as stable settlement currency come. .?

For your reference, I tried calculating based on the board information (bitFlyer spot) as to how much amount of funds is required to give such a crash impact to its market price.

The result is as follows and it is a case where we execute market sell orders at a time. Actually, others' reaction may boost it, so the necessary amount of funds may be less.

If we spend 150 million yen it can fall by 10%, if it is 400 million yen it can be dropped by 30%. My impression is that it is less than I expected. Now that it is thought that abundant Chinese money is flowing into JP BTC market, it may be possible to act to temporarily confuse the market with such maneuvering. 



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



  • bitFlyer/QuoineがCalifornia、
  • Zaif/coincheck/BtcBoxがTokyo(AWS)



I examined which location the API provider's host of each Japanese bitcoin exchange is registered. Here is the result.

  • BitFlyer / Quoine is California,
  • Zaif / coincheck / BtcBox is Tokyo ( AWS )

This is just where the entry point of requests is and does not indicate how the physical backend composition is built. However, if response latency seems to be a bottleneck , it may need to be taken into consideration, as your reference, such as aligning with the location of the request source ( VPS etc.) as close as possible.


api.bitflyer.jp Incapsula Redwood City California
api.quoine.com (IP) CloudFlare San Francisco California
api.zaif.jp ec2-52-69-226-84.ap-northeast-1.compute.amazonaws.com Amazon Technologies Tokyo Tokyo
coincheck.com ec2-52-68-5-65.ap-northeast-1.compute.amazonaws.com Amazon Technologies Tokyo Tokyo
www.btcbox.co.jp ec2-52-69-156-194.ap-northeast-1.compute.amazonaws.com Amazon Technologies Tokyo Tokyo

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




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





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




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


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


  • 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)


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. .


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".


ビットコインをbitFlyer上で自動取引するbotのコア部分である発注機能(成行注文版)のRubyソースコードを公開します(エラーハンドリングが甘いですが、、間違いや改善点があれば教えてくださいm(_ _)m)。指値注文も、LIMITとpriceを指定すれば簡単に実装できます。product_codeを指定することで、現物にもFXにも使えます。ササッとアイデアを実装に落とし込めるのは、やはりRubyの強みですね。



require 'uri'
require 'net/http'
require 'time'
require 'securerandom'
require 'base64'
require 'json'




def order(product_code, buy_sell, size)
    timestamp = Time.now.to_i.to_s
    uri = URI.parse("https://api.bitflyer.jp")
    uri.path = "/v1/me/sendchildorder"

    body = '{
        "product_code" : "' + product_code + '",
        "child_order_type" : "MARKET",
        "side" : "' + buy_sell + '",
        "size" : ' + size.to_s + ',
        "minute_to_expire" : 10000,
        "time_in_force" : "GTC"

    text = timestamp + 'POST' + uri.request_uri + body
    sign = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"), API_SECRET, text)
    options = Net::HTTP::Post.new(uri.request_uri, initheader = {
        "ACCESS-KEY" => API_KEY,
        "ACCESS-TIMESTAMP" => timestamp,
        "ACCESS-SIGN" => sign,
        "Content-Type" => "application/json"
    options.body = body
    https = Net::HTTP.new(uri.host, uri.port)
    https.use_ssl = true
    response = https.request(options)
    result = JSON.parse(response.body)

    if (result['status'] == -201) then
        puts ' ' + product_code + ' ' + buy_sell + " You have reached the maximum amount of trades for your account class."
        return false
    if (result['child_order_acceptance_id'] == nil) then
        puts ' ' + product_code + ' ' + buy_sell + " Insufficient funds"
        return false
    if (result['child_order_acceptance_id'] != nil) then
        puts ' ' + product_code + ' ' + buy_sell + " id:" + result['child_order_acceptance_id'] + " size:" + size.to_s
    return true



詐欺コインの蔓延がbotトレーダーを生かす - Fraud coin spread keeps on Bitcoin bot traders alive




ビットコイン( or 世界取引高がせいぜい10位以内の仮想通貨)を取引されている情強トレーダーの皆様方には無縁でしょう。でもこれ、botトレーダーにとっては結構喜ばしいことではないでしょうか?




  • やましい使い方(資金洗浄や資産逃避)
  • ねずみ講まがいの詐欺コインやHYIP
  • 取引所の破綻やハッキング事件


  • 中国政府による規制
  • ネット上の正義(検証サイトなど)による詐欺の浄化・啓蒙活動
  • 取引所による政府に対するロビー活動


  • 大手資本によるFintechの後押し
  • FXからのプレイヤー流入
  • 大手FX業者がビットコイン取引所を開設
  • 取引手法の情報商材化が進行
  • bot開発者が武器商人化し、botがEA化


  • ほど良く胡散臭くて、(ある意味で)まともな人たちは参入できない
  • Mt.Gox事件からの教訓に学び、インフラや法規制が進みつつある
  • ガチな人(文字通り資本の桁が違うファンドなど)が浮動コイン取引に参入していない


If "Bitcoin" is said to be common in the public in general, isn't it "a dubious financial product we cannot understand"? Recently the platform has been improved, so it is an era when anyone can easily create their own virtual currency. As a result, virtual fraud / ponzi scheme type of virtual currency is also born (of course disappeared at the same time).

The virtual currency is a big business material that is hot in the fraud industry (as it is said to be "the past highest"). In the first place, there is no real entity and there are also plenty of cases of similar price rise (including bitcoin ) in the past. "Bitcoin price has been already rising enough, but for the crypto currency for which we are sales agents..."

It will be immune to the people of the empowerment traders who are trading bitcoins (or virtual currencies with world trading volume at most 10th place). But this is quite happy for bot traders, isn't it?

Although there is a feeling of being honest and exhausted, such as a variation related to charity and industrial promotion, the world which the fraudster and empathy will spread will continue for a few years, fraud is caught · HYIP collapses. While the industry is purifying, the image of bitcoin is dragged out every time it is reported in the news, .... "Yeah, a big welcome." I imagine such traders are surprisingly large.

In the world, there are factors that improve the image of the bitcoin and factors to make it worse, the factor to make it worse boosts the volatility of the price. For traders, I wonder if there are more people to look at, even though they do not agitate it.

Elements that worsen the image of bit coin (increase long-term volatility)

  • Frugal usage (money wash and asset flight)
  • Ponzi Scheme coins and HYIP
  • Exchange bankruptcy and hacking incidents

Elements that improve the image of bit coins (lower long-term volatility)

  • Regulation by the Chinese government
  • Purification and awareness raising of fraud by online justice (verification site etc.)
  • Lobby activity by the bitcoin exchange to the government

While repeating image and trust up / down,

  • Boosting Fintech with major capital
  • Player inflow from FX
  • Major FX operator opens bitcoin exchange
    (However, if you do not decrease the commission to 0% trading volume will not increase, it will be worn out)
  • Advancement of trading method information commercialization progress
  • Bot developers become arms merchants, bot becomes EA in FX industry

After such a future, in the long term, bitcoin will gain stability of the legal currency level of the emerging countries and settle as a speculation tool to obtain citizenship equal to FX . However, at that time the delicious part has disappeared. .

  • It is "properly" shady, (in a sense) decent people can not enter
  • Lessons learned from Mt. Gox case, Infrastructure and regulations are progressing
    (However, price still has distortion for profit)
  • A decent and large capital (literally a fund with different capital digits, etc.) has not entered a floating coin trade

Now it may be a happy time for individual bot traders.