質問編集履歴

1

コードの追記

2018/03/23 05:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -20,9 +20,37 @@
20
20
 
21
21
 
22
22
 
23
- r = requests.get('https://api.cryptowat.ch/markets/bitflyer/btcfxjpy/ohlc?periods=60')
23
+ from datetime import datetime, timezone, timedelta
24
24
 
25
+ import time
26
+
27
+ import requests
28
+
29
+ import json
30
+
31
+
32
+
33
+ TIME = 0
34
+
35
+ CLOSE = 4
36
+
37
+
38
+
39
+ while True:
40
+
41
+
42
+
43
+ r = requests.get('https://api.cryptowat.ch/markets/bitflyer/btcfxjpy/ohlc?periods=60')
44
+
25
- json = r.json()['result']['60']
45
+ json = r.json()['result']['60']
46
+
47
+ close = json[-1][CLOSE]
48
+
49
+ print(str(datetime.fromtimestamp(round(time.time()) + 60 * 60 * 9)) + ' CLOSE: ' + str(close)) #直近の終値の表示
50
+
51
+
52
+
53
+ time.sleep(5)
26
54
 
27
55
 
28
56