Build an advanced memory-enabled trading agent that learns from trading history, analyzes past performance, and adapts strategies based on historical outcomes using sophisticated context management.
CONTEXT_WARNING_THRESHOLD
)SUMMARIZATION_COOLDOWN
)config.py
:
CONTEXT_WARNING_THRESHOLD = 0.9
(90%)SUMMARIZATION_COOLDOWN = 2 * 60
(2 minutes)REBALANCE_THRESHOLD = 0
to force a trade without asking an LLM instance.TradingDecision
on market states and trading decisions.
config.py
. The agent automatically determines optimal memory allocation using the existing configuration parameters.
Adaptive summarization algorithm
When approaching context limits, the agent compresses data through the _summarize_and_restart_context()
method.
TradingContext
.
Strategy functionality
The system provides basic strategy management:
TradingContext
for rebalancing script PnL and LLM-driven PnL.