1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

bitflyerストリーミングAPI(自分用メモ)

1
Posted at

やったこと

仮想通貨FXの自動取引ツールを使おうという発想のもとに、ストリーミングAPIが使えるのではないかということで使ってみた記録です。

bitflyerのストリーミングAPIはpubnubを使って配信しています。そこで、レファレンスにもある通りにログインし、bitflyerのアカウントを追加し、登録し、視聴するという手順をとります。


import logging
import pubnub
import requests
 
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub, SubscribeListener
 
pubnub.set_stream_logger('pubnub', logging.DEBUG)
 
pnconfig = PNConfiguration()
 
pnconfig.subscribe_key = 'sub-c-52a9ab50-291b-11e5-baaa-0619f8945a4f'
 
pubnub = PubNub(pnconfig)
 
pubnub.add_listener(SubscribeListener())
pubnub.subscribe().channels("lightning_ticker_BTC_JPY").execute()


情報量が多すぎて処理が大変かつ、そこまでの量はいらないと判断したので、
REST_APIもかなりの頻度で叩けるのでそちらを使うことにした。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?