docs(ibkr): change Flex date range from Last Business Day → Last 90 Days
Some checks failed
CI / test (push) Waiting to run
CI / build (push) Blocked by required conditions
CI / deploy (push) Blocked by required conditions
ci/woodpecker/push/build Pipeline was canceled

Trailing window backed by SyncRecordStore dedup is strictly better than
a single-day window — a single missed cron run with Last Business Day
loses that day's activity permanently. SyncRecordStore is keyed by
ibkr:trade:<tradeID> / ibkr:cash:<transactionID>, so overlapping pulls
are no-ops.

Caught during the brainstorming review.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-05-27 09:11:57 +00:00
parent 0ab069349f
commit 30af5fe2c9
3 changed files with 22 additions and 11 deletions

View file

@ -1461,8 +1461,10 @@ OpenPositions against WF-computed quantities.
| Open Positions | symbol, position, markPrice, currency, assetCategory | | Open Positions | symbol, position, markPrice, currency, assetCategory |
| Securities Information | symbol, description, conid | | Securities Information | symbol, description, conid |
Date range: `Last Business Day` for daily incremental. Switch to Date range: `Last 90 Days` — trailing window so a missed cron run
`Year to Date` for one-time backfills only. doesn't lose data. SyncRecordStore makes overlapping pulls idempotent.
Switch to `Year to Date` or `Custom Date Range` only for one-time
historical backfills.
## Cash type mapping ## Cash type mapping

View file

@ -39,8 +39,11 @@ a new query named `broker-sync-activity` with:
**Date Format:** `yyyy-MM-dd`. **Time Format:** `HH:mm:ss` (no timezone **Date Format:** `yyyy-MM-dd`. **Time Format:** `HH:mm:ss` (no timezone
suffix — ibflex 1.1 rejects timezone abbreviations in the time field). suffix — ibflex 1.1 rejects timezone abbreviations in the time field).
**Date Range:** `Last Business Day` for daily incremental. Switch to **Date Range:** `Last 90 Days` — trailing window so a missed cron run
`Year to Date` only for one-off backfills. doesn't lose data. SyncRecordStore (keyed by `external_id`) makes
overlapping pulls idempotent. For a one-off historical backfill, widen
temporarily to `Year to Date` or `Custom Date Range`, run once, then
switch back.
## Cash type mapping ## Cash type mapping

View file

@ -210,9 +210,12 @@ top.
- Sections: `Account Information`, `Trades`, `Cash Transactions`, - Sections: `Account Information`, `Trades`, `Cash Transactions`,
`Open Positions`, `Securities Information` `Open Positions`, `Securities Information`
- Date Format: `yyyy-MM-dd` · Time Format: `HH:mm:ss TimeZone` - Date Format: `yyyy-MM-dd` · Time Format: `HH:mm:ss TimeZone`
- Date Range: `Last Business Day` (for daily runs; flip to - Date Range: `Last 90 Days` — trailing window so a missed cron run
`Year to Date` only for the initial backfill — irrelevant while (failed pod, outage, vacation) doesn't lose data. SyncRecordStore
account is empty) keys on `ibkr:trade:<tradeID>` / `ibkr:cash:<transactionID>`, so
overlapping pulls are no-ops. `Last Business Day` was the original
choice but creates a "single missed run = permanent data loss"
failure mode — rejected in favour of dedup-backed resync window.
- Format: XML - Format: XML
- Trade fields: ensure `tradeID`, `tradeDate`, `tradeTime`, `symbol`, - Trade fields: ensure `tradeID`, `tradeDate`, `tradeTime`, `symbol`,
`buySell`, `quantity`, `tradePrice`, `currency`, `ibCommission`, `buySell`, `quantity`, `tradePrice`, `currency`, `ibCommission`,
@ -248,10 +251,13 @@ curl -sS -b /tmp/wf-jar -X POST "$WF_BASE_URL/api/v1/accounts" \
### Step 4 — Initial backfill (skip while account is empty) ### Step 4 — Initial backfill (skip while account is empty)
When the IBKR account first holds positions, switch the Flex query When the IBKR account first holds positions, the daily CronJob will
Date Range to `Year to Date`, run the CronJob manually once, verify WF backfill automatically up to the 90-day trailing window. For older
totals match the broker app, then switch the Flex query back to history, temporarily switch the Flex query Date Range to
`Last Business Day` for daily incremental. `Year to Date` (or `Custom Date Range` with a 1-year window), run the
CronJob manually once, verify WF totals match the broker app, then
switch the Flex query back to `Last 90 Days` for daily incremental.
Dedup makes the temporary widening safe — already-synced rows are no-ops.
### Step 5 — Deploy ### Step 5 — Deploy