bitFlyer Lightning Realtime API を受信し、とにかく保存する (2)

昨日のプログラムは死なずに朝まで動いていた。

{'product_code': 'BTC_JPY', 'timestamp': '2020-03-20T15:05:17.3219492Z', 'tick_id': 3240422, 'best_bid': 736410.0, 'best_ask': 737265.0, 'best_bid_size': 0.2, 'best_ask_size': 0.03, 'total_bid_depth': 2687.36024613, 'total_ask_depth': 1461.92276428, 'ltp': 737210.0, 'volume': 18956.20924797, 'volume_by_product': 18956.20924797}
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-20T15:05:18.2967025Z', 'tick_id': 3240434, 'best_bid': 736559.0, 'best_ask': 737265.0, 'best_bid_size': 0.1, 'best_ask_size': 0.03, 'total_bid_depth': 2687.16024613, 'total_ask_depth': 1462.41067428, 'ltp': 737210.0, 'volume': 18956.09924797, 'volume_by_product': 18956.09924797}
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-20T15:05:19.1461292Z', 'tick_id': 3240443, 'best_bid': 736559.0, 'best_ask': 737264.0, 'best_bid_size': 0.04, 'best_ask_size': 0.2285, 'total_bid_depth': 2681.09924613, 'total_ask_depth': 1462.93917441, 'ltp': 736559.0, 'volume': 18956.15924797, 'volume_by_product': 18956.15924797}
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-20T15:05:19.8855257Z', 'tick_id': 3240458, 'best_bid': 736559.0, 'best_ask': 737265.0, 'best_bid_size': 0.04, 'best_ask_size': 0.03, 'total_bid_depth': 2680.92239613, 'total_ask_depth': 1460.53026442, 'ltp': 736559.0, 'volume': 18955.14924797, 'volume_by_product': 18955.14924797}
...
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-21T01:21:35.3691628Z', 'tick_id': 3841083, 'best_bid': 690201.0, 'best_ask': 690862.0, 'best_bid_size': 0.2, 'best_ask_size': 0.13499999, 'total_bid_depth': 2609.0433868, 'total_ask_depth': 1535.12359796, 'ltp': 690567.0, 'volume': 18624.85581455, 'volume_by_product': 18624.85581455}
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-21T01:21:36.3699921Z', 'tick_id': 3841103, 'best_bid': 690201.0, 'best_ask': 690877.0, 'best_bid_size': 0.2, 'best_ask_size': 0.1, 'total_bid_depth': 2609.67338679, 'total_ask_depth': 1543.43781568, 'ltp': 690567.0, 'volume': 18624.85581455, 'volume_by_product': 18624.85581455}
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-21T01:21:37.2313059Z', 'tick_id': 3841120, 'best_bid': 690201.0, 'best_ask': 690877.0, 'best_bid_size': 0.2, 'best_ask_size': 0.1, 'total_bid_depth': 2609.69942679, 'total_ask_depth': 1537.20112802, 'ltp': 690567.0, 'volume': 18624.85581455, 'volume_by_product': 18624.85581455}
{'product_code': 'BTC_JPY', 'timestamp': '2020-03-21T01:21:38.1096684Z', 'tick_id': 3841134, 'best_bid': 690201.0, 'best_ask': 690884.0, 'best_bid_size': 0.2, 'best_ask_size': 0.06, 'total_bid_depth': 2609.76863679, 'total_ask_depth': 1537.34812815, 'ltp': 690567.0, 'volume': 18624.09581455, 'volume_by_product': 18624.09581455}

約10時間で12MBぐらい。1時間1MB強、1日で30MB弱。

感想など

・https://bf-lightning-api.readme.io/docs/realtime-ticker よく読むと「配信効率などの合理的理由により、配信頻度が制限されています。」とある。実際、1秒に1回強ぐらいしか送られてきていない。
・BTC_JPYは現物で、BTC/JPY FXを受信するためにはlightning_ticker_FX_BTC_JPYを指定するべきっぽい。
・https://docs.cryptowat.ch/websocket-api/ Cryptowatchというところにもwebsocket APIがあり、こっちだと26個の取引場に対応しているらしいので、調べる。

この記事が気に入ったらサポートをしてみませんか?