PortfolioManagerEnvironment<T>

Models & Types · AiDotNet.Finance.Trading.Environments

A SOTA cross-sectional portfolio-manager environment: the agent manages a whole book at once. Each step it emits a target-weight VECTOR over the tradable universe (one weight per asset, in [-1, 1], subject to a gross-leverage budget), and the environment reconciles every position toward its target — so entry, exit, sizing, and rotation across names are a single learned decision. This is the cross-sectional counterpart to the single-asset TradingEnvironment, and it goes beyond the basic PortfolioTradingEnvironment (which forces weights to sum to 1 — always fully invested, no cash, no leverage budget, every column tradable, default return reward, no realistic frictions).

It differs in four SOTA-relevant ways: (1) a gross-leverage BUDGET (sum(|w|) <= maxLeverage) so the agent can hold cash and lever deliberately; (2) observation-only FEATURE columns (per-name forecasts, uncertainty, “analyst” recommendations for a hierarchical setup) that ride in the observation but are never traded; (3) a pluggable IPortfolioReward objective (total return, differential Sharpe, drawdown-penalized) so the reward is an experiment knob; (4) realistic FRICTIONS — transaction cost, turnover-proportional slippage, short-borrow financing, and gross carry — all deducted from cash so portfolio value reflects true costs. Each asset’s position and cash are already in the base observation, so the policy conditions its exits on what it holds.

Inheritance: TradingEnvironment<T> → PortfolioManagerEnvironment<T>

Constructors

Constructor Summary
PortfolioManagerEnvironment(IReadOnlyList<double[]> assetPrices, IReadOnlyList<double[]> featureColumns, int windowSize, double initialCapital, IPortfolioReward reward, double maxLeverage, double transactionCost, double slippageCoefficient, double annualBorrowCost, double annualHoldingCost, bool allowShortSelling, int? seed)

Properties

Property Summary
bool IsContinuousActionSpace { get; } Continuous target-weight vector.
double CurrentValue { get; } Current portfolio value (cash + marked positions).
double GrossExposure { get; } Gross exposure after the most recent step (sum |position notional| / value).
double LastTurnover { get; } Turnover (fraction of portfolio value traded) on the most recent step — for logging/tests.
int ActionSpaceSize { get; } One target weight per tradable asset (feature columns are never traded).

Methods

Method Summary
void ResetEpisodeState() Resets the per-episode reward statistics, drawdown peak, turnover and exposure.