|
|
@@ -5,8 +5,7 @@ from logger_config import logger
|
|
|
from data_processing import on_message_depth, stop_event
|
|
|
|
|
|
# Binance WebSocket API URL
|
|
|
-SYMBOL = "token" + "usdt"
|
|
|
-# SOCKET_TRADE = "wss://fstream.binance.com/stream?streams=" + SYMBOL + "@trade"
|
|
|
+SYMBOL = "1000pepe" + "usdt"
|
|
|
SOCKET_DEPTH = "wss://fstream.binance.com/stream?streams=" + SYMBOL + "@depth20@100ms"
|
|
|
|
|
|
|
|
|
@@ -19,7 +18,6 @@ def on_open(_ws):
|
|
|
|
|
|
|
|
|
# Create a WebSocket app
|
|
|
-# ws_trade = websocket.WebSocketApp(SOCKET_TRADE, on_message=on_message_trade, on_error=on_error, on_open=on_open)
|
|
|
ws_depth = websocket.WebSocketApp(SOCKET_DEPTH, on_message=on_message_depth, on_error=on_error, on_open=on_open)
|
|
|
|
|
|
# 定义要传递给 run_forever 的参数
|
|
|
@@ -27,12 +25,6 @@ http_proxy_host = "127.0.0.1"
|
|
|
http_proxy_port = 7890
|
|
|
proxy_type = "http"
|
|
|
|
|
|
-# Run the WebSocket with proxy settings
|
|
|
-# trade_thread = threading.Thread(target=ws_trade.run_forever, kwargs={
|
|
|
-# 'http_proxy_host': http_proxy_host,
|
|
|
-# 'http_proxy_port': http_proxy_port,
|
|
|
-# 'proxy_type': proxy_type
|
|
|
-# })
|
|
|
depth_thread = threading.Thread(target=ws_depth.run_forever, kwargs={
|
|
|
'http_proxy_host': http_proxy_host,
|
|
|
'http_proxy_port': http_proxy_port,
|
|
|
@@ -41,11 +33,9 @@ depth_thread = threading.Thread(target=ws_depth.run_forever, kwargs={
|
|
|
|
|
|
|
|
|
def start_ws_clients():
|
|
|
- # trade_thread.start()
|
|
|
depth_thread.start()
|
|
|
|
|
|
|
|
|
def stop_all_threads():
|
|
|
stop_event.set()
|
|
|
- # trade_thread.join()
|
|
|
depth_thread.join()
|