wance_data/src/pydantic/backtest_request.py

33 lines
2.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from typing import List, Optional, Dict
from pydantic import BaseModel, Field
class BackRequest(BaseModel):
field_list: List[str] = Field(default_factory=list, description="字段列表,用于指定获取哪些数据字段")
stock_list: List[str] = Field(default_factory=list, description="股票列表,用于指定获取哪些股票的数据")
stock_weights: List[Dict[str, float]] = Field(default_factory=list, description="股票与其对应权重的字典列表")
stock_code: str = Field(default="000300.SH", description="股票代码,用于指定获取哪些股票的数据")
benchmark_code: str = Field(default="000300.SH", description="股票代码,用于指定获取哪些股票的数据")
period: str = Field(default='1d', description="数据周期,如 '1d' 表示日线数据")
start_time: Optional[str] = Field(default='', description="开始时间,格式为 'YYYY-MM-DD',默认为空字符串")
end_time: Optional[str] = Field(default='', description="结束时间,格式为 'YYYY-MM-DD',默认为空字符串")
count: int = Field(default=-1, description="数据条数,默认为 -1 表示获取所有数据")
dividend_type: str = Field(default='none', description="分红类型,默认值为 'none'")
fill_data: bool = Field(default=True, description="是否填充数据,默认为 True")
incrementally: bool = Field(default=True, description="是否增量下载")
callback: bool = Field(default=True, description="是否开启回调函数")
data_dir: str = Field(default="D:\\e海方舟-量化交易版\\userdata_mini\\datadir", description="数据存储路径")
sector_name:str = Field(default="沪深指数", description="板块名称")
iscomplete: bool = Field(default=False, description="是否获取全部字段")
ma_type: str = Field(default='SMA', description="移动平均线类型,如 'SMA' 表示简单移动平均线")
short_window: int = Field(default=50, description="短周期线长度")
long_window: int = Field(default=200, description="长周期线长度")
bollingerMA: int = Field(default=50, description="布林带中的移动平均线周期,决定计算均值的时间窗口长度")
std_dev: int = Field(default=200, description="布林带中用于计算上下轨的标准差倍数,影响带宽大小")
overbought: int = Field(default=70, description="超买区间的RSI阈值表示价格处于相对高点可能面临回调")
oversold: int = Field(default=30, description="超卖区间的RSI阈值表示价格处于相对低点可能面临反弹")
signal_window: int = Field(default=9, description="超卖区间的RSI阈值表示价格处于相对低点可能面临反弹")
user_id: int = Field(default=1, description="用户id默认为 1 表示获取当前组合的所属用户")