fast_profit_reward
Fast reward function optimized for training speed. Does not maintain any history or complex calculations.
Classes
Ultra-fast reward function that only considers immediate portfolio value change. |
|
Reward based on price momentum (change in portfolio value relative to price movement). |
Module Contents
- class fast_profit_reward.FastProfitReward(cfg, initial_state)
Bases:
trading.src.alg.environments.reward_functions.base_reward_function.RewardFunctionUltra-fast reward function that only considers immediate portfolio value change. No history tracking, no complex metrics. Perfect for fast training.
- Parameters:
initial_state (numpy.ndarray)
- previous_value
- __repr__()
- Return type:
str
- reset()
Reset reward state.
- compute_reward(pf, df, realized_profit)
Compute reward based on simple portfolio value change.
- Parameters:
pf (trading.src.portfolio.portfolio.Portfolio) – Portfolio object (we extract net_value)
df (pandas.DataFrame) – DataFrame (not used in fast mode)
realized_profit (float) – Realized profit from trades (not used in fast mode)
- Returns:
Normalized reward value
- Return type:
float
- class fast_profit_reward.SimpleMomentumReward(cfg, initial_state)
Bases:
trading.src.alg.environments.reward_functions.base_reward_function.RewardFunctionReward based on price momentum (change in portfolio value relative to price movement). Still fast but slightly more sophisticated than pure profit.
- Parameters:
initial_state (numpy.ndarray)
- previous_value
- __repr__()
- Return type:
str
- reset()
Reset reward state.
- compute_reward(pf, df, realized_profit)
Compute reward that emphasizes profit relative to portfolio size. Encourages growing the portfolio while being mindful of risk.
- Parameters:
pf (trading.src.portfolio.portfolio.Portfolio) – Portfolio object
df (pandas.DataFrame) – DataFrame (not used)
realized_profit (float) – Realized profit from trades
- Returns:
Normalized reward value
- Return type:
float