config
Classes
Path-like object for using variable based absolute paths |
|
Enum for data source types. |
|
Configuration for features used in the algorithm. |
|
Individual Data Request |
|
Configuration for data used in the algorithm. |
|
Configuration for the reward function used in the trading environment. |
|
Enum for trade modes. |
|
!!! abstract "Usage Documentation" |
|
!!! abstract "Usage Documentation" |
|
Configuration for the agent used in the algorithm. |
|
Configuration for the analysis of backtest results. |
|
Configuration for backtesting the algorithm. |
|
Configuration for the algorithm. |
Module Contents
- class config.ProjectPath(/, **data)
Bases:
pydantic.BaseModelPath-like object for using variable based absolute paths
- Parameters:
data (Any)
- PROJECT_ROOT: ClassVar[pathlib.Path]
- OUT_DIR: ClassVar[pathlib.Path | None] = None
- BACKTEST_DIR: ClassVar[pathlib.Path | None] = None
- VERSION: ClassVar[str] = ''
- ACTIVE_UUID: ClassVar[uuid.UUID | None] = None
- path: str = None
- classmethod use_cache()
- classmethod cache()
- classmethod validate_path(data)
- Return type:
dict[str, str]
- __str__()
- Return type:
str
- as_path()
- Return type:
pathlib.Path
- class config.FeatureConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for features used in the algorithm.
- Parameters:
data (Any)
- classmethod parse_features(data)
- Parameters:
data (Any)
- features: List[trading.src.features.generic_features.Feature] = None
- fill_strategy: str = None
- __repr__()
- class config.DataRequests(/, **data)
Bases:
pydantic.BaseModelIndividual Data Request
- Parameters:
data (Any)
- dataset_name: str = None
- source: DataSourceType = None
- endpoint: str = None
- kwargs: Dict[str, Any] = None
- class config.DataConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for data used in the algorithm.
- Parameters:
data (Any)
- start_date: str = None
- end_date: str = None
- time_step_unit: alpaca.data.timeframe.TimeFrameUnit = None
- time_step_period: int = None
- cache_path: ProjectPath = None
- cache_enabled: bool = None
- requests: List[DataRequests] = None
- validation_split: float = None
- classmethod validate_time_step_unit(value)
Validate the time_step_unit field to ensure it is a valid TimeFrameUnit.
- Parameters:
value (alpaca.data.timeframe.TimeFrameUnit | str)
- Return type:
alpaca.data.timeframe.TimeFrameUnit
- class config.RewardConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for the reward function used in the trading environment.
- Parameters:
data (Any)
- type: str = None
- reward_scaling: float = None
- kwargs: Dict[str, Any] = None
- class config.TradeMode
Bases:
str,enum.EnumEnum for trade modes.
- DISCRETE = 'discrete'
- CONTINUOUS = 'cont'
- class config.PortfolioConfig(/, **data)
Bases:
pydantic.BaseModel- !!! abstract “Usage Documentation”
[Models](../concepts/models.md)
A base class for creating Pydantic models.
- Parameters:
data (Any)
- __class_vars__
The names of the class variables defined on the model.
- __private_attributes__
Metadata about the private attributes of the model.
- __signature__
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __pydantic_complete__
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__
The core schema of the model.
- __pydantic_custom_init__
Whether the model has a custom __init__ function.
- __pydantic_decorators__
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__
The name of the post-init method for the model, if defined.
- __pydantic_root_model__
Whether the model is a [RootModel][pydantic.root_model.RootModel].
- __pydantic_serializer__
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_fields__
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.
- __pydantic_computed_fields__
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_extra__
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__
The names of fields explicitly set during instantiation.
- __pydantic_private__
Values of private attributes set on the model instance.
- initial_cash: int = None
- maintain_history: bool = None
- buy_cost_pct: float | List[float] = None
- sell_cost_pct: float | List[float] = None
- max_positions: int | None = None
- trade_limit_percent: float = None
- hmax: float = None
- action_threshold: float = None
- max_exposure: float = None
- class config.StockEnv(/, **data)
Bases:
pydantic.BaseModel- !!! abstract “Usage Documentation”
[Models](../concepts/models.md)
A base class for creating Pydantic models.
- Parameters:
data (Any)
- __class_vars__
The names of the class variables defined on the model.
- __private_attributes__
Metadata about the private attributes of the model.
- __signature__
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __pydantic_complete__
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__
The core schema of the model.
- __pydantic_custom_init__
Whether the model has a custom __init__ function.
- __pydantic_decorators__
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__
The name of the post-init method for the model, if defined.
- __pydantic_root_model__
Whether the model is a [RootModel][pydantic.root_model.RootModel].
- __pydantic_serializer__
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_fields__
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.
- __pydantic_computed_fields__
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_extra__
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__
The names of fields explicitly set during instantiation.
- __pydantic_private__
Values of private attributes set on the model instance.
- turbulence_threshold: float | None = None
- reward_config: RewardConfig = None
- portfolio_config: PortfolioConfig = None
- lookback_window: int = None
- class config.AgentConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for the agent used in the algorithm.
- Parameters:
data (Any)
- algo: str = None
- save_path: ProjectPath = None
- deterministic: bool = None
- total_timesteps: int = None
- kwargs: Dict[str, Any] = None
- class config.AnalysisConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for the analysis of backtest results.
- Parameters:
data (Any)
- render_plots: bool = None
- save_plots: bool = None
- to_csv: bool = None
- tickers: List[str] | None = None
- class config.BackTestConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for backtesting the algorithm.
- Parameters:
data (Any)
- save_results: bool = None
- backtest_dir: ProjectPath = None
- analysis_config: AnalysisConfig = None
- classmethod validate_backtest_dir(value)
- Parameters:
value (ProjectPath)
- Return type:
pydantic.BaseModel
- results_path: ProjectPath = None
- class config.RRConfig(/, **data)
Bases:
pydantic.BaseModelConfiguration for the algorithm.
- Parameters:
data (Any)
- name: str = None
- description: str = None
- version: str = None
- out_dir: ProjectPath = None
- agent_config: AgentConfig = None
- data_config: DataConfig = None
- feature_config: FeatureConfig = None
- backtest_config: BackTestConfig = None
- classmethod validate_version(value)
- Parameters:
value (str)
- Return type:
str
- classmethod validate_out_dir(value)
- Parameters:
value (ProjectPath)
- Return type:
pydantic.BaseModel
- classmethod validate_config(value, info)
- Parameters:
value (Union[ProjectPath, pydantic.BaseModel])
info (pydantic_core.core_schema.ValidationInfo)
- Return type:
pydantic.BaseModel