Skip to content

Instantly share code, notes, and snippets.

@johnta0
Last active February 22, 2018 09:14
Show Gist options
  • Save johnta0/53dd7710c45c9262dcc0e1ee6bfbec7d to your computer and use it in GitHub Desktop.
Save johnta0/53dd7710c45c9262dcc0e1ee6bfbec7d to your computer and use it in GitHub Desktop.
bFFXと現物の乖離率計算スクリプト
import pybitflyer
import time
import json
def calculate_diff_rate(btc_jpy_fx, btc_jpy):
return (btc_jpy_fx / btc_jpy - 1) * 100
if __name__ == '__main__':
api = pybitflyer.API()
while True:
btc_jpy_fx = api.ticker(product_code="FX_BTC_JPY")["ltp"]
btc_jpy = api.ticker(product_code="BTC_JPY")["ltp"]
print(calculate_diff_rate(btc_jpy_fx, btc_jpy))
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment