From d8159af1d2967d2c756abc896f568f47b1fa507f Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Tue, 27 Jan 2026 22:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BE=E8=A1=A8=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E4=B8=BA=E7=BA=A2=E6=B6=A8=E7=BB=BF=E8=B7=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backtest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backtest.py b/backtest.py index c205cb8..c1bdc9e 100644 --- a/backtest.py +++ b/backtest.py @@ -119,6 +119,17 @@ def load_strategy(strategy_file): return calculate_indicators, strategy_class +def apply_color_scheme(): + """ + 应用颜色方案:红涨绿跌(中国股市风格) + """ + import backtesting._plotting as plotting + from bokeh.colors.named import tomato, lime + + plotting.BULL_COLOR = tomato + plotting.BEAR_COLOR = lime + + def parse_arguments(): """ 解析命令行参数 @@ -256,6 +267,8 @@ def main(): # 解析参数 args = parse_arguments() + apply_color_scheme() + # 加载数据 print(f"加载股票数据: {args.code} ({args.start_date} ~ {args.end_date})") data = load_data_from_db(args.code, args.start_date, args.end_date)