Iteration Logs
it1:¶
Summary of Updates to UpdatedNetwork.py¶
-
New Agent.get_reward(self, weights):
-
Implements the Confidence-Based Selective Trading strategy.
-
Calculates the conviction score (raw output of the chosen neuron) for every day.
-
Calculates the P&L assuming a 10% fractional trade for every day.
-
Selects the Top 20% of days based on conviction.
-
The reward is the Final Portfolio Value after simulating only the top
trades with an initial capital of **
**. (As per your request).
-
-
Updated StrategyAnalyzer:
-
The old run_analysis method is kept to show the accuracy/action count at checkpoints.
-
A NEW method, run_pnl_analysis, is created to perform the Final P&L Simulation for Validation and Testing.
-
-
New P&L Simulation Logic:
-
Initial Capital:
$10,000$10,000(As requested for the final analysis).
-
Allocation: Fixed 10% Fractional per active trade.
-
Transaction Costs: Ignored (as requested for final analysis).
-
Hold Action: Close all positions (i.e.,
cash and
return).
-
-
Final Execution Block:
- The if name == "main": block is updated to call the new P&L analysis after training.
It2:¶
Here is a breakdown of how the key components interact:
-
New Training Objective (Reward Function): The Agent.get_reward() method is updated to implement the Confidence-Based Selective Trading strategy.
-
Goal: Maximize the final portfolio value after simulating trades only on the top 20% most-convicted days, starting with $100,000 capital.
-
Effect: The Evolution Strategy (ES) trains the Neural Network weights to produce outputs (conviction scores) that lead to the most profitable trades when only the strongest signals are acted upon.
-
-
New Analysis Logic (StrategyAnalyzer.run_analysis): This method is updated to reflect the tracking requirements for your checkpoint summary.
-
Goal: Track P&L and trade metrics at the end of every checkpoint on the Validation and Test sets.
-
Mechanism: It simulates a simpler, stateless Fixed 10% Fractional Trading strategy (using the required **\(10,000** initial capital and **no transaction costs**), and outputs the resulting metrics (Final P&L (\)), Total Trades, etc.).
-
Conclusion¶
The code is now consistent:
-
Training is focused on maximizing P&L through highly selective, high-conviction trades ($100k start).
-
Analysis is focused on reporting the P&L and trade volume of a more standard, daily
10%10%fractional trading strategy ($10k start).