Last active
February 22, 2018 09:14
-
-
Save johnta0/53dd7710c45c9262dcc0e1ee6bfbec7d to your computer and use it in GitHub Desktop.
bFFXと現物の乖離率計算スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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