Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"displayName": "Quant Stock Technical",
"source": "./plugins/quant-stock-technical",
"description": "Acquire audited KIS Korean and U.S. EOD data and screen a deterministic KOSPI, KOSDAQ, NYSE, and NASDAQ technical universe.",
"version": "0.4.4",
"version": "0.4.5",
"author": {
"name": "mrcha033"
},
Expand Down Expand Up @@ -137,7 +137,7 @@
"displayName": "Quant Stock Polling Trader",
"source": "./plugins/quant-stock-polling-trader",
"description": "Build and supervise deterministic daily KIS shadow sessions from official calendars through reconciliation.",
"version": "0.5.3",
"version": "0.5.4",
"author": {
"name": "mrcha033"
},
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
run: python -B scripts/sync_distribution.py --check
- name: Run deterministic calculator self-test
run: python -B skills/quant-stock-technical/scripts/analyze_stock.py --self-test
- name: Run first-hour research calculator self-test
run: python -B skills/quant-stock-technical/scripts/analyze_stock_v2.py --self-test
- name: Run read-only opening-hour collector self-test
run: python -B skills/quant-stock-technical/scripts/collect_open1h_research.py --self-test
- name: Run opening-hour evaluator self-test
run: python -B skills/quant-stock-technical/scripts/evaluate_open1h_research.py --self-test
- name: Run four-exchange universe builder self-test
run: python -B skills/quant-stock-technical/scripts/build_universe_manifest.py --self-test
- name: Run deterministic universe screen self-test
Expand All @@ -42,6 +48,8 @@ jobs:
run: python -B skills/quant-stock-polling-trader/scripts/market_calendar.py self-test
- name: Run recurring daily pipeline self-test
run: python -B skills/quant-stock-polling-trader/scripts/daily_pipeline.py self-test
- name: Run strategy-position lifecycle self-test
run: python -B skills/quant-stock-polling-trader/scripts/position_lifecycle.py --self-test
- name: Run systemd generator self-test
run: python -B skills/quant-stock-polling-trader/scripts/systemd_units.py self-test
- name: Run mandatory handoff-gate self-test
Expand Down Expand Up @@ -76,6 +84,12 @@ jobs:
run: python -B tests/test_screen_universe.py
- name: Run screening and execution regression
run: python -B tests/test_quant_execution.py
- name: Run QTA2 execution and market-regime regression
run: |
python -B tests/test_qta2_execution.py
python -B tests/test_qta2_market_regime.py
- name: Run strategy-position ledger regression
run: python -B tests/test_position_lifecycle.py
- name: Run systemd unit generator regression
run: python -B tests/test_systemd_units.py
- name: Run KIS U.S. EOD regression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
"name": "quant-stock-polling-trader",
"displayName": "Quant Stock Polling Trader",
"version": "0.5.3",
"version": "0.5.4",
"description": "Run a direct deterministic daily KIS shadow workflow from official calendars through reconciliation.",
"author": {
"name": "mrcha033",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quant-stock-polling-trader",
"version": "0.5.3",
"version": "0.5.4",
"description": "Run a direct deterministic daily KIS shadow workflow.",
"author": {
"name": "mrcha033",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ without making a Korean session wait for U.S. EOD or vice versa.
Finish an initial multi-year bootstrap before relying on a daily timer; the
timer is intended to resume and increment an existing cache.

Set optional `qta_method_version` to `qta-2.0.0` for the research-only
first-hour model. The runner then performs one read-only benchmark-regime call
per active exchange and cycle before stock quotes. A negative, stale,
wrong-session, or unavailable regime observation blocks new entries for that
cycle. QTA2 cannot run in paper or live mode.

To receive optional ntfy completion/block notifications, place these values in
the same mode-`0600` environment file used by the generated services:

Expand All @@ -111,6 +117,15 @@ The account alias is nonsecret and configured by the user. A current session
is never entered twice. An unresolved broker mutation from a paper-mode run
still requires reconciliation before another entry.

Filled strategy quantities are stored in
`RUNTIME_ROOT/state/<account-alias>/<market>/positions.sqlite3`, outside the
date directory. Before a later session reads quotes, the runner reconciles
that ledger against the frozen KIS account snapshot. Matching positions roll
forward as `CARRY_EXIT_ONLY`; quantity differences, working orders, duplicate
ownership, or a prior `MANUAL_BLOCK` stop new entries. Holdings not created by
this strategy remain visible as unmanaged broker positions and are never
silently adopted or sold.

## Direct planning and polling

For a non-recurring session, read `references/execution-contract.md`,
Expand Down Expand Up @@ -170,6 +185,7 @@ python3 scripts/account_snapshot.py self-test
python3 scripts/market_calendar.py self-test
python3 scripts/daily_pipeline.py self-test
python3 scripts/plan_orders.py --self-test
python3 scripts/position_lifecycle.py --self-test
python3 scripts/run_session.py self-test
python3 scripts/reconcile.py --self-test
python3 scripts/systemd_units.py self-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Use `qta-daily-shadow-config/v2`:
"mode": "shadow",
"history_start_date": "2021-01-01",
"minimum_sessions": 756,
"qta_method_version": "qta-2.0.0",
"request_interval_ms": 120,
"catalog_coverage_contract": {
"schema": "qta-catalog-coverage-contract/v1",
Expand Down Expand Up @@ -94,7 +95,11 @@ Use `qta-daily-shadow-config/v2`:
}
```

Only the fields shown above are required. Two optional fields may be added:
`qta_method_version` is optional and defaults to `qta-1.0.0`. Select
`qta-2.0.0` only for shadow research; the screen and runner then enforce its
liquidity and same-session market-regime contracts.

Three other optional fields may be added:

```json
{
Expand All @@ -118,6 +123,12 @@ The intent ledger is:
RUNTIME_ROOT/state/<account-alias>/<market>/<session-date>
```

The strategy-position ledger persists across dates at:

```text
RUNTIME_ROOT/state/<account-alias>/<market>/positions.sqlite3
```

The workflow descriptor is
`RUNTIME_ROOT/current/<market>.json`, and date-specific artifacts are under
`RUNTIME_ROOT/workflows/<market>/<session-date>`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Keep three independent contracts:

```text
qta-1.0.0 completed T-1 adjusted daily data -> technical payload
qta-1.0.0/2.0.0 completed T-1 adjusted daily data -> technical payload
qta-screen-1.0.0 legacy KR/US manifest -> deterministic candidates
qta-screen-1.1.0 selected-market manifest -> exchange-ranked candidates
open1h-exec-2.0.0 broker/account snapshots -> intents and order lifecycle
Expand Down Expand Up @@ -62,6 +62,15 @@ resolved-tick alignment, and the emitted 2R take-profit geometry. A smaller,
reranked, or semantically forged object cannot make itself acceptable merely
by hashing its own contents.

For `qta-2.0.0`, the validator instead recomputes its first-hour total,
verifies the market-specific turnover floor, and requires the exact
research-only market-regime policy. QTA2 can run only in shadow mode. Before
stock quotes in each cycle, the runner reads KOSPI Composite, KOSDAQ
Composite, Nasdaq Composite, or the documented S&P 500 broad-market proxy for
NYSE candidates. It verifies the current-session timestamp, a maximum age of
90 seconds, and return from previous close of at least zero basis points. A
failed check skips new entries for that exchange and cycle.

Each account position must include `market` and `symbol`, plus `exchange` for a
v2 screen. Each item in `open_orders` must represent a currently working order
and include `side, market, symbol`, plus `exchange` for v2. Existing positions
Expand Down Expand Up @@ -164,6 +173,9 @@ KIS live US shadow: ceil(intent_count * 1 * 0.12s)
Toss shadow: ceil(intent_count * 2 * 0.10s)
```

QTA2 adds one KIS benchmark request per active exchange to the same cycle
budget.

Reject a configured interval below that floor. This is only an API-pacing
feasibility bound, not proof of network latency. Production promotion also
requires observed shadow percentiles.
Expand Down Expand Up @@ -211,6 +223,16 @@ At the window end, freeze new entries, cancel outstanding paper-mode entry
orders, and reconcile. Continue managing already filled paper positions.
Automatic market flattening is not implemented.

The account/market strategy-position ledger is stored one directory above the
date-specific intent ledger. Authoritative cumulative entry fills create or
update a position with its original stop, target, tick, FX, and plan identity.
Before the next session, exact broker quantities are reconciled and valid
residuals roll to `CARRY_EXIT_ONLY`; they are excluded from new additions.
The bundled lifecycle module deterministically calculates stop, gap-stop,
target, close-liquidation, partial-fill, and daily-loss decisions, but the
current polling service does not yet send live exit mutations. Do not describe
that decision module as active automatic liquidation.

## State machine

```text
Expand Down
Loading
Loading