Configuration

pydantic model trading.cli.alg.config.RRConfig

Configuration for the algorithm.

field name: str [Required]

Name of the algorithm

field description: str = ''

Description of the algorithm

field version: str = ''

Version of the algorithm

field out_dir: ProjectPath [Optional]
field agent_config: AgentConfig [Optional]

Agent configuration

field data_config: DataConfig [Optional]

Data configuration

field feature_config: FeatureConfig [Optional]

Feature configuration

field stock_env: StockEnv [Optional]

Stock Trading Environment Config

field backtest_config: BackTestConfig [Optional]

Backtesting configuration

pydantic model trading.cli.alg.config.AgentConfig

Configuration for the agent used in the algorithm.

field algo: str = 'ppo'

Algorithm to use (e.g., ‘ppo’, ‘a2c’, ‘dqn’, etc.)

field save_path: ProjectPath [Optional]

Path to save the trained agent model

field deterministic: bool = True

Whether to use deterministic actions during inference

field total_timesteps: int = 1000000

Total number of timesteps for training the agent

field kwargs: Dict[str, Any] [Optional]

Hyperparameters for the agent

pydantic model trading.cli.alg.config.BackTestConfig

Configuration for backtesting the algorithm.

field save_results: bool = False

Whether to save the backtesting results

field backtest_dir: ProjectPath [Optional]

Directory for storing backtest results

field analysis_config: AnalysisConfig [Optional]
field results_path: ProjectPath [Optional]

Path to save the backtesting results

pydantic model trading.cli.alg.config.DataConfig

Configuration for data used in the algorithm.

field start_date: str = '2020-01-01'

Start date for the data collection

field end_date: str = '2023-01-01'

End date for the data collection

field time_step_unit: TimeFrameUnit = TimeFrameUnit.Day

Time step of the data

field time_step_period: int = 1

Period of the time step (e.g., 1 for daily, 5 for 5-minute)

field cache_path: ProjectPath [Optional]

Path to cache the downloaded data

field cache_enabled: bool = True

Whether to cache the downloaded data

field requests: List[DataRequests] [Required]

List of data requests

field validation_split: float = 0.2

Fraction of data to use for validation

pydantic model trading.cli.alg.config.StockEnv
field turbulence_threshold: float | None = None

Maximum turbulence allowed in market for purchases to occur. If exceeded, positions are liquidated

field reward_config: RewardConfig [Optional]

Reward function configuration

field portfolio_config: PortfolioConfig [Optional]

Portfolio configuration

field lookback_window: int = 10

Number of past timesteps to consider for state representation

pydantic model trading.cli.alg.config.RewardConfig

Configuration for the reward function used in the trading environment.

field type: str = 'basic_profit_max'

Type of reward function to use

field reward_scaling: float = 10000.0

Scaling factor for the reward function

field kwargs: Dict[str, Any] [Optional]

Additional keyword arguments for the reward function

pydantic model trading.cli.alg.config.PortfolioConfig
field initial_cash: int = 100000

Starting funds in state space

field maintain_history: bool = True

Whether to maintain a history of past actions and states

field buy_cost_pct: float | List[float] = 0.0

Corresponding cost for all assets or array per symbol

field sell_cost_pct: float | List[float] = 0.0

Corresponding cost for all assets or array per symbol

field max_positions: int | None = None

Maximum number of open positions per asset at any time. If None, no limit is applied. Does not apply to Continuous action space

field trade_mode: TradeMode = TradeMode.CONTINUOUS

Mode for trading: DISCRETE (fixed actions) or CONTINUOUS (scaled based on actions)

field trade_limit_percent: float = 0.1

Maximum percentage of cash to be used in a single trade relative to the current asset value

field hmax: float = 10000.0

Maximum cash to be traded in each trade per asset, if using discrete actions each trade is the max.

field action_threshold: float = 0.1

Minimum action value to trigger a trade, used to avoid noise in continuous actions

field max_exposure: float = 1.0

Maximum exposure across the entire portfolio

class trading.cli.alg.config.TradeMode(*values)

Enum for trade modes.

CONTINUOUS = 'cont'
DISCRETE = 'discrete'
pydantic model trading.cli.alg.config.FeatureConfig

Configuration for features used in the algorithm.

field features: List[Feature] [Optional]

List of feature names

field fill_strategy: str = 'mean'

Strategy for handling missing values (e.g., ‘mean’, ‘median’, ‘drop’)

pydantic model trading.cli.alg.config.AnalysisConfig

Configuration for the analysis of backtest results.

field render_plots: bool = True

Plot the backtesting results in browser using .show()

field save_plots: bool = True

Whether to save the analysis plots, supports pkl and json based on extension

field to_csv: bool = True

Save the analysis results to CSV files

field tickers: List[str] | None = None

List of tickers to generate plots for. If None, generate for all.

pydantic model trading.cli.alg.config.DataRequests

Individual Data Request

field dataset_name: str = 'Generic'

Name of the dataset

field source: DataSourceType [Required]

DataSourceType Enum

field endpoint: str [Required]

Endpoint of API

field kwargs: Dict[str, Any] [Required]

Kwargs to pass in to the endpoint

class trading.cli.alg.config.DataSourceType(*values)

Enum for data source types.

ALPACA = 'alpaca'
pydantic model trading.cli.trading.trade_config.RRTradeConfig

Trading Configuration .. todo:

- notifications
- require trade approval
field id: UUID | None [Optional]

User ID for the trading account.

field account_number: str = '000-000-000'

Account number for the trading account.

field model_path: ProjectPath [Optional]

Path to the trained model.

field broker: BrokerType = BrokerType.LOCAL

Broker to use for trading.

field broker_kwargs: dict [Optional]

Additional broker-specific arguments.

field bucket_name: str | None = None

Name of the remote S3 bucket for REMOTE broker.

field positions_path: ProjectPath | None = None

Path to positions JSON for local/remote brokers.

field closed_positions_path: ProjectPath | None = None

Path to closed positions JSON for local/remote brokers.

field account_value_series_path: ProjectPath | None = None

Path to account value series JSON for local/remote brokers.

field account_path: ProjectPath | None = None

Path to account JSON for local/remote brokers.

field meta_data_path: ProjectPath | None = None

Path to meta data JSON for local/remote brokers.

field backtest_path: ProjectPath | None = None

Path to backtest ZIP for local/remote brokers.

field active: bool = False

Indicates if this configuration is active on the remote, which will enable live updates.

field out_dir: ProjectPath [Optional]

Path to the output directory.

field portfolio_config: PortfolioConfig | None = None

Portfolio configuration. If None, the configuration saved with the model will be used

field defer_trade_execution: bool = False

If True, trade executions will be deferred until program termination, utilizing batched writes.

field asset_exchanges: list[AssetExchange] = [AssetExchange.NYSE, AssetExchange.NASDAQ]

List of asset exchanges to filter tradable assets. If None, all exchanges are considered.

class trading.cli.trading.trade_config.BrokerType(*values)

Enum for broker types.

ALPACA = 'ALPACA'
LOCAL = 'LOCAL'
REMOTE = 'REMOTE'