Repository navigation
Add first-hour QTA2 research and persistent position ledger - #31
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25cee59e03
ℹ️ 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".
| source_timestamp = kis_market_timestamp( | ||
| date_value=compact_date, | ||
| time_value=latest["stck_cntg_hour"], |
There was a problem hiding this comment.
Obtain the Korean benchmark date from broker data
When the Korean index endpoint returns a delayed or cached tick whose time of day is within the 90-second freshness window, this constructs source_timestamp using the requested session date rather than a date supplied by the broker, so evaluate_market_regime can incorrectly accept a previous-session observation as same-session data. Use a date-bearing response or endpoint, or block admission when the observation date cannot be verified.
Useful? React with 👍 / 👎.
| previous: Decimal | None = None | ||
| for bar in bars: | ||
| current = Decimal(bar["close"]) | ||
| if previous is not None and previous < entry <= current: |
There was a problem hiding this comment.
Include entry crossings in the first observed bar
When the first bar opens below the entry threshold and closes at or above it, this function cannot report the crossing because previous starts as None. That systematically undercounts entry_crossed_by_bar_close and the resulting cross fractions in the opening-hour evaluation; initialize the first comparison from the first bar's open (or an explicitly defined pre-window baseline).
Useful? React with 👍 / 👎.
Summary
Validation