|
@@ -305,7 +305,7 @@ def write_batch_to_questdb(data_batch):
|
|
|
|
|
|
|
|
# 构建InfluxDB Line Protocol格式
|
|
# 构建InfluxDB Line Protocol格式
|
|
|
# 格式: measurement,tag1=value1,tag2=value2 field1=value1,field2=value2 timestamp
|
|
# 格式: measurement,tag1=value1,tag2=value2 field1=value1,field2=value2 timestamp
|
|
|
- line = f"{QUESTDB_TABLE_PREFIX}_market_data,symbol={symbol} binance_mark_price={binance_mark_price},binance_price={binance_price},lighter_mark_price={lighter_mark_price},lighter_price={lighter_price}"
|
|
|
|
|
|
|
+ line = f"{QUESTDB_TABLE_PREFIX}_{symbol} binance_mark_price={binance_mark_price},binance_price={binance_price},lighter_mark_price={lighter_mark_price},lighter_price={lighter_price}"
|
|
|
lines.append(line)
|
|
lines.append(line)
|
|
|
|
|
|
|
|
# 将所有行合并为一个字符串,用换行符分隔
|
|
# 将所有行合并为一个字符串,用换行符分隔
|
|
@@ -319,8 +319,8 @@ def write_batch_to_questdb(data_batch):
|
|
|
timeout=10
|
|
timeout=10
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- if response.status_code == 200:
|
|
|
|
|
- logger.info(f"成功批量写入 {len(data_batch)} 条数据到QuestDB")
|
|
|
|
|
|
|
+ if response.status_code in [200, 204]:
|
|
|
|
|
+ # logger.info(f"成功批量写入 {len(data_batch)} 条数据到QuestDB")
|
|
|
return True
|
|
return True
|
|
|
else:
|
|
else:
|
|
|
logger.error(f"写入QuestDB失败,状态码: {response.status_code}, 响应: {response.text}")
|
|
logger.error(f"写入QuestDB失败,状态码: {response.status_code}, 响应: {response.text}")
|