Skip to content

feat: Allow stop prices (gain/loss) in trading agent decisions#1

Merged
lukecold merged 3 commits intomainfrom
feat_allow_stop_prices
Feb 26, 2026
Merged

feat: Allow stop prices (gain/loss) in trading agent decisions#1
lukecold merged 3 commits intomainfrom
feat_allow_stop_prices

Conversation

@lukecold
Copy link
Owner

Summary

  • Maintain stop gain/loss prices across LLM decisions – the trading coordinator now persists per-position stop prices so they survive multiple decision cycles
  • Move stop prices into strategy metadata – stop gain/loss values are stored in the strategy's metadata instead of ephemeral state, making them durable and inspectable
  • Minor frontend/config cleanup (biome.json, agent.ts constants)

Changes

Area Detail
trading/models.py Added stop_gain_price and stop_loss_price fields to position model
portfolio/interfaces.py & in_memory.py Portfolio tracks and updates stop prices per position
coordinator.py Passes stop prices into each decision cycle
runtime.py Reads and propagates stop prices from strategy metadata
composer.py / system_prompt.py Injects current stop prices into the LLM prompt context
frontend/ Biome formatting fix; added StrategyAgent constant

Test plan

  • Run make test (Python unit tests pass)
  • Confirm stop prices persist across multiple trading cycles in a local session
  • Smoke-test the cloud deploy: push triggers deploy.yml → Docker image built → VM restarted → GET /api/v1/healthz returns 200

🤖 Generated with Claude Code

lukecold and others added 3 commits February 26, 2026 18:26
This PR implements robust management for Stop Gain/Loss prices, ensuring these critical protective limits are **maintained and consistently applied** across trading sessions and subsequent LLM decisions.

* **LLM Definition:** LLM response extended to include new Stop Gain/Loss price fields.
* **Persistent Storage:** Defined stop prices are stored in session memory and persisted via database snapshot.
* **Session Continuity:** Loads persisted stop prices when resuming a session, restoring trading strategy limits.
* **Informed Decisions:** Existing stop prices are fed back into the LLM context to inform and assist subsequent trading actions.
- Add multi-stage Dockerfile.cloud (bun SPA + Python backend)
- Serve React SPA from FastAPI via FRONTEND_BUILD_DIR env var
- Add docker-compose.yml and vm-setup.sh for GCE VM
- Add GitHub Actions workflow deploying via SSH to 34.142.253.116
- Remove Cloud Run / OCI configs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@lukecold lukecold merged commit 34a2903 into main Feb 26, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant