-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtestwebscoket.py
37 lines (26 loc) · 1.25 KB
/
testwebscoket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pickle
from celery import Celery
import redis
from backend.operations.binance_futures import BinanceFuturesOps
from backend.utils.binance.streams import ThreadedWebsocketManager
from config import Config
celery = Celery(__name__, broker=Config.CELERY_BROKER_URL,
backend=Config.CELERY_BROKER_URL)
red = redis.from_url(Config.REDIS_URL)
def startPriceStreams(api_key, api_secret, symbol, rediskeyname):
# Update the bookTicker price of the trading symbols
twm = ThreadedWebsocketManager(api_key=api_key, api_secret=api_secret)
def handle_socket_message(price_data):
print(price_data)
# twm.stop()
twm.start()
twm.start_symbol_ticker_futures_socket(
callback=handle_socket_message, symbol=symbol)
api_key = "02eTTLVw9T6g3oEmelloLP3IGt8QlCoCOKvdWshpKU1KWOQ7sDIm2xrDOPe3X9S6 "
api_secret = "MjP6qfoCnLX8KeIFAzW0KyE3LL96xlbbTYI962pWtyaES4SBIWiJXBJ1S3uMwoS8"
# startPriceStreams(api_key, api_secret, "ATOMUSDT", 'rediskeyname')
api_key = "02eTTLVw9T6g3oEmelloLP3IGt8QlCoCOKvdWshpKU1KWOQ7sDIm2xrDOPe3X9S6 "
api_secret = "MjP6qfoCnLX8KeIFAzW0KyE3LL96xlbbTYI962pWtyaES4SBIWiJXBJ1S3uMwoS8"
test = BinanceFuturesOps(api_key=api_key,api_secret=api_secret, trade_symbol="BTCUSDT" )
info = test.get_account()
print(info)