From 7afe3b21e6ea2bfc81a068ae8ef158ca45bf1b6f Mon Sep 17 00:00:00 2001 From: aszerW Date: Sun, 19 Oct 2025 12:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=9C=80=E6=96=B0QuantChart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crypto_chart.py | 5 +++-- index_chart.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crypto_chart.py b/crypto_chart.py index 1eb5ff9..9489d63 100644 --- a/crypto_chart.py +++ b/crypto_chart.py @@ -1,5 +1,5 @@ import pandas as pd -from chart import plot_chart +from chart import QuantChart if __name__ == "__main__": symbol = "ETH_USDT" @@ -9,4 +9,5 @@ if __name__ == "__main__": df.rename(columns={"date": "time"}, inplace=True) print(df.head()) - plot_chart(df, symbol=symbol, name=symbol, timeframe=timeframe) + quant_chart = QuantChart() + quant_chart.plot_chart(df, symbol=symbol, name=symbol, timeframe=timeframe, init_visible_num_bars=180) diff --git a/index_chart.py b/index_chart.py index e0ecff3..938a6be 100644 --- a/index_chart.py +++ b/index_chart.py @@ -1,6 +1,6 @@ import pandas as pd from loguru import logger -from chart import plot_chart, resample_data +from chart import resample_data, QuantChart from db_config import DatabaseManager, DatabaseConfig @@ -28,7 +28,7 @@ def get_kline(code: str) -> list: if __name__ == "__main__": - symbol = "399998" + symbol = "399986" timeframe = "1D" df = pd.read_csv( @@ -41,4 +41,5 @@ if __name__ == "__main__": df = resample_data(df, timeframe) # df['buy'] = df['time'].apply(lambda x: 1 if pd.to_datetime(x).day % 2 == 1 else 0) # df['sell'] = df['time'].apply(lambda x: 1 if pd.to_datetime(x).day % 2 == 0 else 0) - plot_chart(df=df, symbol=symbol, name=name, timeframe=timeframe) + quant_chart = QuantChart() + quant_chart.plot_chart(df=df, symbol=symbol, name=name, timeframe=timeframe)