TradingAgentOptions<T>

Options & Configuration · AiDotNet.Models.Options

Configuration options for financial trading agents.

Inheritance: ModelOptions → TradingAgentOptions<T>

Known derived types: FinRLAgentOptions<T>, FinancialA2CAgentOptions<T>, FinancialDQNAgentOptions<T>, FinancialPPOAgentOptions<T>, FinancialSACAgentOptions<T>, MarketMakingOptions<T>

For Beginners

These options control how the trading agent behaves:

RL Parameters:

  • LearningRate: How fast the agent learns (higher = faster but unstable)
  • DiscountFactor: How much to value future rewards (higher = more patient)
  • BatchSize: How many experiences to learn from at once
  • ReplayBufferSize: How many past experiences to remember

Trading Parameters:

  • InitialCapital: Starting money for the portfolio
  • TransactionCost: Cost per trade (brokers charge fees)
  • MaxPositionSize: Maximum allowed position (prevents over-concentration)
  • RiskFreeRate: Benchmark return (usually government bond rate)

Risk Management:

  • UseRiskAdjustedReward: Whether to penalize high variance
  • VariancePenalty: How much to penalize risky behavior

How It Works

TradingAgentOptions extends standard RL options with financial-specific parameters for trading environments, risk management, and reward calculation.

Constructors

Constructor Summary
TradingAgentOptions() Creates options with the default values.

Properties

Property Summary
ILossFunction<T> LossFunction { get; set; } Loss function for training the agent’s neural networks.
T DiscountFactor { get; set; } Discount factor (gamma) for future rewards.
T InitialCapital { get; set; } Initial capital for the trading portfolio.
T LearningRate { get; set; } Learning rate for gradient updates.
T MaxPositionSize { get; set; } Maximum position size as a fraction of portfolio.
bool AllowShortSelling { get; set; } Whether to allow short selling.
bool AutoTuneAlpha { get; set; } Whether to automatically tune SAC temperature.
bool ContinuousActions { get; set; } Whether the action space is continuous.
bool UseRiskAdjustedReward { get; set; } Whether to use risk-adjusted rewards for training.
double EntropyCoefficient { get; set; } Entropy coefficient for exploration.
double EpsilonDecay { get; set; } Multiplicative exploration decay applied once per gradient update, in (0, 1].
double EpsilonEnd { get; set; } Final (floor) exploration rate for epsilon-greedy agents; epsilon never decays below this value.
double EpsilonStart { get; set; } Initial exploration rate for epsilon-greedy agents (the financial DQN agent).
double GAELambda { get; set; } GAE lambda for advantage estimation.
double PPOClipRange { get; set; } Clip range for PPO algorithm.
double RewardScale { get; set; } Reward scaling factor.
double RiskFreeRate { get; set; } Annual risk-free rate for Sharpe ratio calculation.
double SACAlpha { get; set; } Temperature parameter for SAC algorithm.
double Tau { get; set; } Soft update coefficient for target networks.
double ValueCoefficient { get; set; } Value function coefficient for actor-critic methods.
double VariancePenalty { get; set; } Penalty coefficient for return variance.
double? TransactionCost { get; set; } Transaction cost as a fraction of trade value, as an OVERRIDE of the environment’s own cost.
int ActionSize { get; set; } Number of possible actions or continuous action dimensions.
int BatchSize { get; set; } Batch size for training updates.
int ReplayBufferSize { get; set; } Size of the experience replay buffer.
int StateSize { get; set; } Dimension of the market state observation.
int TargetUpdateFrequency { get; set; } How often to update the target network.
int WarmupSteps { get; set; } Number of environment steps (stored transitions) before training begins.
int[] HiddenLayers { get; set; } Hidden layer sizes for the networks an agent builds itself.

Methods

Method Summary
void Validate() Validates the options and throws if invalid.