Skip to content

Add dry-run Firstrade strategy runtime#2

Merged
Pigbibi merged 1 commit into
mainfrom
add-dry-run-strategy-runtime
May 20, 2026
Merged

Add dry-run Firstrade strategy runtime#2
Pigbibi merged 1 commit into
mainfrom
add-dry-run-strategy-runtime

Conversation

@Pigbibi

@Pigbibi Pigbibi commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a guarded /run strategy cycle that reads Firstrade account state, evaluates shared US equity runtimes, maps decisions to value-target plans, and routes dry-run-first orders
  • add value-target decision mapping, capped whole-share execution, and optional Telegram cycle summaries
  • extend smoke checks with optional balance/position reads and document the unofficial API/live-trading gates in English and Chinese

Tests

  • .venv/bin/python -m pytest -q
  • PYTHONPATH=../QuantPlatformKit/src:../UsEquityStrategies/src .venv/bin/python scripts/print_strategy_profile_status.py
  • PYTHONPATH=../QuantPlatformKit/src:../UsEquityStrategies/src .venv/bin/python -m compileall main.py application notifications scripts tests decision_mapper.py runtime_config_support.py strategy_runtime.py strategy_registry.py

@Pigbibi Pigbibi merged commit dd18038 into main May 20, 2026
1 check passed
@Pigbibi Pigbibi deleted the add-dry-run-strategy-runtime branch May 20, 2026 13:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24df5a0647

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

continue

for symbol, delta_value, price in [item for item in tradable_deltas if item[1] > 0]:
buy_budget = min(float(delta_value), investable_cash, order_notional_cap)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add sell proceeds to investable cash before buy planning

execute_value_target_plan sells first but never credits sell proceeds back into investable_cash; buy sizing is computed from the pre-sell cash at this line and only reduced after buys. In rotations where starting cash is low and buys depend on same-cycle sells, the buy leg is skipped as buy_quantity_zero, leaving the portfolio unintentionally underinvested even though sells were submitted.

Useful? React with 👍 / 👎.

if "benchmark_history" in available_inputs:
inputs["benchmark_history"] = _build_price_history(market_data_port, benchmark_symbol)
if "qqq_history" in available_inputs:
inputs["qqq_history"] = _build_price_history(market_data_port, benchmark_symbol)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Populate qqq_history from QQQ instead of benchmark symbol

build_market_inputs currently fills qqq_history from benchmark_symbol. Since benchmark_history is already populated separately, any profile that overrides benchmark_symbol (for example to SPY) will silently receive the wrong instrument for qqq_history, which can alter strategy signals and resulting allocations.

Useful? React with 👍 / 👎.

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