thetabook 2.0.0__tar.gz → 2.1.2__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 (175) hide show
  1. {thetabook-2.0.0 → thetabook-2.1.2}/.github/workflows/publish.yml +24 -28
  2. {thetabook-2.0.0 → thetabook-2.1.2}/CHANGELOG.md +232 -0
  3. {thetabook-2.0.0 → thetabook-2.1.2}/CLAUDE.md +2 -1
  4. {thetabook-2.0.0 → thetabook-2.1.2}/PKG-INFO +3 -1
  5. thetabook-2.1.2/ROADMAP.md +246 -0
  6. thetabook-2.1.2/docs/m23-audit.md +43 -0
  7. {thetabook-2.0.0 → thetabook-2.1.2}/pyproject.toml +6 -1
  8. thetabook-2.1.2/src/thetabook/analysis/hv.py +209 -0
  9. thetabook-2.1.2/src/thetabook/analysis/scenarios.py +425 -0
  10. thetabook-2.1.2/src/thetabook/analysis/ta.py +252 -0
  11. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/__init__.py +12 -0
  12. thetabook-2.1.2/src/thetabook/cli/bars.py +231 -0
  13. thetabook-2.1.2/src/thetabook/cli/hv.py +109 -0
  14. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/init.py +6 -2
  15. thetabook-2.1.2/src/thetabook/cli/scenarios.py +215 -0
  16. thetabook-2.1.2/src/thetabook/cli/ta.py +204 -0
  17. thetabook-2.1.2/src/thetabook/market/bars.py +796 -0
  18. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/install.py +37 -18
  19. thetabook-2.1.2/tests/analysis/test_hv.py +133 -0
  20. thetabook-2.1.2/tests/analysis/test_scenarios.py +364 -0
  21. thetabook-2.1.2/tests/analysis/test_ta.py +310 -0
  22. thetabook-2.1.2/tests/cli/test_analysis_cli.py +658 -0
  23. {thetabook-2.0.0 → thetabook-2.1.2}/tests/cli/test_init.py +44 -8
  24. thetabook-2.1.2/tests/market/test_bars.py +884 -0
  25. thetabook-2.1.2/tests/skills/__init__.py +0 -0
  26. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_install.py +47 -4
  27. {thetabook-2.0.0 → thetabook-2.1.2}/uv.lock +819 -1
  28. thetabook-2.0.0/ROADMAP.md +0 -419
  29. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/accounts-init.md +0 -0
  30. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/adjust.md +0 -0
  31. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/chain.md +0 -0
  32. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/close.md +0 -0
  33. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/diff.md +0 -0
  34. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/evaluate.md +0 -0
  35. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/greeks.md +0 -0
  36. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/idea.md +0 -0
  37. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/ideas.md +0 -0
  38. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/open.md +0 -0
  39. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/portfolio.md +0 -0
  40. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/price.md +0 -0
  41. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/refresh.md +0 -0
  42. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/roll-scenarios.md +0 -0
  43. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/roll.md +0 -0
  44. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/setup.md +0 -0
  45. {thetabook-2.0.0 → thetabook-2.1.2}/.claude/commands/wiki-lint.md +0 -0
  46. {thetabook-2.0.0 → thetabook-2.1.2}/.env.example +0 -0
  47. {thetabook-2.0.0 → thetabook-2.1.2}/.github/workflows/ci.yml +0 -0
  48. {thetabook-2.0.0 → thetabook-2.1.2}/.gitignore +0 -0
  49. {thetabook-2.0.0 → thetabook-2.1.2}/.python-version +0 -0
  50. {thetabook-2.0.0 → thetabook-2.1.2}/CONTRIBUTING.md +0 -0
  51. {thetabook-2.0.0 → thetabook-2.1.2}/LICENSE +0 -0
  52. {thetabook-2.0.0 → thetabook-2.1.2}/README.md +0 -0
  53. {thetabook-2.0.0 → thetabook-2.1.2}/SECURITY.md +0 -0
  54. {thetabook-2.0.0 → thetabook-2.1.2}/docs/architecture.md +0 -0
  55. {thetabook-2.0.0 → thetabook-2.1.2}/docs/behaviors.md +0 -0
  56. {thetabook-2.0.0 → thetabook-2.1.2}/docs/cli.md +0 -0
  57. {thetabook-2.0.0 → thetabook-2.1.2}/docs/hosted-service-proposal.md +0 -0
  58. {thetabook-2.0.0 → thetabook-2.1.2}/docs/skills-roadmap.md +0 -0
  59. {thetabook-2.0.0 → thetabook-2.1.2}/docs/skills.md +0 -0
  60. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/__init__.py +0 -0
  61. {thetabook-2.0.0/src/thetabook/ideas → thetabook-2.1.2/src/thetabook/analysis}/__init__.py +0 -0
  62. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cache.py +0 -0
  63. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/_shared.py +0 -0
  64. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/accounts.py +0 -0
  65. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/adjust.py +0 -0
  66. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/bs.py +0 -0
  67. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/chain.py +0 -0
  68. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/diff.py +0 -0
  69. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/dividends.py +0 -0
  70. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/earnings.py +0 -0
  71. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/evaluate.py +0 -0
  72. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/greeks.py +0 -0
  73. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/ideas.py +0 -0
  74. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/import_csv.py +0 -0
  75. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/leg_mark.py +0 -0
  76. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/migrate_home.py +0 -0
  77. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/price.py +0 -0
  78. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/refresh.py +0 -0
  79. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/roll.py +0 -0
  80. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/skills.py +0 -0
  81. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/snapshot.py +0 -0
  82. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/tickers.py +0 -0
  83. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/cli/wiki.py +0 -0
  84. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/config.py +0 -0
  85. {thetabook-2.0.0/src/thetabook/market → thetabook-2.1.2/src/thetabook/ideas}/__init__.py +0 -0
  86. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/ideas/adjust.py +0 -0
  87. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/ideas/core.py +0 -0
  88. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/ideas/evaluate_idea.py +0 -0
  89. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/ideas/manage_ideas.py +0 -0
  90. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/ideas/roll_scenarios.py +0 -0
  91. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/leg_parse.py +0 -0
  92. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/log.py +0 -0
  93. {thetabook-2.0.0/src/thetabook/portfolio → thetabook-2.1.2/src/thetabook/market}/__init__.py +0 -0
  94. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/_schwab.py +0 -0
  95. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/chains.py +0 -0
  96. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/dividends.py +0 -0
  97. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/earnings.py +0 -0
  98. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/leg_marks.py +0 -0
  99. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/prices.py +0 -0
  100. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/market/vol_lookup.py +0 -0
  101. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/models.py +0 -0
  102. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/paths.py +0 -0
  103. {thetabook-2.0.0/src/thetabook/pricing → thetabook-2.1.2/src/thetabook/portfolio}/__init__.py +0 -0
  104. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/portfolio/accounts.py +0 -0
  105. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/portfolio/diff_snapshots.py +0 -0
  106. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/portfolio/get_positions.py +0 -0
  107. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/portfolio/import_csv_snapshot.py +0 -0
  108. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/portfolio/scaffold.py +0 -0
  109. {thetabook-2.0.0/tests/skills → thetabook-2.1.2/src/thetabook/pricing}/__init__.py +0 -0
  110. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/pricing/bs.py +0 -0
  111. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/pricing/greeks.py +0 -0
  112. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/__init__.py +0 -0
  113. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/lint.py +0 -0
  114. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/models.py +0 -0
  115. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/parse.py +0 -0
  116. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/policy.py +0 -0
  117. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/registry.py +0 -0
  118. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/skills/render.py +0 -0
  119. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/README.md +0 -0
  120. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/accounts.toml.example +0 -0
  121. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/config.toml.example +0 -0
  122. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/idea.md +0 -0
  123. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/journal.md +0 -0
  124. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/learnings.md +0 -0
  125. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/skill.md +0 -0
  126. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/skills/setup-thetabook.md +0 -0
  127. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/wiki/index.md +0 -0
  128. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/wiki/log.md +0 -0
  129. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/wiki/overview.md +0 -0
  130. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/wiki/strategy.md +0 -0
  131. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/templates/wiki/underlying.md +0 -0
  132. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/tickers.py +0 -0
  133. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/wiki/__init__.py +0 -0
  134. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/wiki/lint.py +0 -0
  135. {thetabook-2.0.0 → thetabook-2.1.2}/src/thetabook/wiki/render.py +0 -0
  136. {thetabook-2.0.0 → thetabook-2.1.2}/tests/cli/test_bs_cli.py +0 -0
  137. {thetabook-2.0.0 → thetabook-2.1.2}/tests/cli/test_migrate_home.py +0 -0
  138. {thetabook-2.0.0 → thetabook-2.1.2}/tests/conftest.py +0 -0
  139. {thetabook-2.0.0 → thetabook-2.1.2}/tests/ideas/test_adjust.py +0 -0
  140. {thetabook-2.0.0 → thetabook-2.1.2}/tests/ideas/test_core.py +0 -0
  141. {thetabook-2.0.0 → thetabook-2.1.2}/tests/ideas/test_evaluate_idea.py +0 -0
  142. {thetabook-2.0.0 → thetabook-2.1.2}/tests/ideas/test_manage_ideas.py +0 -0
  143. {thetabook-2.0.0 → thetabook-2.1.2}/tests/ideas/test_roll_scenarios.py +0 -0
  144. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_chains.py +0 -0
  145. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_dividends.py +0 -0
  146. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_earnings.py +0 -0
  147. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_leg_marks.py +0 -0
  148. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_prices.py +0 -0
  149. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_schwab.py +0 -0
  150. {thetabook-2.0.0 → thetabook-2.1.2}/tests/market/test_vol_lookup.py +0 -0
  151. {thetabook-2.0.0 → thetabook-2.1.2}/tests/portfolio/test_accounts.py +0 -0
  152. {thetabook-2.0.0 → thetabook-2.1.2}/tests/portfolio/test_diff_snapshots.py +0 -0
  153. {thetabook-2.0.0 → thetabook-2.1.2}/tests/portfolio/test_get_positions.py +0 -0
  154. {thetabook-2.0.0 → thetabook-2.1.2}/tests/portfolio/test_import_csv_snapshot.py +0 -0
  155. {thetabook-2.0.0 → thetabook-2.1.2}/tests/portfolio/test_scaffold.py +0 -0
  156. {thetabook-2.0.0 → thetabook-2.1.2}/tests/pricing/test_bs.py +0 -0
  157. {thetabook-2.0.0 → thetabook-2.1.2}/tests/pricing/test_greeks.py +0 -0
  158. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/conftest.py +0 -0
  159. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_lint.py +0 -0
  160. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_models.py +0 -0
  161. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_parse.py +0 -0
  162. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_policy.py +0 -0
  163. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_registry.py +0 -0
  164. {thetabook-2.0.0 → thetabook-2.1.2}/tests/skills/test_render.py +0 -0
  165. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_cache.py +0 -0
  166. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_cli.py +0 -0
  167. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_config.py +0 -0
  168. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_factories.py +0 -0
  169. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_leg_parse.py +0 -0
  170. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_log.py +0 -0
  171. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_models.py +0 -0
  172. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_paths.py +0 -0
  173. {thetabook-2.0.0 → thetabook-2.1.2}/tests/test_tickers.py +0 -0
  174. {thetabook-2.0.0 → thetabook-2.1.2}/tests/wiki/test_lint.py +0 -0
  175. {thetabook-2.0.0 → thetabook-2.1.2}/tests/wiki/test_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,238 @@ All notable changes to this project are recorded here. Format loosely follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.1.2] — 2026-06-01
9
+
10
+ First-time-setup bug fixes plus a CI hardening so releases stop being hostage
11
+ to the GitHub Actions artifact-storage quota. No changes to the trading/analysis
12
+ CLIs. **1564 tests pass, ruff + mypy clean.**
13
+
14
+ ### Fixed
15
+
16
+ - **`thetabook init` / `/setup-thetabook` setup flow** ([#58](https://github.com/subsriram/thetabook/pull/58)).
17
+ Three bugs broke first-time setup end to end:
18
+ - The skill installer mirrored the source's authoring form into
19
+ `.claude/skills/`, so a flat-source skill landed as `<slug>.md` — but
20
+ Claude Code only discovers folder form (`<slug>/SKILL.md`), leaving
21
+ `/setup-thetabook` as a dead slash command. The installer (and init's
22
+ bare-mode skill install) now always normalize to folder form at the
23
+ destination, and a pre-existing flat `<slug>.md` is treated as a prior
24
+ install of the same slug (refused without `--force`, removed with it) so
25
+ the upgrade path doesn't orphan dead cruft.
26
+ - `init --non-interactive` aborted before the token: `--app-secret-stdin`
27
+ consumes stdin, so schwab-py's "Press ENTER" prompt hit EOF. `_run_oauth`
28
+ now passes `interactive=False`.
29
+ - `init` crashed after the token by writing `SCHWAB_APP_KEY` while the rest
30
+ of the app reads `SCHWAB_API_KEY`; the `.env` writer now emits the
31
+ canonical `SCHWAB_API_KEY`.
32
+
33
+ ### Changed
34
+
35
+ - **`publish.yml` — build + publish merged into one job** ([#59](https://github.com/subsriram/thetabook/pull/59)).
36
+ The two-job layout handed `dist/` between jobs via `upload-artifact` →
37
+ `download-artifact`, which made every release hostage to the account-level
38
+ artifact-storage quota: a full quota failed the upload step and the PyPI
39
+ publish never ran even though the wheel built clean (this is exactly what
40
+ blocked the v2.1.1 publish). Build and publish now share one runner, so
41
+ `dist/` stays on disk and goes straight to PyPI — no artifact round-trip,
42
+ no storage-quota dependency. OIDC trusted publishing (`environment: pypi`,
43
+ `id-token: write`) is unchanged.
44
+
45
+ ### Note
46
+
47
+ - **v2.1.1 was never published to PyPI.** Its tag push triggered the publish
48
+ workflow on the pre-#59 (artifact-handoff) layout, which failed on the
49
+ storage quota. 2.1.2 supersedes it and is the first PyPI release after 2.0.0
50
+ to carry the v2.1.x feature set; see the 2.1.1 and 2.1.0 entries below for
51
+ those features.
52
+
53
+ ## [2.1.1] — 2026-05-27
54
+
55
+ Test-coverage backfill for the v2.1.0 release plus a stdout-noise polish to
56
+ the defeatbeta fetcher. No behavior changes to user-facing CLIs. **1561 tests
57
+ pass (+74 net since v2.1.0), ruff + mypy clean.**
58
+
59
+ ### Added
60
+
61
+ - **CLI integration tests for the four new v2.1.0 subcommands** (`tests/cli/test_analysis_cli.py`,
62
+ 53 tests). `thetabook hv`, `thetabook ta`, `thetabook bars compare/boundary/actions`,
63
+ and `thetabook scenarios match/features` had no integration coverage at
64
+ v2.1.0 ship; this file fills that gap. Tests are hermetic — every external
65
+ dependency (`get_bars`, `compare_sources`, `get_actions`, `bars_boundary`,
66
+ `_fetch_full_closes`, `compute_state_features`, `indicators`) is
67
+ monkeypatched on its underlying module, so the suite doesn't touch
68
+ defeatbeta / yfinance / the cache. Covers happy paths for every mode,
69
+ flag-parse errors (`--mode`, `--indicator`, `--type`, `--lookback`,
70
+ `--horizons`), empty-result + insufficient-history exits, and the
71
+ `_rsi_label` / `_macd_label` / `_bb_label` helpers in `cli/ta.py` that
72
+ previously had no other coverage.
73
+
74
+ - **Non-daily interval coverage for `market/bars.py`** (8 tests). Prior tests
75
+ covered the `1d` path and one intraday case (`5m`); this round adds end-to-end
76
+ `get_bars(interval="1wk")` and `interval="1mo")` resample paths, the `1m`
77
+ intraday case, the intraday-failure → empty-canonical-frame fallback, a
78
+ regression guard pinning that weekly/monthly tail-fill calls yfinance at
79
+ `interval="1d"` (a leak of the user-facing interval would silently produce
80
+ wrong totals), `_resample("1mo")` aggregation math, the unknown-interval
81
+ no-op branch, and intraday-timestamp preservation in `_normalize_yfinance`
82
+ (sub-daily spacing must NOT zero the time component — would collapse
83
+ multiple bars per session onto one index value).
84
+
85
+ - **`analysis/ta.py:indicators()` integration tests** (4 tests). Beyond the
86
+ existing "columns present" + "empty bars" smoke tests, the new tests verify
87
+ that the wrapper's column values match what calling `rsi` / `macd` /
88
+ `bollinger_bands` directly produces (catches quiet rescaling or
89
+ column-shuffling), that custom indicator parameters (`rsi_window`,
90
+ `bb_window`, `bb_k`) propagate (regression guard for hardcoded-defaults),
91
+ that `as_of` flows down to `get_bars` as the end of the fetch window, and
92
+ that the bars-with-no-close-column guard branch is exercised.
93
+
94
+ - **`analysis/scenarios.py` state-vector boundary tests** (6 tests). The
95
+ 4-feature regime vector has explicit clipping/scaling that wasn't pinned:
96
+ drawdown at 0 (close at 252d high), drawdown clipped at the 50% cap (a
97
+ 70% crash saturates at exactly `1.0`, never above), drawdown scaling
98
+ (25% drop maps to exactly `0.5` — half of the cap, scaled to `[0, 1]`),
99
+ RSI normalization (`rsi() / 100` saturates at exactly `1.0` on pure
100
+ uptrend), HV-rank min-max boundary (top of rolling range ranks `1.0`,
101
+ regime-change bars rank above deep-calm bars), and leading-NaN warmup
102
+ (pre-rolling-window rows are NaN, not zero or partial-window stubs).
103
+
104
+ ### Changed
105
+
106
+ - **`market/bars.py` — defeatbeta stdout/stderr silenced + tail-fill warning
107
+ cleanup** ([38a577e](https://github.com/subsriram/thetabook/commit/38a577e)).
108
+ defeatbeta's first import / first per-ticker fetch printed three categories
109
+ of noise that polluted CLI streams: HF banner ASCII art via `print()` to
110
+ stdout, `[nltk_data]` download/up-to-date lines to stderr, and a
111
+ `DuckDBClient` INFO-level log line. New `_quiet_defeatbeta()` context
112
+ manager scopes all three suppressions to the wrapper boundary: stdout
113
+ captured via `contextlib.redirect_stdout`, stderr filtered through a
114
+ `_DropPrefixStream` proxy that drops `[nltk_data]`-prefixed lines (and
115
+ buffers partial writes so multi-write lines are evaluated as a unit),
116
+ and the `DuckDBClient` logger temporarily raised to WARNING then
117
+ restored. Our own `log.warn` lines and defeatbeta error messages still
118
+ pass through. The tail-fill path in `get_bars` now suppresses the raw
119
+ yfinance warning when defeatbeta has fallback data and emits a clearer
120
+ contextual one (`yfinance tail-fill failed for {ticker}; using
121
+ defeatbeta-only data through {boundary}`).
122
+
123
+ ### Infrastructure
124
+
125
+ - Project version bumped from `2.0.0` → `2.1.1`. v2.1.0 was never formally
126
+ released (no PyPI publish, no git tag); its CHANGELOG entry below is
127
+ backfilled for the record so the version history reads continuously.
128
+
129
+ ## [2.1.0] — 2026-05-26
130
+
131
+ Three coordinated threads built up over one session: a new historical data
132
+ source that reduces yfinance dependence, a TA-indicator library on top of
133
+ it, and a "has this happened before" historical-analogue lookup tool.
134
+ Shipped as [PR #55](https://github.com/subsriram/thetabook/pull/55).
135
+ **1487 tests pass (+59 net since v2.0.0), ruff + mypy clean.**
136
+
137
+ ### Added
138
+
139
+ - **defeatbeta-api as a primary historical data source — `market/bars.py`.**
140
+ New module exposes `get_bars(ticker, start, end, interval="1d")`,
141
+ `get_actions(ticker)` for splits + cash dividends, and
142
+ `bars_boundary(ticker)`. Unlike the price/chain cascades (which prefer
143
+ one source and fall through on failure), bars uses a **time-based stitch**:
144
+ defeatbeta serves history up to its dataset boundary (typically
145
+ prior-Friday close — the HF dataset updates weekly), yfinance fills the
146
+ rolling tail from `boundary + 1` through today. Callers receive one
147
+ DataFrame and don't know which source served each row. Daily-only from
148
+ defeatbeta; `1wk` / `1mo` resample from daily in-process; intraday
149
+ intervals (`1m`/`5m`/etc.) bypass defeatbeta entirely and pull from
150
+ yfinance for the full range. Cache lives at
151
+ `$THETABOOK_HOME/cache/bars/{TICKER}_1d.csv` per ticker with a sidecar
152
+ `_meta.json` tracking `{last_refresh, boundary, dataset_version}`.
153
+ yfinance tail is NOT cached (5 rows, changes intraday).
154
+
155
+ - **Stitch policy locked + validated.** `close` is split-only-adjusted on
156
+ both sources; `adj_close` is split + dividend-adjusted (yfinance
157
+ convention). defeatbeta has no native `adj_close` — rather than fabricate
158
+ one, we mirror `close` for defeatbeta rows. `thetabook bars compare
159
+ TICKER --overlap N` runs the validation: diffs defeatbeta vs yfinance
160
+ over an overlap window and prints per-column / per-row deltas with `*`
161
+ markers on cells exceeding the threshold. Validated 2026-05-26 against
162
+ AAPL (10d) and O (30d, spans monthly ex-div) — zero rows flagged at the
163
+ default 0.5% threshold.
164
+
165
+ - **Version-aware cache.** Beyond the 3-day TTL, the refresh logic does a
166
+ cheap `HuggingFaceClient.get_data_update_time()` probe when TTL expires.
167
+ If upstream `dataset_version` matches what's on disk, we skip the heavy
168
+ `Ticker.price()` refetch and just bump `last_refresh`. Net effect with
169
+ weekly HF refreshes and a 3-day TTL: previously paid for a full
170
+ `price()` fetch ~2× per week per ticker; now pay for one cheap version
171
+ probe instead. Fail-safe — when the probe returns `None` (no network,
172
+ library missing), the full-fetch path runs as before.
173
+
174
+ - **Corporate actions via stitched defeatbeta + yfinance — `get_actions`.**
175
+ `_parse_split_factor` converts defeatbeta's `"7:1"` / `"1:5"` strings to
176
+ float ratios matching yfinance's convention (`2.0` for 2-for-1, `0.2`
177
+ for 1-for-5 reverse). Zero-amount dividend placeholder rows filtered
178
+ out. Stitch policy mirrors bars: defeatbeta deep history, yfinance for
179
+ the tail and complete fallback, yfinance wins on overlap. Live sanity
180
+ check against AAPL returned 5 splits (including 1987 which yfinance
181
+ doesn't have) + 91 dividends. New
182
+ `thetabook bars actions TICKER [--type split|dividend] [--tail N]` CLI.
183
+
184
+ - **Derived analytics lifted into `analysis/` package.** Created
185
+ `src/thetabook/analysis/` and moved `market/hv.py` + the new `ta.py`
186
+ modules + their tests. `market/` is now strictly data-source territory;
187
+ `analysis/` houses derived signals.
188
+
189
+ - **TA indicators — `analysis/ta.py`.** Three pure functions on a close
190
+ `Series`: `rsi(closes, window=14)` (Wilder smoothing via
191
+ `ewm(alpha=1/N)`), `macd(closes, fast=12, slow=26, signal=9)` (returns
192
+ DataFrame with `macd / signal / histogram`), `bollinger_bands(closes,
193
+ window=20, k=2.0)` (returns DataFrame with `middle / upper / lower /
194
+ percent_b / bandwidth`). Bollinger uses population stddev (`ddof=0`)
195
+ per the original 1980s formulation and TradingView/TOS convention —
196
+ deliberately inconsistent with `hv.py`'s sample stddev (`ddof=1`),
197
+ since the use cases differ. Convenience wrapper `indicators(ticker,
198
+ lookback_days=252)` fetches via `get_bars` and stitches all three into
199
+ one frame. New `thetabook ta TICKER [--indicator rsi|macd|bb|all]
200
+ [--lookback 1y] [--series]` CLI with interpretive labels.
201
+
202
+ - **Scenario lookup — `analysis/scenarios.py` + `thetabook scenarios
203
+ match/features`.** Two match modes. `find_trajectory_matches(ticker,
204
+ window=60, top_k=10)` pattern-matches the *shape* of the recent N-day
205
+ log-return trajectory against every prior N-day slice via Pearson
206
+ correlation (scale-invariant). `find_state_matches(ticker, top_k=10)`
207
+ pattern-matches the *current regime* via standardized euclidean
208
+ distance over a 4-feature vector: `rsi_14 / 100`, `bb_percent_b`,
209
+ `hv_rank_1y`, `drawdown_252d` (clipped at 50% then scaled to `[0, 1]`).
210
+ Both return per-match tables with forward-return columns at configurable
211
+ horizons (default 5/20/60/120 trading days) plus an outcome-summary
212
+ helper that produces median / IQR / pos-fraction per horizon.
213
+ Self-match excluded; overlapping matches deduped via `min_gap_days`.
214
+
215
+ ### Fixed
216
+
217
+ - **Index-alignment bug between yfinance and defeatbeta caught mid-flight.**
218
+ Initial live runs of `bars compare` returned "no overlapping dates" —
219
+ yfinance returns daily bars at session-close (e.g. `2026-05-22
220
+ 00:00:00-04:00` EDT, which converts to `04:00:00` naive UTC) while
221
+ defeatbeta returns midnight-dated rows, so the index intersection was
222
+ empty. Fixed both normalizers to `.normalize()` the time component on
223
+ daily bars (intraday intervals retain the timestamp via median-spacing
224
+ detection). Three regression tests pin the cross-source intersection.
225
+ Verbose `-v` flag added to `bars compare` so future timezone issues
226
+ self-diagnose without dropping into Python.
227
+
228
+ ### Infrastructure
229
+
230
+ - **+59 net tests** across `tests/market/test_bars.py` (+17 for the bars
231
+ cascade / stitch / version cache / split parsing / index alignment),
232
+ `tests/analysis/test_ta.py` (+16 for the three indicators),
233
+ `tests/analysis/test_scenarios.py` (+15 for match logic / dedup /
234
+ forward returns / outcome summary / recent-window guard). Synthetic-data
235
+ tests pin exact mathematical behavior (RSI=100 on pure uptrend, MACD=0
236
+ on flat, planted-analogue trajectory test recovers correlation ≈1.0).
237
+ - New dependencies: `defeatbeta-api>=0.0.57`, `pandas>=2.2` (already a
238
+ transitive dep, now explicit).
239
+
8
240
  ## [2.0.0] — 2026-05-13
9
241
 
10
242
  First PyPI release. Headline change: per-user data collapses under a single
@@ -32,7 +32,8 @@ thetabook/
32
32
  ├── pyproject.toml # project metadata + [project.scripts] = thetabook
33
33
  ├── src/thetabook/ # the package
34
34
  │ ├── pricing/ # pure math: Black-Scholes, Greeks aggregation
35
- │ ├── market/ # data sources + caches (Schwab → Massive → yfinance)
35
+ │ ├── market/ # data sources + caches (Schwab → Massive → defeatbeta → yfinance)
36
+ │ ├── analysis/ # derived signals: HV, TA indicators, scenario lookup
36
37
  │ ├── portfolio/ # snapshot I/O, diff, per-account rules
37
38
  │ ├── ideas/ # trade-idea workflow (manage / evaluate / adjust / roll)
38
39
  │ ├── wiki/ # personal/wiki/ lint + auto-rendered ideas roll-up
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thetabook
3
- Version: 2.0.0
3
+ Version: 2.1.2
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