Skip to content

Commit 63097b3

Browse files
committed
Remove market compatibility reexports and fix example imports
1 parent 3bd967c commit 63097b3

138 files changed

Lines changed: 6978 additions & 1756 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/add-feature/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def test_example() -> None:
7373
python tools/validate_add_feature.py validate --mark-passed
7474
```
7575

76+
Use ordinary `validate` runs as a fast checkpoint during work.
77+
Use `validate --full` if you want the heavyweight repo-wide gate without closing the workflow.
78+
7679
12. If the workflow becomes stale or the task is abandoned, clear the active state explicitly:
7780

7881
```bash
@@ -117,6 +120,9 @@ The validator will fail if:
117120
- conditional categories required by public API, workflow, docs, or examples are missing
118121
- the repo validation commands fail
119122

123+
`validate` runs the fast checkpoint command set for in-progress work.
124+
`validate --full` and `validate --mark-passed` run the heavyweight repo-wide command bundle.
125+
120126
The Stop hook uses `.tmp/add-feature/.state.json` and blocks completion until the workflow is marked passed.
121127
`validate --mark-passed` and `clear` automatically delete the temporary spec, temporary review files, and workflow state.
122128
The UserPromptSubmit hook also injects workflow instructions whenever the user uses `$add-feature`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ from decimal import Decimal
3030

3131
from fuggers_py.calc import PricingSpec
3232
from fuggers_py.core import Currency, Date, Price
33-
from fuggers_py.market import AnalyticsCurves, QuoteSide
33+
from fuggers_py.market.state import AnalyticsCurves, QuoteSide
3434

3535
as_of = Date.from_ymd(2026, 1, 15)
3636
clean_price = Price.new(Decimal("99.125"), Currency.USD)

docs/MODULE_REFERENCE.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,12 +674,26 @@ Overnight fixing conventions and compounding helpers.
674674
- Module path: `market/indices/overnight.py`
675675
- Top-level classes/functions: `_to_decimal`, `OvernightCompounding`, `PublicationTime`, `_business_accrual_schedule`, `observation_date`, `_observed_schedule_date`, `publication_date`, `overnight_factor`, `_lookup_or_project_rate`
676676

677-
### `market/market_data.py`
677+
### `market/quotes.py`
678678

679-
Market-data traits and in-memory research helpers.
679+
Canonical quote protocols and concrete quote records.
680680

681-
- Module path: `market/market_data.py`
682-
- Top-level classes/functions: `_to_decimal`, `_coerce_decimal_fields`, `_apply_two_sided_quote_defaults`, `SourceType`, `CurveInstrumentType`, `VolSurfaceType`, `VolQuoteType`, `InflationInterpolation`, `RawQuote`, `CurvePoint`, `CurveInput`, `CurveInputs`, `BondQuote`, `RepoQuote`, `SwapQuote`, `BasisSwapQuote`, `BondFutureQuote`, `FxForwardQuote`, `CdsQuote`, `HaircutQuote`, `CurveData`, `IndexFixing`, `VolPoint`, `VolatilitySurface`, `FxRate`, `InflationFixing`, `EtfHolding`, `EtfQuote`, `MarketDataSnapshot`, `QuoteSource`, `CurveInputSource`, `IndexFixingSource`, `ReferenceCurveSource`, `VolatilitySource`, `FxRateSource`, `InflationFixingSource`, `EtfQuoteSource`, `PricingDataProvider`, `InMemoryQuoteSource`, `InMemoryCurveSource`, `InMemoryFixingSource`, `InMemoryVolatilitySource`, `InMemoryFxRateSource`, `InMemoryInflationFixingSource`, `InMemoryEtfQuoteSource`, `MarketDataProvider`
681+
- Module path: `market/quotes.py`
682+
- Top-level classes/functions: `SourceType`, `RawQuote`, `BondQuote`, `RepoQuote`, `SwapQuote`, `BasisSwapQuote`, `BondFutureQuote`, `FxForwardQuote`, `CdsQuote`, `HaircutQuote`, `InstrumentQuote`, `ScalarQuote`, `AnyInstrumentQuote`
683+
684+
### `market/snapshot.py`
685+
686+
Canonical snapshot records, stored fixings, surfaces, and ETF holdings.
687+
688+
- Module path: `market/snapshot.py`
689+
- Top-level classes/functions: `CurveInstrumentType`, `VolSurfaceType`, `VolQuoteType`, `InflationInterpolation`, `CurvePoint`, `CurveInput`, `CurveInputs`, `CurveData`, `IndexFixing`, `VolPoint`, `VolatilitySurface`, `FxRate`, `InflationFixing`, `EtfHolding`, `EtfQuote`, `MarketDataSnapshot`, `CurveInputSet`
690+
691+
### `market/sources.py`
692+
693+
Canonical market-data source protocols and in-memory providers.
694+
695+
- Module path: `market/sources.py`
696+
- Top-level classes/functions: `QuoteSource`, `CurveInputSource`, `IndexFixingSource`, `ReferenceCurveSource`, `VolatilitySource`, `FxRateSource`, `InflationFixingSource`, `EtfQuoteSource`, `PricingDataProvider`, `CurveSource`, `FixingSource`, `InMemoryQuoteSource`, `InMemoryCurveSource`, `InMemoryFixingSource`, `InMemoryVolatilitySource`, `InMemoryFxRateSource`, `InMemoryInflationFixingSource`, `InMemoryEtfQuoteSource`, `MarketDataProvider`
683697

684698
### `market/state.py`
685699

docs/api/market.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
Market state, quotes, fixings, indices, and curve abstractions.
44

5+
Canonical market modules:
6+
7+
- `fuggers_py.market.state`
8+
- market state helpers such as `QuoteSide` and `AnalyticsCurves`
9+
- `fuggers_py.market.quotes`
10+
- quote protocols and concrete quote families
11+
- `fuggers_py.market.snapshot`
12+
- curve inputs, fixings, surfaces, ETF holdings, and `MarketDataSnapshot`
13+
- `fuggers_py.market.sources`
14+
- source protocols, in-memory sources, and `MarketDataProvider`
15+
516
```{automodule} fuggers_py.market
617
:members:
718
:member-order: bysource

examples/02_financed_tips_multi_curve_workflow.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"from fuggers_py.core import Compounding, Currency, Date, Frequency, Price, YearMonth, Yield\n",
2828
"from fuggers_py.core.calendars import BusinessDayConvention\n",
2929
"from fuggers_py.core.daycounts import DayCountConvention\n",
30-
"from fuggers_py.market import InflationFixing as InflationFixingPoint, InMemoryInflationFixingSource\n",
30+
"from fuggers_py.market.snapshot import InflationFixing as InflationFixingPoint\n",
31+
"from fuggers_py.market.sources import InMemoryInflationFixingSource\n",
3132
"from fuggers_py.market.curves import DiscountCurveBuilder\n",
3233
"from fuggers_py.market.curves.funding import RepoCurve\n",
3334
"from fuggers_py.market.curves.inflation import bootstrap_inflation_curve\n",

examples/03_credit_basis_cross_market_and_optionality.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"\n",
3333
"from fuggers_py.core import Currency, Date, Frequency, Price\n",
3434
"from fuggers_py.core.daycounts import DayCountConvention\n",
35-
"from fuggers_py.market import AnalyticsCurves, CdsQuote\n",
35+
"from fuggers_py.market.quotes import CdsQuote\n",
36+
"from fuggers_py.market.state import AnalyticsCurves\n",
3637
"from fuggers_py.market.curves import DiscountCurveBuilder\n",
3738
"from fuggers_py.market.curves.credit import bootstrap_credit_curve\n",
3839
"from fuggers_py.market.curves.funding import RepoCurve\n",

examples/04_portfolio_etf_and_engine_pipeline.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
"from fuggers_py.core import Currency, Date, Frequency, Price, YearMonth, Yield\n",
3838
"from fuggers_py.core.calendars import BusinessDayConvention\n",
3939
"from fuggers_py.core.daycounts import DayCountConvention\n",
40-
"from fuggers_py.market import CurveInputs, CurvePoint, InflationFixing as RealizedCpiPoint, InMemoryInflationFixingSource as RealizedCpiSource, MarketDataSnapshot, RawQuote\n",
40+
"from fuggers_py.market.quotes import RawQuote\n",
41+
"from fuggers_py.market.snapshot import CurveInputs, CurvePoint, InflationFixing as RealizedCpiPoint, MarketDataSnapshot\n",
42+
"from fuggers_py.market.sources import InMemoryInflationFixingSource as RealizedCpiSource\n",
4143
"from fuggers_py.market.curves.funding import RepoCurve\n",
4244
"from fuggers_py.market.curves.inflation import bootstrap_inflation_curve\n",
4345
"from fuggers_py.portfolio import Classification, Holding, KeyRateShiftScenario, PortfolioAnalytics, PortfolioBenchmark, PortfolioBuilder, RateShockScenario, SecYieldInput, SpreadShockScenario, build_creation_basket, calculate_etf_nav_metrics, calculate_portfolio_analytics, calculate_sec_yield, estimate_yield_from_holdings, run_stress_scenarios\n",

examples/05_fitted_nominal_real_breakeven_minimal.ipynb

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 8,
15+
"execution_count": 1,
1616
"id": "imports",
1717
"metadata": {},
1818
"outputs": [],
@@ -35,18 +35,21 @@
3535
"import pandas as pd\n",
3636
"\n",
3737
"from fuggers_py.core import Currency, Date, Frequency, YearMonth\n",
38-
"from fuggers_py.market import InflationFixing, InMemoryInflationFixingSource\n",
39-
"import fuggers_py.market.market_data as market_data\n",
38+
"from fuggers_py.market.snapshot import InflationFixing\n",
39+
"from fuggers_py.market.sources import InMemoryInflationFixingSource\n",
40+
"import fuggers_py.market.quotes as market_quotes\n",
4041
"import fuggers_py.market.curves.fitted_bonds.fair_value as fitted_fair_value\n",
42+
"import fuggers_py.market.curves.fitted_bonds.inputs as fitted_inputs\n",
4143
"import fuggers_py.market.curves.fitted_bonds.model as fitted_model\n",
4244
"import fuggers_py.market.curves.fitted_bonds.optimization as fitted_optimization\n",
4345
"import fuggers_py.market.curves.fitted_bonds.par_curve as fitted_par_curve\n",
4446
"import fuggers_py.market.curves.fitted_bonds.pricing_adapters as fitted_pricing_adapters\n",
4547
"import fuggers_py.market.curves.inflation.breakeven as inflation_breakeven\n",
4648
"\n",
4749
"for module in (\n",
48-
" market_data,\n",
50+
" market_quotes,\n",
4951
" fitted_fair_value,\n",
52+
" fitted_inputs,\n",
5053
" fitted_model,\n",
5154
" fitted_pricing_adapters,\n",
5255
" fitted_optimization,\n",
@@ -55,11 +58,12 @@
5558
"):\n",
5659
" importlib.reload(module)\n",
5760
"\n",
58-
"BondQuote = market_data.BondQuote\n",
61+
"BondQuote = market_quotes.BondQuote\n",
5962
"BreakevenParCurve = inflation_breakeven.BreakevenParCurve\n",
6063
"BreakevenZeroCurve = inflation_breakeven.BreakevenZeroCurve\n",
6164
"CubicSplineZeroRateCurveModel = fitted_model.CubicSplineZeroRateCurveModel\n",
6265
"FittedBondCurveFitter = fitted_optimization.FittedBondCurveFitter\n",
66+
"FittedBondObservation = fitted_inputs.FittedBondObservation\n",
6367
"FittedParYieldCurve = fitted_par_curve.FittedParYieldCurve\n",
6468
"NominalGovernmentBondPricingAdapter = fitted_pricing_adapters.NominalGovernmentBondPricingAdapter\n",
6569
"ParCurveSpec = fitted_par_curve.ParCurveSpec\n",
@@ -82,7 +86,7 @@
8286
},
8387
{
8488
"cell_type": "code",
85-
"execution_count": 9,
89+
"execution_count": 2,
8690
"id": "setup-code",
8791
"metadata": {},
8892
"outputs": [],
@@ -169,7 +173,7 @@
169173
},
170174
{
171175
"cell_type": "code",
172-
"execution_count": 10,
176+
"execution_count": 3,
173177
"id": "nominal-obs",
174178
"metadata": {},
175179
"outputs": [
@@ -203,7 +207,7 @@
203207
"type": "float"
204208
}
205209
],
206-
"ref": "295dcafc-27a4-4978-a908-ee330e78b54b",
210+
"ref": "cfe0ed84-eaf1-40ec-a270-62e6960ee18d",
207211
"rows": [
208212
[
209213
"0",
@@ -335,7 +339,7 @@
335339
"5 UST10Y 10 3.50 101.127"
336340
]
337341
},
338-
"execution_count": 10,
342+
"execution_count": 3,
339343
"metadata": {},
340344
"output_type": "execute_result"
341345
}
@@ -356,11 +360,14 @@
356360
" bond = build_nominal_bond(maturity_years, coupon_rate)\n",
357361
" clean_price = dirty_price_from_curve(bond, TRUE_NOMINAL_CURVE, REFERENCE_DATE) - bond.accrued_interest(REFERENCE_DATE)\n",
358362
" nominal_observations.append(\n",
359-
" BondQuote(\n",
360-
" instrument_id=instrument_id,\n",
363+
" FittedBondObservation.from_parts(\n",
361364
" bond=bond,\n",
362-
" clean_price=clean_price,\n",
363-
" as_of=REFERENCE_DATE,\n",
365+
" quote=BondQuote(\n",
366+
" instrument_id=instrument_id,\n",
367+
" clean_price=clean_price,\n",
368+
" as_of=REFERENCE_DATE,\n",
369+
" currency=Currency.USD,\n",
370+
" ),\n",
364371
" settlement_date=REFERENCE_DATE,\n",
365372
" )\n",
366373
" )\n",
@@ -379,7 +386,7 @@
379386
},
380387
{
381388
"cell_type": "code",
382-
"execution_count": 11,
389+
"execution_count": 4,
383390
"id": "tips-obs",
384391
"metadata": {},
385392
"outputs": [
@@ -413,7 +420,7 @@
413420
"type": "float"
414421
}
415422
],
416-
"ref": "7361fb4f-ab6c-45ec-b675-91b66f83f0a9",
423+
"ref": "e0dabd22-46f1-4be8-9a29-d5a2b5979b25",
417424
"rows": [
418425
[
419426
"0",
@@ -530,7 +537,7 @@
530537
"4 TIPS10Y 10 1.10 134.343"
531538
]
532539
},
533-
"execution_count": 11,
540+
"execution_count": 4,
534541
"metadata": {},
535542
"output_type": "execute_result"
536543
}
@@ -550,11 +557,14 @@
550557
" bond = build_tips_bond(maturity_years, coupon_rate)\n",
551558
" clean_price = tips_dirty_price_from_curve(bond) - bond.accrued_interest(REFERENCE_DATE, fixing_source=FIXING_SOURCE)\n",
552559
" tips_observations.append(\n",
553-
" BondQuote(\n",
554-
" instrument_id=instrument_id,\n",
560+
" FittedBondObservation.from_parts(\n",
555561
" bond=bond,\n",
556-
" clean_price=clean_price,\n",
557-
" as_of=REFERENCE_DATE,\n",
562+
" quote=BondQuote(\n",
563+
" instrument_id=instrument_id,\n",
564+
" clean_price=clean_price,\n",
565+
" as_of=REFERENCE_DATE,\n",
566+
" currency=Currency.USD,\n",
567+
" ),\n",
558568
" settlement_date=REFERENCE_DATE,\n",
559569
" )\n",
560570
" )\n",
@@ -583,7 +593,7 @@
583593
},
584594
{
585595
"cell_type": "code",
586-
"execution_count": 12,
596+
"execution_count": 5,
587597
"id": "fit-code",
588598
"metadata": {},
589599
"outputs": [
@@ -617,7 +627,7 @@
617627
"type": "float"
618628
}
619629
],
620-
"ref": "786d7629-278b-486c-9741-2167531cf161",
630+
"ref": "7c900d8f-6904-4a12-922d-6d20583d6243",
621631
"rows": [
622632
[
623633
"0",
@@ -689,7 +699,7 @@
689699
"1 real True 0.0 0.0"
690700
]
691701
},
692-
"execution_count": 12,
702+
"execution_count": 5,
693703
"metadata": {},
694704
"output_type": "execute_result"
695705
}
@@ -736,7 +746,7 @@
736746
},
737747
{
738748
"cell_type": "code",
739-
"execution_count": 13,
749+
"execution_count": 6,
740750
"id": "derived-code",
741751
"metadata": {},
742752
"outputs": [
@@ -785,7 +795,7 @@
785795
"type": "float"
786796
}
787797
],
788-
"ref": "1c31ff7c-1b91-42d7-9cb3-43cf73552a91",
798+
"ref": "442e9a51-21fa-42df-823a-07885a4fce6e",
789799
"rows": [
790800
[
791801
"0",
@@ -942,7 +952,7 @@
942952
"4 3.367 0.784 2.582 "
943953
]
944954
},
945-
"execution_count": 13,
955+
"execution_count": 6,
946956
"metadata": {},
947957
"output_type": "execute_result"
948958
}
@@ -971,7 +981,7 @@
971981
},
972982
{
973983
"cell_type": "code",
974-
"execution_count": 14,
984+
"execution_count": 7,
975985
"id": "plots",
976986
"metadata": {},
977987
"outputs": [

examples/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Examples
2+
3+
This folder is a small map of the example notebooks.
4+
5+
- `01_cash_bond_and_curve_workflow.ipynb`
6+
Cash bond pricing and curve work.
7+
- `02_financed_tips_multi_curve_workflow.ipynb`
8+
TIPS pricing with funding and more than one curve.
9+
- `03_credit_basis_cross_market_and_optionality.ipynb`
10+
Credit basis, cross-market views, and embedded option cases.
11+
- `04_portfolio_etf_and_engine_pipeline.ipynb`
12+
Portfolio, ETF, and engine flow in one place.
13+
- `05_fitted_nominal_real_breakeven_minimal.ipynb`
14+
Minimal fitted nominal, real, and breakeven workflow.
15+
16+
`synthetic_data/` holds the small input files used by the notebooks.

0 commit comments

Comments
 (0)