适配最新QuantChart

This commit is contained in:
2025-10-19 12:01:25 +08:00
parent e363332827
commit 7afe3b21e6
2 changed files with 7 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import pandas as pd import pandas as pd
from chart import plot_chart from chart import QuantChart
if __name__ == "__main__": if __name__ == "__main__":
symbol = "ETH_USDT" symbol = "ETH_USDT"
@@ -9,4 +9,5 @@ if __name__ == "__main__":
df.rename(columns={"date": "time"}, inplace=True) df.rename(columns={"date": "time"}, inplace=True)
print(df.head()) 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)

View File

@@ -1,6 +1,6 @@
import pandas as pd import pandas as pd
from loguru import logger from loguru import logger
from chart import plot_chart, resample_data from chart import resample_data, QuantChart
from db_config import DatabaseManager, DatabaseConfig from db_config import DatabaseManager, DatabaseConfig
@@ -28,7 +28,7 @@ def get_kline(code: str) -> list:
if __name__ == "__main__": if __name__ == "__main__":
symbol = "399998" symbol = "399986"
timeframe = "1D" timeframe = "1D"
df = pd.read_csv( df = pd.read_csv(
@@ -41,4 +41,5 @@ if __name__ == "__main__":
df = resample_data(df, timeframe) df = resample_data(df, timeframe)
# df['buy'] = df['time'].apply(lambda x: 1 if pd.to_datetime(x).day % 2 == 1 else 0) # 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) # 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)