回答編集履歴
1
シンプル化
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
二つのchannelにアクセスしたいならば、下記のように2つのチャンネル取得用のデータをsendするだけです。
|
2
|
+
|
3
|
+
|
2
4
|
|
3
5
|
|
4
6
|
|
@@ -20,23 +22,9 @@
|
|
20
22
|
|
21
23
|
channel = rs["params"]["channel"]
|
22
24
|
|
23
|
-
|
25
|
+
close_fx = round(float('{ltp}'.format(**(rs["params"]["message"]))))
|
24
26
|
|
25
|
-
price = round(float('{price}'.format(**(rs["params"]["message"][0]))))
|
26
|
-
|
27
|
-
print(channel, price)
|
28
|
-
|
29
|
-
elif channel == "lightning_ticker_FX_BTC_JPY":
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
close_fx = round(float('{ltp}'.format(**(rs["params"]["message"]))))
|
34
|
-
|
35
|
-
|
27
|
+
print(channel, close_fx)
|
36
|
-
|
37
|
-
else:
|
38
|
-
|
39
|
-
print("Got other channel data:", channel, rs)
|
40
28
|
|
41
29
|
except Exception as e:
|
42
30
|
|
@@ -68,7 +56,7 @@
|
|
68
56
|
|
69
57
|
ws.send(json.dumps([{'method': 'subscribe', 'params': {'channel': 'lightning_ticker_FX_BTC_JPY'}},
|
70
58
|
|
71
|
-
{'method': 'subscribe', 'params': {'channel': 'lightning_
|
59
|
+
{'method': 'subscribe', 'params': {'channel': 'lightning_ticker_BTC_JPY'}}]))
|
72
60
|
|
73
61
|
|
74
62
|
|