Skip to content

feat: Maintain Stop Gain/Loss Prices Across LLM Decisions#576

Open
lukecold wants to merge 3 commits intoValueCell-ai:mainfrom
lukecold:feat_allow_stop_prices
Open

feat: Maintain Stop Gain/Loss Prices Across LLM Decisions#576
lukecold wants to merge 3 commits intoValueCell-ai:mainfrom
lukecold:feat_allow_stop_prices

Conversation

@lukecold
Copy link
Contributor

📝 Pull Request Template

1. Related Issue

Closes # (issue number)

2. Type of Change (select one)

Type of Change: New Feature

3. Description

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.

4. Testing

  • I have tested this locally.
  • I have updated or added relevant tests.

5. Checklist

@lukecold lukecold force-pushed the feat_allow_stop_prices branch 2 times, most recently from b60ae3d to ef6b3dc Compare December 15, 2025 16:32
@vcfgv
Copy link
Collaborator

vcfgv commented Dec 17, 2025

Thanks for the PR!

However, creating a separate table for stop_prices seems a bit heavy-handed at this stage.

Looking at the upsert_stop_price implementation, it seems to be only maintaining the current state (overwriting existing records based on strategy_id and symbol) rather than tracking any historical data.

Since the Strategy model already includes a strategy_metadata JSON column, could we simply store the stop price map there? This would significantly simplify the database schema and persistence logic.

For example, stop_prices in metadata could look like this:

{
  "stop_prices": {
    "BTC-USDT": { "stop_gain": 50000, "stop_loss": 40000, "note": "..." },
    "ETH-USDT": { "stop_gain": 3000, "stop_loss": 2000 }
  }
}

Please let me know what you think.

@lukecold lukecold force-pushed the feat_allow_stop_prices branch 2 times, most recently from f2cf752 to 2f854e5 Compare December 17, 2025 16:17
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.
@lukecold lukecold force-pushed the feat_allow_stop_prices branch from 2f854e5 to 887302e Compare February 26, 2026 11:59
- 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>
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.

2 participants