From a271af3ae9c81a3cb2a10a0c8fb099a5d4737937 Mon Sep 17 00:00:00 2001 From: yhydev Date: Wed, 14 Jan 2026 13:36:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E5=B0=86binance=5Fkline=E6=94=B9=E4=B8=BAbn=5Ffutures=5Fkline?= =?UTF-8?q?=5F1d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download_binance_kline.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/download_binance_kline.py b/download_binance_kline.py index f62841c..24b0277 100644 --- a/download_binance_kline.py +++ b/download_binance_kline.py @@ -185,11 +185,11 @@ def create_table(conn): """ # 先检查并删除旧表,然后重新创建 drop_table_query = """ - DROP TABLE IF EXISTS binance_kline; + DROP TABLE IF EXISTS bn_futures_kline_1d; """ create_table_query = """ - CREATE TABLE binance_kline ( + CREATE TABLE bn_futures_kline_1d ( id SERIAL PRIMARY KEY, symbol VARCHAR(20) NOT NULL, open_time TIMESTAMP NOT NULL, @@ -213,7 +213,7 @@ def create_table(conn): cur.execute(drop_table_query) cur.execute(create_table_query) conn.commit() - logger.info("Created binance_kline table with updated schema") + logger.info("Created bn_futures_kline_1d table with updated schema") except psycopg2.Error as e: logger.error(f"Failed to create table: {e}") conn.rollback() @@ -258,7 +258,7 @@ def insert_data(conn, df): # 构建查询条件,使用VALUES列表 values_list = ','.join([f"('{symbol}', '{open_time}')" for symbol, open_time in batch_pairs]) check_query = f""" - SELECT symbol, open_time FROM binance_kline + SELECT symbol, open_time FROM bn_futures_kline_1d WHERE (symbol, open_time) IN ({values_list}) """ @@ -307,7 +307,7 @@ def insert_data(conn, df): # 4. 准备插入数据 insert_query = """ - INSERT INTO binance_kline ( + INSERT INTO bn_futures_kline_1d ( symbol, open_time, high, low, open, close, volume, close_time, quote_asset_volume, number_of_trades, taker_buy_base_asset_volume, taker_buy_quote_asset_volume, ignore