thetabook 2.0.0__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. {thetabook-2.0.0 → thetabook-2.2.0}/.github/workflows/publish.yml +24 -28
  2. {thetabook-2.0.0 → thetabook-2.2.0}/CHANGELOG.md +293 -0
  3. {thetabook-2.0.0 → thetabook-2.2.0}/CLAUDE.md +5 -2
  4. {thetabook-2.0.0 → thetabook-2.2.0}/PKG-INFO +3 -1
  5. {thetabook-2.0.0 → thetabook-2.2.0}/README.md +37 -6
  6. thetabook-2.2.0/ROADMAP.md +246 -0
  7. {thetabook-2.0.0 → thetabook-2.2.0}/pyproject.toml +9 -1
  8. thetabook-2.2.0/src/thetabook/analysis/hv.py +209 -0
  9. thetabook-2.2.0/src/thetabook/analysis/scenarios.py +425 -0
  10. thetabook-2.2.0/src/thetabook/analysis/ta.py +252 -0
  11. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/__init__.py +13 -1
  12. thetabook-2.2.0/src/thetabook/cli/bars.py +231 -0
  13. thetabook-2.2.0/src/thetabook/cli/hv.py +109 -0
  14. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/import_csv.py +5 -3
  15. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/init.py +6 -2
  16. thetabook-2.2.0/src/thetabook/cli/scenarios.py +215 -0
  17. thetabook-2.2.0/src/thetabook/cli/ta.py +204 -0
  18. thetabook-2.2.0/src/thetabook/market/bars.py +796 -0
  19. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/portfolio/accounts.py +8 -1
  20. thetabook-2.2.0/src/thetabook/portfolio/csv_parsers/__init__.py +55 -0
  21. thetabook-2.2.0/src/thetabook/portfolio/csv_parsers/_base.py +118 -0
  22. thetabook-2.2.0/src/thetabook/portfolio/csv_parsers/empower.py +208 -0
  23. thetabook-2.2.0/src/thetabook/portfolio/csv_parsers/fidelity.py +161 -0
  24. thetabook-2.2.0/src/thetabook/portfolio/csv_parsers/schwab.py +152 -0
  25. thetabook-2.2.0/src/thetabook/portfolio/import_csv_snapshot.py +132 -0
  26. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/install.py +37 -18
  27. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/accounts.toml.example +17 -0
  28. {thetabook-2.0.0 → thetabook-2.2.0}/uv.lock +819 -1
  29. thetabook-2.0.0/.claude/commands/accounts-init.md +0 -45
  30. thetabook-2.0.0/.claude/commands/adjust.md +0 -84
  31. thetabook-2.0.0/.claude/commands/chain.md +0 -57
  32. thetabook-2.0.0/.claude/commands/close.md +0 -51
  33. thetabook-2.0.0/.claude/commands/diff.md +0 -47
  34. thetabook-2.0.0/.claude/commands/evaluate.md +0 -48
  35. thetabook-2.0.0/.claude/commands/greeks.md +0 -35
  36. thetabook-2.0.0/.claude/commands/idea.md +0 -48
  37. thetabook-2.0.0/.claude/commands/ideas.md +0 -29
  38. thetabook-2.0.0/.claude/commands/open.md +0 -40
  39. thetabook-2.0.0/.claude/commands/portfolio.md +0 -59
  40. thetabook-2.0.0/.claude/commands/price.md +0 -28
  41. thetabook-2.0.0/.claude/commands/refresh.md +0 -9
  42. thetabook-2.0.0/.claude/commands/roll-scenarios.md +0 -72
  43. thetabook-2.0.0/.claude/commands/roll.md +0 -125
  44. thetabook-2.0.0/.claude/commands/setup.md +0 -98
  45. thetabook-2.0.0/.claude/commands/wiki-lint.md +0 -77
  46. thetabook-2.0.0/ROADMAP.md +0 -419
  47. thetabook-2.0.0/docs/architecture.md +0 -406
  48. thetabook-2.0.0/docs/behaviors.md +0 -138
  49. thetabook-2.0.0/docs/cli.md +0 -136
  50. thetabook-2.0.0/docs/hosted-service-proposal.md +0 -113
  51. thetabook-2.0.0/docs/skills-roadmap.md +0 -174
  52. thetabook-2.0.0/docs/skills.md +0 -91
  53. thetabook-2.0.0/src/thetabook/portfolio/import_csv_snapshot.py +0 -397
  54. thetabook-2.0.0/tests/cli/test_bs_cli.py +0 -120
  55. thetabook-2.0.0/tests/cli/test_init.py +0 -444
  56. thetabook-2.0.0/tests/cli/test_migrate_home.py +0 -183
  57. thetabook-2.0.0/tests/conftest.py +0 -277
  58. thetabook-2.0.0/tests/ideas/test_adjust.py +0 -1739
  59. thetabook-2.0.0/tests/ideas/test_core.py +0 -288
  60. thetabook-2.0.0/tests/ideas/test_evaluate_idea.py +0 -1921
  61. thetabook-2.0.0/tests/ideas/test_manage_ideas.py +0 -759
  62. thetabook-2.0.0/tests/ideas/test_roll_scenarios.py +0 -729
  63. thetabook-2.0.0/tests/market/test_chains.py +0 -654
  64. thetabook-2.0.0/tests/market/test_dividends.py +0 -780
  65. thetabook-2.0.0/tests/market/test_earnings.py +0 -321
  66. thetabook-2.0.0/tests/market/test_leg_marks.py +0 -106
  67. thetabook-2.0.0/tests/market/test_prices.py +0 -658
  68. thetabook-2.0.0/tests/market/test_schwab.py +0 -106
  69. thetabook-2.0.0/tests/market/test_vol_lookup.py +0 -372
  70. thetabook-2.0.0/tests/portfolio/test_accounts.py +0 -981
  71. thetabook-2.0.0/tests/portfolio/test_diff_snapshots.py +0 -356
  72. thetabook-2.0.0/tests/portfolio/test_get_positions.py +0 -495
  73. thetabook-2.0.0/tests/portfolio/test_import_csv_snapshot.py +0 -375
  74. thetabook-2.0.0/tests/portfolio/test_scaffold.py +0 -92
  75. thetabook-2.0.0/tests/pricing/test_bs.py +0 -254
  76. thetabook-2.0.0/tests/pricing/test_greeks.py +0 -828
  77. thetabook-2.0.0/tests/skills/conftest.py +0 -52
  78. thetabook-2.0.0/tests/skills/test_install.py +0 -598
  79. thetabook-2.0.0/tests/skills/test_lint.py +0 -220
  80. thetabook-2.0.0/tests/skills/test_models.py +0 -96
  81. thetabook-2.0.0/tests/skills/test_parse.py +0 -70
  82. thetabook-2.0.0/tests/skills/test_policy.py +0 -54
  83. thetabook-2.0.0/tests/skills/test_registry.py +0 -388
  84. thetabook-2.0.0/tests/skills/test_render.py +0 -55
  85. thetabook-2.0.0/tests/test_cache.py +0 -149
  86. thetabook-2.0.0/tests/test_cli.py +0 -800
  87. thetabook-2.0.0/tests/test_config.py +0 -77
  88. thetabook-2.0.0/tests/test_factories.py +0 -92
  89. thetabook-2.0.0/tests/test_leg_parse.py +0 -228
  90. thetabook-2.0.0/tests/test_log.py +0 -42
  91. thetabook-2.0.0/tests/test_models.py +0 -412
  92. thetabook-2.0.0/tests/test_paths.py +0 -502
  93. thetabook-2.0.0/tests/test_tickers.py +0 -262
  94. thetabook-2.0.0/tests/wiki/test_lint.py +0 -1069
  95. thetabook-2.0.0/tests/wiki/test_render.py +0 -442
  96. {thetabook-2.0.0 → thetabook-2.2.0}/.env.example +0 -0
  97. {thetabook-2.0.0 → thetabook-2.2.0}/.github/workflows/ci.yml +0 -0
  98. {thetabook-2.0.0 → thetabook-2.2.0}/.gitignore +0 -0
  99. {thetabook-2.0.0 → thetabook-2.2.0}/.python-version +0 -0
  100. {thetabook-2.0.0 → thetabook-2.2.0}/CONTRIBUTING.md +0 -0
  101. {thetabook-2.0.0 → thetabook-2.2.0}/LICENSE +0 -0
  102. {thetabook-2.0.0 → thetabook-2.2.0}/SECURITY.md +0 -0
  103. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/__init__.py +0 -0
  104. {thetabook-2.0.0/src/thetabook/ideas → thetabook-2.2.0/src/thetabook/analysis}/__init__.py +0 -0
  105. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cache.py +0 -0
  106. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/_shared.py +0 -0
  107. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/accounts.py +0 -0
  108. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/adjust.py +0 -0
  109. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/bs.py +0 -0
  110. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/chain.py +0 -0
  111. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/diff.py +0 -0
  112. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/dividends.py +0 -0
  113. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/earnings.py +0 -0
  114. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/evaluate.py +0 -0
  115. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/greeks.py +0 -0
  116. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/ideas.py +0 -0
  117. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/leg_mark.py +0 -0
  118. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/migrate_home.py +0 -0
  119. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/price.py +0 -0
  120. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/refresh.py +0 -0
  121. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/roll.py +0 -0
  122. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/skills.py +0 -0
  123. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/snapshot.py +0 -0
  124. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/tickers.py +0 -0
  125. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/cli/wiki.py +0 -0
  126. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/config.py +0 -0
  127. {thetabook-2.0.0/src/thetabook/market → thetabook-2.2.0/src/thetabook/ideas}/__init__.py +0 -0
  128. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/ideas/adjust.py +0 -0
  129. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/ideas/core.py +0 -0
  130. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/ideas/evaluate_idea.py +0 -0
  131. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/ideas/manage_ideas.py +0 -0
  132. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/ideas/roll_scenarios.py +0 -0
  133. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/leg_parse.py +0 -0
  134. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/log.py +0 -0
  135. {thetabook-2.0.0/src/thetabook/portfolio → thetabook-2.2.0/src/thetabook/market}/__init__.py +0 -0
  136. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/_schwab.py +0 -0
  137. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/chains.py +0 -0
  138. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/dividends.py +0 -0
  139. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/earnings.py +0 -0
  140. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/leg_marks.py +0 -0
  141. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/prices.py +0 -0
  142. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/market/vol_lookup.py +0 -0
  143. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/models.py +0 -0
  144. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/paths.py +0 -0
  145. {thetabook-2.0.0/src/thetabook/pricing → thetabook-2.2.0/src/thetabook/portfolio}/__init__.py +0 -0
  146. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/portfolio/diff_snapshots.py +0 -0
  147. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/portfolio/get_positions.py +0 -0
  148. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/portfolio/scaffold.py +0 -0
  149. {thetabook-2.0.0/tests/skills → thetabook-2.2.0/src/thetabook/pricing}/__init__.py +0 -0
  150. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/pricing/bs.py +0 -0
  151. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/pricing/greeks.py +0 -0
  152. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/__init__.py +0 -0
  153. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/lint.py +0 -0
  154. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/models.py +0 -0
  155. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/parse.py +0 -0
  156. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/policy.py +0 -0
  157. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/registry.py +0 -0
  158. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/skills/render.py +0 -0
  159. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/README.md +0 -0
  160. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/config.toml.example +0 -0
  161. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/idea.md +0 -0
  162. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/journal.md +0 -0
  163. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/learnings.md +0 -0
  164. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/skill.md +0 -0
  165. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/skills/setup-thetabook.md +0 -0
  166. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/wiki/index.md +0 -0
  167. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/wiki/log.md +0 -0
  168. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/wiki/overview.md +0 -0
  169. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/wiki/strategy.md +0 -0
  170. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/templates/wiki/underlying.md +0 -0
  171. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/tickers.py +0 -0
  172. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/wiki/__init__.py +0 -0
  173. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/wiki/lint.py +0 -0
  174. {thetabook-2.0.0 → thetabook-2.2.0}/src/thetabook/wiki/render.py +0 -0
