saving
This commit is contained in:
@@ -36,7 +36,7 @@ LOG_FILEPATH: str = os.getenv("LOGS_PATH") + '/Polymarket_Binance_Trades.log'
|
||||
### Globals ###
|
||||
WSS_URL = "wss://stream.binance.com:9443/ws/BTCUSDT@aggTrade"
|
||||
HIST_TRADES = np.empty((0, 3))
|
||||
HIST_TRADES_LOOKBACK_SEC = 5
|
||||
HIST_TRADES_LOOKBACK_SEC = 6
|
||||
|
||||
### Database Funcs ###
|
||||
async def create_rtds_btcusd_table(
|
||||
@@ -132,7 +132,8 @@ async def binance_trades_stream():
|
||||
last_px = float(data['p'])
|
||||
qty = float(data['q'])
|
||||
# print(f'🤑 BTC Binance Last Px: {last_px:_.4f}; TS: {pd.to_datetime(data['T'], unit='ms')}')
|
||||
HIST_TRADES = np.append(HIST_TRADES, np.array([[timestamp_value, last_px, qty]]), axis=0)
|
||||
# HIST_TRADES = np.append(HIST_TRADES, np.array([[timestamp_value, last_px, qty]]), axis=0)
|
||||
HIST_TRADES = np.append(HIST_TRADES, np.array([[ts_arrival, last_px, qty]]), axis=0)
|
||||
hist_trades_lookback_ts_ms = round(datetime.now().timestamp() - HIST_TRADES_LOOKBACK_SEC)*1000
|
||||
HIST_TRADES = HIST_TRADES[HIST_TRADES[:, 0] >= hist_trades_lookback_ts_ms]
|
||||
VAL_KEY_OBJ = json.dumps({
|
||||
|
||||
Reference in New Issue
Block a user