@@ -5,6 +5,14 @@ name: Publish to PyPI
5
5
  # publishes via trusted publishing (PyPI's OIDC integration — no API token
6
6
  # stored in repo secrets).
7
7
  #
8
+ # Single job by design: build and publish share one runner so `dist/`
9
+ # never has to round-trip through the Actions artifact store. That handoff
10
+ # used to live in a separate `publish` job (upload-artifact → download-artifact),
11
+ # which made every release hostage to the account-level artifact-storage
12
+ # quota — a full quota failed the upload step and the publish never ran,
13
+ # even though the wheel built fine. Keeping dist/ on the runner removes that
14
+ # dependency entirely.
15
+ #
8
16
  # Setup: configure a "trusted publisher" on pypi.org for this repo +
9
17
  # workflow under Account → Publishing → Add a new pending publisher.
10
18
  # Owner: subsriram, repository: thetabook, workflow: publish.yml,
@@ -16,9 +24,17 @@ on:
16
24
  - "v*"
17
25
 
18
26
  jobs:
19
- build-and-test:
20
- name: Build + test
27
+ build-and-publish:
28
+ name: Build + test + publish
21
29
  runs-on: ubuntu-latest
30
+ environment: pypi
31
+ permissions:
32
+ # A permissions block resets every unlisted scope to `none`, so
33
+ # checkout needs contents:read spelled out — the old two-job layout
34
+ # got it implicitly because the build job had no permissions block.
35
+ contents: read
36
+ # Required for PyPI trusted publishing (OIDC).
37
+ id-token: write
22
38
  steps:
23
39
  - uses: actions/checkout@v6
24
40
 
@@ -70,31 +86,11 @@ jobs:
70
86
  exit 1
71
87
  }
72
88
 
73
- - name: Upload artifacts
74
- uses: actions/upload-artifact@v4
75
- with:
76
- name: dist
77
- path: dist/
78
-
79
- publish:
80
- name: Publish to PyPI
81
- needs: build-and-test
82
- runs-on: ubuntu-latest
83
- # Defense-in-depth: the workflow trigger already restricts to v*
84
- # tags, but a workflow_dispatch UI re-run inherits no tag pattern.
85
- # Belt-and-suspenders so the publish step can only fire when GITHUB_REF
86
- # is actually a v-prefixed tag.
87
- if: startsWith(github.ref, 'refs/tags/v')
88
- environment: pypi
89
- permissions:
90
- # Required for PyPI trusted publishing (OIDC).
91
- id-token: write
92
- steps:
93
- - name: Download artifacts
94
- uses: actions/download-artifact@v4
95
- with:
96
- name: dist
97
- path: dist/
98
-
99
89
  - name: Publish to PyPI
90
+ # Defense-in-depth: the workflow trigger already restricts to v*
91
+ # tags, but guard the publish step itself so it can only fire when
92
+ # GITHUB_REF is actually a v-prefixed tag (e.g. a manual re-run that
93
+ # somehow lands without the tag ref still builds + tests, but skips
94
+ # the upload).
95
+ if: startsWith(github.ref, 'refs/tags/v')
100
96
  uses: pypa/gh-action-pypi-publish@release/v1
@@ -5,6 +5,299 @@ All notable changes to this project are recorded here. Format loosely follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.2.0] — 2026-06-04
9
+
10
+ Multi-broker CSV import. The Schwab/Fidelity CSV importer is rebuilt as a
11
+ format-agnostic parser registry, **Empower** (employer 401(k) / EquatePlus)
12
+ joins the supported brokers, and adding the next broker is now a subclass +
13
+ one-line registration. No changes to the trading/analysis CLIs.
14
+ **1604 tests pass, ruff + mypy clean.**
15
+
16
+ ### Added
17
+
18
+ - **Empower Holdings CSV import** ([#56](https://github.com/subsriram/thetabook/pull/56)).
19
+ `import-csv` now recognizes Empower's multi-account holdings export
20
+ (equities, ETFs, mutual funds, and options) alongside Schwab and Fidelity.
21
+ - **Extensible broker CSV parser registry** ([#56](https://github.com/subsriram/thetabook/pull/56)).
22
+ The monolithic `import_csv_snapshot.py` is split into a `portfolio/csv_parsers/`
23
+ package: a `BrokerCsvParser` ABC (`detect()` / `parse()`), one module per
24
+ broker, and a `REGISTRY` walked by `detect_and_parse()` (first match wins,
25
+ most-specific first). A new broker is a subclass + a line in `REGISTRY` — no
26
+ changes to the importer or CLI. Format is auto-detected per file, so one
27
+ `import-csv` invocation can mix exports from different brokers.
28
+ - **`instrument_symbol` per-account override** ([#56](https://github.com/subsriram/thetabook/pull/56)).
29
+ For single-stock employer plans (e.g. EquatePlus) whose Fidelity rows carry
30
+ no ticker, `accounts.toml` can map the account to a symbol so the shares
31
+ import with the right underlying. Documented in `accounts.toml.example`.
32
+
33
+ ### Changed
34
+
35
+ - **Account numbers stored as the broker exposes them** ([#56](https://github.com/subsriram/thetabook/pull/56)).
36
+ Fidelity and Empower numbers are now stored verbatim; Schwab stays masked to
37
+ `****<last4>` because the export only carries the last four (a broker
38
+ limitation, not a masking decision). `import-csv` warns when a now-verbatim
39
+ number no longer matches a masked `****<last4>` key left in `accounts.toml`,
40
+ so per-account rules don't silently stop matching — re-key or re-run
41
+ `/accounts-init`.
42
+ - **Empower account subtype feeds `/accounts-init`** ([#56](https://github.com/subsriram/thetabook/pull/56)).
43
+ Empower exports tell us Roth vs. traditional, so `accounts totals` surfaces a
44
+ `roth-401k` / `traditional-401k` suggestion for unconfigured accounts instead
45
+ of a bare `?` — unlike Schwab, which can't distinguish IRA from taxable.
46
+ - **`import_csv_snapshot.py` reduced to a thin entry point** ([#56](https://github.com/subsriram/thetabook/pull/56)).
47
+ The legacy `parse_schwab_csv` / `parse_fidelity_csv` shim functions were
48
+ removed; callers use the `csv_parsers` package directly.
49
+ - **sdist excludes `personal/`, `.claude/`, `tests/`, `docs/`** ([#62](https://github.com/subsriram/thetabook/pull/62)).
50
+ Smaller source distribution that no longer risks shipping local PII fixtures.
51
+
52
+ ### Fixed
53
+
54
+ - **`parse_money` handles the `$-114.50` ordering** ([#56](https://github.com/subsriram/thetabook/pull/56)).
55
+ A negative sign after the currency symbol is now parsed as negative (only the
56
+ `-$114.50` and `($114.50)` forms worked before).
57
+ - **Empower import fails cleanly on a malformed file** ([#56](https://github.com/subsriram/thetabook/pull/56)).
58
+ A Holdings CSV missing a required column now warns and skips the file instead
59
+ of raising `KeyError` mid-parse.
60
+
61
+ ### Docs
62
+
63
+ - Documented Empower support, the `csv_parsers/` package, and the `import-csv`
64
+ command across README, `docs/cli.md`, and `docs/architecture.md`
65
+ ([#56](https://github.com/subsriram/thetabook/pull/56)); documented the
66
+ v2.1.x technical-analysis stack across the reference docs
67
+ ([#63](https://github.com/subsriram/thetabook/pull/63)).
68
+
69
+ ## [2.1.2] — 2026-06-01
70
+
71
+ First-time-setup bug fixes plus a CI hardening so releases stop being hostage
72
+ to the GitHub Actions artifact-storage quota. No changes to the trading/analysis
73
+ CLIs. **1564 tests pass, ruff + mypy clean.**
74
+
75
+ ### Fixed
76
+
77
+ - **`thetabook init` / `/setup-thetabook` setup flow** ([#58](https://github.com/subsriram/thetabook/pull/58)).
78
+ Three bugs broke first-time setup end to end:
79
+ - The skill installer mirrored the source's authoring form into
80
+ `.claude/skills/`, so a flat-source skill landed as `<slug>.md` — but
81
+ Claude Code only discovers folder form (`<slug>/SKILL.md`), leaving
82
+ `/setup-thetabook` as a dead slash command. The installer (and init's
83
+ bare-mode skill install) now always normalize to folder form at the
84
+ destination, and a pre-existing flat `<slug>.md` is treated as a prior
85
+ install of the same slug (refused without `--force`, removed with it) so
86
+ the upgrade path doesn't orphan dead cruft.
87
+ - `init --non-interactive` aborted before the token: `--app-secret-stdin`
88
+ consumes stdin, so schwab-py's "Press ENTER" prompt hit EOF. `_run_oauth`
89
+ now passes `interactive=False`.
90
+ - `init` crashed after the token by writing `SCHWAB_APP_KEY` while the rest
91
+ of the app reads `SCHWAB_API_KEY`; the `.env` writer now emits the
92
+ canonical `SCHWAB_API_KEY`.
93
+
94
+ ### Changed
95
+
96
+ - **`publish.yml` — build + publish merged into one job** ([#59](https://github.com/subsriram/thetabook/pull/59)).
97
+ The two-job layout handed `dist/` between jobs via `upload-artifact` →
98
+ `download-artifact`, which made every release hostage to the account-level
99
+ artifact-storage quota: a full quota failed the upload step and the PyPI
100
+ publish never ran even though the wheel built clean (this is exactly what
101
+ blocked the v2.1.1 publish). Build and publish now share one runner, so
102
+ `dist/` stays on disk and goes straight to PyPI — no artifact round-trip,
103
+ no storage-quota dependency. OIDC trusted publishing (`environment: pypi`,
104
+ `id-token: write`) is unchanged.
105
+
106
+ ### Note
107
+
108
+ - **v2.1.1 was never published to PyPI.** Its tag push triggered the publish
109
+ workflow on the pre-#59 (artifact-handoff) layout, which failed on the
110
+ storage quota. 2.1.2 supersedes it and is the first PyPI release after 2.0.0
111
+ to carry the v2.1.x feature set; see the 2.1.1 and 2.1.0 entries below for
112
+ those features.
113
+
114
+ ## [2.1.1] — 2026-05-27
115
+
116
+ Test-coverage backfill for the v2.1.0 release plus a stdout-noise polish to
117
+ the defeatbeta fetcher. No behavior changes to user-facing CLIs. **1561 tests
118
+ pass (+74 net since v2.1.0), ruff + mypy clean.**
119
+
120
+ ### Added
121
+
122
+ - **CLI integration tests for the four new v2.1.0 subcommands** (`tests/cli/test_analysis_cli.py`,
123
+ 53 tests). `thetabook hv`, `thetabook ta`, `thetabook bars compare/boundary/actions`,
124
+ and `thetabook scenarios match/features` had no integration coverage at
125
+ v2.1.0 ship; this file fills that gap. Tests are hermetic — every external
126
+ dependency (`get_bars`, `compare_sources`, `get_actions`, `bars_boundary`,
127
+ `_fetch_full_closes`, `compute_state_features`, `indicators`) is
128
+ monkeypatched on its underlying module, so the suite doesn't touch
129
+ defeatbeta / yfinance / the cache. Covers happy paths for every mode,
130
+ flag-parse errors (`--mode`, `--indicator`, `--type`, `--lookback`,
131
+ `--horizons`), empty-result + insufficient-history exits, and the
132
+ `_rsi_label` / `_macd_label` / `_bb_label` helpers in `cli/ta.py` that
133
+ previously had no other coverage.
134
+
135
+ - **Non-daily interval coverage for `market/bars.py`** (8 tests). Prior tests
136
+ covered the `1d` path and one intraday case (`5m`); this round adds end-to-end
137
+ `get_bars(interval="1wk")` and `interval="1mo")` resample paths, the `1m`
138
+ intraday case, the intraday-failure → empty-canonical-frame fallback, a
139
+ regression guard pinning that weekly/monthly tail-fill calls yfinance at
140
+ `interval="1d"` (a leak of the user-facing interval would silently produce
141
+ wrong totals), `_resample("1mo")` aggregation math, the unknown-interval
142
+ no-op branch, and intraday-timestamp preservation in `_normalize_yfinance`
143
+ (sub-daily spacing must NOT zero the time component — would collapse
144
+ multiple bars per session onto one index value).
145
+
146
+ - **`analysis/ta.py:indicators()` integration tests** (4 tests). Beyond the
147
+ existing "columns present" + "empty bars" smoke tests, the new tests verify
148
+ that the wrapper's column values match what calling `rsi` / `macd` /
149
+ `bollinger_bands` directly produces (catches quiet rescaling or
150
+ column-shuffling), that custom indicator parameters (`rsi_window`,
151
+ `bb_window`, `bb_k`) propagate (regression guard for hardcoded-defaults),
152
+ that `as_of` flows down to `get_bars` as the end of the fetch window, and
153
+ that the bars-with-no-close-column guard branch is exercised.
154
+
155
+ - **`analysis/scenarios.py` state-vector boundary tests** (6 tests). The
156
+ 4-feature regime vector has explicit clipping/scaling that wasn't pinned:
157
+ drawdown at 0 (close at 252d high), drawdown clipped at the 50% cap (a
158
+ 70% crash saturates at exactly `1.0`, never above), drawdown scaling
159
+ (25% drop maps to exactly `0.5` — half of the cap, scaled to `[0, 1]`),
160
+ RSI normalization (`rsi() / 100` saturates at exactly `1.0` on pure
161
+ uptrend), HV-rank min-max boundary (top of rolling range ranks `1.0`,
162
+ regime-change bars rank above deep-calm bars), and leading-NaN warmup
163
+ (pre-rolling-window rows are NaN, not zero or partial-window stubs).
164
+
165
+ ### Changed
166
+
167
+ - **`market/bars.py` — defeatbeta stdout/stderr silenced + tail-fill warning
168
+ cleanup** ([38a577e](https://github.com/subsriram/thetabook/commit/38a577e)).
169
+ defeatbeta's first import / first per-ticker fetch printed three categories
170
+ of noise that polluted CLI streams: HF banner ASCII art via `print()` to
171
+ stdout, `[nltk_data]` download/up-to-date lines to stderr, and a
172
+ `DuckDBClient` INFO-level log line. New `_quiet_defeatbeta()` context
173
+ manager scopes all three suppressions to the wrapper boundary: stdout
174
+ captured via `contextlib.redirect_stdout`, stderr filtered through a
175
+ `_DropPrefixStream` proxy that drops `[nltk_data]`-prefixed lines (and
176
+ buffers partial writes so multi-write lines are evaluated as a unit),
177
+ and the `DuckDBClient` logger temporarily raised to WARNING then
178
+ restored. Our own `log.warn` lines and defeatbeta error messages still
179
+ pass through. The tail-fill path in `get_bars` now suppresses the raw
180
+ yfinance warning when defeatbeta has fallback data and emits a clearer
181
+ contextual one (`yfinance tail-fill failed for {ticker}; using
182
+ defeatbeta-only data through {boundary}`).
183
+
184
+ ### Infrastructure
185
+
186
+ - Project version bumped from `2.0.0` → `2.1.1`. v2.1.0 was never formally
187
+ released (no PyPI publish, no git tag); its CHANGELOG entry below is
188
+ backfilled for the record so the version history reads continuously.
189
+
190
+ ## [2.1.0] — 2026-05-26
191
+
192
+ Three coordinated threads built up over one session: a new historical data
193
+ source that reduces yfinance dependence, a TA-indicator library on top of
194
+ it, and a "has this happened before" historical-analogue lookup tool.
195
+ Shipped as [PR #55](https://github.com/subsriram/thetabook/pull/55).
196
+ **1487 tests pass (+59 net since v2.0.0), ruff + mypy clean.**
197
+
198
+ ### Added
199
+
200
+ - **defeatbeta-api as a primary historical data source — `market/bars.py`.**
201
+ New module exposes `get_bars(ticker, start, end, interval="1d")`,
202
+ `get_actions(ticker)` for splits + cash dividends, and
203
+ `bars_boundary(ticker)`. Unlike the price/chain cascades (which prefer
204
+ one source and fall through on failure), bars uses a **time-based stitch**:
205
+ defeatbeta serves history up to its dataset boundary (typically
206
+ prior-Friday close — the HF dataset updates weekly), yfinance fills the
207
+ rolling tail from `boundary + 1` through today. Callers receive one
208
+ DataFrame and don't know which source served each row. Daily-only from
209
+ defeatbeta; `1wk` / `1mo` resample from daily in-process; intraday
210
+ intervals (`1m`/`5m`/etc.) bypass defeatbeta entirely and pull from
211
+ yfinance for the full range. Cache lives at
212
+ `$THETABOOK_HOME/cache/bars/{TICKER}_1d.csv` per ticker with a sidecar
213
+ `_meta.json` tracking `{last_refresh, boundary, dataset_version}`.
214
+ yfinance tail is NOT cached (5 rows, changes intraday).
215
+
216
+ - **Stitch policy locked + validated.** `close` is split-only-adjusted on
217
+ both sources; `adj_close` is split + dividend-adjusted (yfinance
218
+ convention). defeatbeta has no native `adj_close` — rather than fabricate
219
+ one, we mirror `close` for defeatbeta rows. `thetabook bars compare
220
+ TICKER --overlap N` runs the validation: diffs defeatbeta vs yfinance
221
+ over an overlap window and prints per-column / per-row deltas with `*`
222
+ markers on cells exceeding the threshold. Validated 2026-05-26 against
223
+ AAPL (10d) and O (30d, spans monthly ex-div) — zero rows flagged at the
224
+ default 0.5% threshold.
225
+
226
+ - **Version-aware cache.** Beyond the 3-day TTL, the refresh logic does a
227
+ cheap `HuggingFaceClient.get_data_update_time()` probe when TTL expires.
228
+ If upstream `dataset_version` matches what's on disk, we skip the heavy
229
+ `Ticker.price()` refetch and just bump `last_refresh`. Net effect with
230
+ weekly HF refreshes and a 3-day TTL: previously paid for a full
231
+ `price()` fetch ~2× per week per ticker; now pay for one cheap version
232
+ probe instead. Fail-safe — when the probe returns `None` (no network,
233
+ library missing), the full-fetch path runs as before.
234
+
235
+ - **Corporate actions via stitched defeatbeta + yfinance — `get_actions`.**
236
+ `_parse_split_factor` converts defeatbeta's `"7:1"` / `"1:5"` strings to
237
+ float ratios matching yfinance's convention (`2.0` for 2-for-1, `0.2`
238
+ for 1-for-5 reverse). Zero-amount dividend placeholder rows filtered
239
+ out. Stitch policy mirrors bars: defeatbeta deep history, yfinance for
240
+ the tail and complete fallback, yfinance wins on overlap. Live sanity
241
+ check against AAPL returned 5 splits (including 1987 which yfinance
242
+ doesn't have) + 91 dividends. New
243
+ `thetabook bars actions TICKER [--type split|dividend] [--tail N]` CLI.
244
+
245
+ - **Derived analytics lifted into `analysis/` package.** Created
246
+ `src/thetabook/analysis/` and moved `market/hv.py` + the new `ta.py`
247
+ modules + their tests. `market/` is now strictly data-source territory;
248
+ `analysis/` houses derived signals.
249
+
250
+ - **TA indicators — `analysis/ta.py`.** Three pure functions on a close
251
+ `Series`: `rsi(closes, window=14)` (Wilder smoothing via
252
+ `ewm(alpha=1/N)`), `macd(closes, fast=12, slow=26, signal=9)` (returns
253
+ DataFrame with `macd / signal / histogram`), `bollinger_bands(closes,
254
+ window=20, k=2.0)` (returns DataFrame with `middle / upper / lower /
255
+ percent_b / bandwidth`). Bollinger uses population stddev (`ddof=0`)
256
+ per the original 1980s formulation and TradingView/TOS convention —
257
+ deliberately inconsistent with `hv.py`'s sample stddev (`ddof=1`),
258
+ since the use cases differ. Convenience wrapper `indicators(ticker,
259
+ lookback_days=252)` fetches via `get_bars` and stitches all three into
260
+ one frame. New `thetabook ta TICKER [--indicator rsi|macd|bb|all]
261
+ [--lookback 1y] [--series]` CLI with interpretive labels.
262
+
263
+ - **Scenario lookup — `analysis/scenarios.py` + `thetabook scenarios
264
+ match/features`.** Two match modes. `find_trajectory_matches(ticker,
265
+ window=60, top_k=10)` pattern-matches the *shape* of the recent N-day
266
+ log-return trajectory against every prior N-day slice via Pearson
267
+ correlation (scale-invariant). `find_state_matches(ticker, top_k=10)`
268
+ pattern-matches the *current regime* via standardized euclidean
269
+ distance over a 4-feature vector: `rsi_14 / 100`, `bb_percent_b`,
270
+ `hv_rank_1y`, `drawdown_252d` (clipped at 50% then scaled to `[0, 1]`).
271
+ Both return per-match tables with forward-return columns at configurable
272
+ horizons (default 5/20/60/120 trading days) plus an outcome-summary
273
+ helper that produces median / IQR / pos-fraction per horizon.
274
+ Self-match excluded; overlapping matches deduped via `min_gap_days`.
275
+
276
+ ### Fixed
277
+
278
+ - **Index-alignment bug between yfinance and defeatbeta caught mid-flight.**
279
+ Initial live runs of `bars compare` returned "no overlapping dates" —
280
+ yfinance returns daily bars at session-close (e.g. `2026-05-22
281
+ 00:00:00-04:00` EDT, which converts to `04:00:00` naive UTC) while
282
+ defeatbeta returns midnight-dated rows, so the index intersection was
283
+ empty. Fixed both normalizers to `.normalize()` the time component on
284
+ daily bars (intraday intervals retain the timestamp via median-spacing
285
+ detection). Three regression tests pin the cross-source intersection.
286
+ Verbose `-v` flag added to `bars compare` so future timezone issues
287
+ self-diagnose without dropping into Python.
288
+
289
+ ### Infrastructure
290
+
291
+ - **+59 net tests** across `tests/market/test_bars.py` (+17 for the bars
292
+ cascade / stitch / version cache / split parsing / index alignment),
293
+ `tests/analysis/test_ta.py` (+16 for the three indicators),
294
+ `tests/analysis/test_scenarios.py` (+15 for match logic / dedup /
295
+ forward returns / outcome summary / recent-window guard). Synthetic-data
296
+ tests pin exact mathematical behavior (RSI=100 on pure uptrend, MACD=0
297
+ on flat, planted-analogue trajectory test recovers correlation ≈1.0).
298
+ - New dependencies: `defeatbeta-api>=0.0.57`, `pandas>=2.2` (already a
299
+ transitive dep, now explicit).
300
+
8
301
  ## [2.0.0] — 2026-05-13
9
302
 
10
303
  First PyPI release. Headline change: per-user data collapses under a single
@@ -22,6 +22,8 @@ The name nods to **theta**, the daily decay that quietly drives most options P&L
22
22
 
23
23
  - **Use the `thetabook` CLI as much as possible** to fetch data, answer questions, and run analysis. The CLI loads `.env`, applies the source cascade (Schwab → Massive → yfinance), and uses consistent IV/rate/yield conventions. Examples: `thetabook chain ... --greeks`, `thetabook evaluate <id>`, `thetabook greeks`, `thetabook price`, `thetabook dividends -v`. Don't reach for `uv run python -c "from thetabook... import"` when a CLI command exists for the same job.
24
24
  - **When the CLI doesn't expose what you need, drop into Python** — but always call `thetabook.paths.load_env()` first. Without it, the Schwab client returns `None` and the data cascade silently falls through to a worse source (yfinance), producing answers that disagree with the CLI's. If the gap is reusable, file an issue to surface it via a flag or new subcommand rather than letting the Python escape hatch normalize.
25
+ - **For technical analysis, use `thetabook hv` / `ta` / `scenarios` / `bars`.** `thetabook ta TICKER` gives RSI/MACD/Bollinger with interpretive labels; `thetabook hv TICKER` gives realized vol + HV-rank/percentile (the IV-rank substitute — there's no historical option IV); `thetabook scenarios match TICKER` answers "has this regime happened before?" with forward-return outcomes (run both `--mode trajectory` and `--mode state`; when they disagree, present both rather than averaging). These read daily *closes* from a historical-bars backbone, not the live price cascade — see [docs/cli.md](docs/cli.md) for the full flag set and [docs/behaviors.md](docs/behaviors.md) for the stitch.
26
+ - **Know how fresh each source is before quoting a number.** The historical bars under `hv`/`ta`/`scenarios` are a stitch: defeatbeta (weekly HuggingFace dataset) covers history up to the **most recent Friday's close**, and yfinance fills the rolling tail through today — so the latest *complete* indicator bar is usually last Friday, and intraday moves aren't reflected until the day closes. In the live price cascade, **Massive returns the previous business day's close, not an intraday quote** (Polygon `get_previous_close_agg`); only Schwab is real-time and yfinance is ~15-min delayed. When a figure comes from Massive or from the defeatbeta history, say so — don't present it as the current price.
25
27
 
26
28
  ## Repo layout
27
29
 
@@ -32,7 +34,8 @@ thetabook/
32
34
  ├── pyproject.toml # project metadata + [project.scripts] = thetabook
33
35
  ├── src/thetabook/ # the package
34
36
  │ ├── pricing/ # pure math: Black-Scholes, Greeks aggregation
35
- │ ├── market/ # data sources + caches (Schwab → Massive → yfinance)
37
+ │ ├── market/ # data sources + caches (Schwab → Massive → defeatbeta → yfinance)
38
+ │ ├── analysis/ # derived signals: HV, TA indicators, scenario lookup
36
39
  │ ├── portfolio/ # snapshot I/O, diff, per-account rules
37
40
  │ ├── ideas/ # trade-idea workflow (manage / evaluate / adjust / roll)
38
41
  │ ├── wiki/ # personal/wiki/ lint + auto-rendered ideas roll-up
@@ -53,7 +56,7 @@ For the rationale behind the layers, the data-flow diagram, the source cascade,
53
56
 
54
57
  ## Running things
55
58
 
56
- After `uv sync`, every CLI lives under a single `thetabook` umbrella. The full subcommand list grouped by area (snapshots, evaluate/adjust, ideas lifecycle, Greeks, chain, earnings/dividends, accounts, tickers, wiki, skills) lives in [docs/cli.md](docs/cli.md). The typical loop:
59
+ After `uv sync`, every CLI lives under a single `thetabook` umbrella. The full subcommand list grouped by area (snapshots, evaluate/adjust, ideas lifecycle, Greeks, chain, technical analysis, earnings/dividends, accounts, tickers, wiki, skills) lives in [docs/cli.md](docs/cli.md). The typical loop:
57
60
 
58
61
  ```bash
59
62
  thetabook refresh # pull positions from Schwab → personal/snapshots/YYYY-MM-DD.json
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thetabook
3
- Version: 2.0.0
3
+ Version: 2.2.0
4
4
  Summary: A journal for options traders who think in Greeks — Schwab portfolio review and strategy log with an AI copilot.
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
7
+ Requires-Dist: defeatbeta-api>=0.0.57
7
8
  Requires-Dist: massive>=2.5.0
8
9
  Requires-Dist: numpy>=2.4.4
10
+ Requires-Dist: pandas>=2.2
9
11
  Requires-Dist: pydantic>=2.9
10
12
  Requires-Dist: python-dotenv>=1.2.2
11
13
  Requires-Dist: pyyaml>=6.0.3
@@ -107,7 +107,7 @@ This is a one-shot move of `.env` + `schwab_token.json` into `personal/` so the
107
107
 
108
108
  ### Bootstrapping from a CSV instead of the Schwab API
109
109
 
110
- If you want to try thetabook before going through Schwab dev-app approval, export positions as CSV and import them. Both Schwab and Fidelity CSV formats are auto-detected:
110
+ If you want to try thetabook before going through Schwab dev-app approval, export positions as CSV and import them. Schwab, Fidelity, and Empower CSV formats are auto-detected:
111
111
 
112
112
  ```bash
113
113
  # Schwab: Positions tab → Export
@@ -116,8 +116,11 @@ thetabook import-csv path/to/Individual-Positions-*.csv path/to/Joint-Positions-
116
116
  # Fidelity: Positions → Download
117
117
  thetabook import-csv path/to/Portfolio_Positions.csv
118
118
 
119
+ # Empower: Holdings → Export
120
+ thetabook import-csv path/to/holdings.csv
121
+
119
122
  # Mixed: multiple brokers in one snapshot
120
- thetabook import-csv schwab.csv fidelity.csv
123
+ thetabook import-csv schwab.csv fidelity.csv empower.csv
121
124
  ```
122
125
 
123
126
  This produces the same snapshot format as the API path, so everything downstream works identically. Both option symbols and cash balances are handled.
@@ -183,7 +186,7 @@ Every workflow runs through the unified `thetabook` console script (installed by
183
186
  thetabook refresh # fetch & snapshot from Schwab API
184
187
  thetabook snapshot # path | fetched_at | age | fresh|stale | counts
185
188
  thetabook snapshot --path # absolute path only (for shell substitution)
186
- thetabook import-csv <csv> [<csv> ...] # import Schwab or Fidelity CSV exports
189
+ thetabook import-csv <csv> [<csv> ...] # import Schwab, Fidelity, or Empower CSV exports
187
190
  thetabook migrate # one-time: move pre-v1 dirs under personal/
188
191
 
189
192
  # Snapshot diff
@@ -248,6 +251,16 @@ thetabook dividends AAPL # yield + next ex-div for one
248
251
  thetabook dividends AAPL T VZ # multiple; exit 1 if none paying
249
252
  thetabook dividends AAPL --no-cache # force a fresh yfinance fetch
250
253
 
254
+ # Technical analysis on historical bars (defeatbeta deep history + yfinance tail)
255
+ thetabook hv AAPL # realized vol + HV-rank/percentile (IV-rank substitute)
256
+ thetabook ta AAPL # RSI / MACD / Bollinger with interpretive labels
257
+ thetabook ta AAPL --indicator rsi --series # one indicator, full rolling series
258
+ thetabook scenarios features AAPL # today's 4-feature regime vector + reading
259
+ thetabook scenarios match AAPL # trajectory analogues + forward returns (5/20/60/120d)
260
+ thetabook scenarios match AAPL --mode state # match current regime instead of recent-move shape
261
+ thetabook bars boundary AAPL # defeatbeta's last date (the stitch seam — usually last Fri)
262
+ thetabook bars actions AAPL --type split # corporate actions (splits / dividends)
263
+
251
264
  # Per-account rules + tax notes (reads personal/accounts.toml)
252
265
  thetabook accounts show # posture line per account (nickname + last4)
253
266
  thetabook accounts totals # NLV / cash table per account, sorted by liquidation desc
@@ -378,11 +391,23 @@ thetabook/
378
391
  │ │ ├── vol_lookup.py # per-leg IV, ATM IV, leg marks (shared cache)
379
392
  │ │ ├── leg_marks.py # fetch_leg_mark + pick_mark (conservative/mid)
380
393
  │ │ ├── earnings.py # upcoming-earnings lookup (7-day on-disk cache)
381
- │ │ └── dividends.py # yield + next ex-div lookup (7-day on-disk cache)
394
+ │ │ ├── dividends.py # yield + next ex-div lookup (7-day on-disk cache)
395
+ │ │ └── bars.py # historical daily OHLCV (defeatbeta deep history + yfinance tail, stitched)
396
+ │ │
397
+ │ ├── analysis/ # derived signals computed on historical bars
398
+ │ │ ├── hv.py # realized vol + HV-rank/percentile (the IV-rank substitute)
399
+ │ │ ├── ta.py # RSI / MACD / Bollinger Bands (pure functions on a close series)
400
+ │ │ └── scenarios.py # historical-analogue lookup (trajectory + state) with forward returns
382
401
  │ │
383
402
  │ ├── portfolio/ # snapshot I/O + per-account rules
384
403
  │ │ ├── get_positions.py # Schwab API → snapshot (OAuth via schwab-py)
385
- │ │ ├── import_csv_snapshot.py # Schwab/Fidelity CSV → snapshot
404
+ │ │ ├── import_csv_snapshot.py # broker CSV → snapshot (entry point; delegates to csv_parsers/)
405
+ │ │ ├── csv_parsers/ # per-broker CSV format handlers (extensible via BrokerCsvParser)
406
+ │ │ │ ├── __init__.py # REGISTRY + detect_and_parse() dispatch
407
+ │ │ │ ├── _base.py # BrokerCsvParser ABC + shared helpers
408
+ │ │ │ ├── schwab.py # Schwab positions export
409
+ │ │ │ ├── fidelity.py # Fidelity FullView export
410
+ │ │ │ └── empower.py # Empower Holdings export
386
411
  │ │ ├── diff_snapshots.py # compare two snapshots
387
412
  │ │ ├── accounts.py # per-account risk rules + tax notes
388
413
  │ │ └── migrate_to_personal.py # one-time migration from pre-v1 layout
@@ -445,7 +470,13 @@ thetabook/
445
470
  │ │ ├── test_vol_lookup.py
446
471
  │ │ ├── test_leg_marks.py
447
472
  │ │ ├── test_earnings.py
448
- │ │ └── test_dividends.py
473
+ │ │ ├── test_dividends.py
474
+ │ │ └── test_bars.py
475
+ │ │
476
+ │ ├── analysis/
477
+ │ │ ├── test_hv.py
478
+ │ │ ├── test_ta.py
479
+ │ │ └── test_scenarios.py
449
480
  │ │
450
481
  │ ├── portfolio/
451
482
  │ │ ├── test_get_positions.py