Skip to content

Commit e41d830

Browse files
Merge pull request #36 from C00ldudeNoonan/backtesting
analysis updates
2 parents 58e73d6 + 9acc835 commit e41d830

9 files changed

Lines changed: 560 additions & 178 deletions

File tree

.github/workflows/branch_deployments.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
pip install dbt-core dbt-duckdb
6666
cd project-repo/macro_agents/dbt_project
6767
dbt deps || true
68-
dbt parse --target prod || dbt parse
68+
dbt parse
6969
7070
- name: Python Executable Deploy
7171
if: steps.prerun.outputs.result == 'pex-deploy'

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install dependencies with uv
3535
run: |
3636
cd macro_agents
37-
uv sync --dev
37+
uv sync --extra dev
3838
3939
- name: Lint with ruff
4040
continue-on-error: true

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
pip install dbt-core dbt-duckdb
6969
cd project-repo/macro_agents/dbt_project
7070
dbt deps || true
71-
dbt parse --target prod || dbt parse
71+
dbt parse
7272
7373
- name: Python Executable Deploy
7474
if: steps.prerun.outputs.result == 'pex-deploy'

macro_agents/pyproject.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@ name = "macro_agents"
33
requires-python = ">=3.10.19,<3.14"
44
version = "0.1.0"
55
dependencies = [
6-
"dagster>=1.11.4",
6+
"dagster>=1.11.4,<2.0.0", # Add upper bound
77
"dagster-cloud",
88
"dagster-duckdb",
9-
"polars",
9+
"polars>=0.20.0,<1.0.0", # Pin polars
1010
"dagster-dbt",
11-
"requests",
12-
"dbt-core",
13-
"google-api-core",
14-
"google-auth",
15-
"google-cloud-bigquery",
16-
"dbt-duckdb",
17-
"dagster-shared>=1.11.4",
18-
"dagster-pipes>=1.11.4",
19-
"dagster-dg-cli>=1.11.4",
20-
"dagster-webserver>=1.11.4",
21-
"pyarrow>=21.0.0",
22-
"beautifulsoup4",
23-
"lxml",
24-
"ruff>=0.12.7",
25-
"tenacity>=9.1.2",
26-
"dspy>=2.6.27",
27-
"sqlfluff>=3.4.2",
28-
"sqlfluff-templater-dbt>=3.4.2",
11+
"requests>=2.31.0,<3.0.0",
12+
"dbt-core>=1.10.0,<2.0.0", # Pin dbt-core
13+
"google-api-core>=2.0.0,<3.0.0",
14+
"google-auth>=2.0.0,<3.0.0",
15+
"google-cloud-bigquery>=3.0.0,<4.0.0",
16+
"dbt-duckdb>=1.10.0,<2.0.0",
17+
"dagster-shared>=1.11.4,<2.0.0",
18+
"dagster-pipes>=1.11.4,<2.0.0",
19+
"dagster-dg-cli>=1.11.4,<2.0.0",
20+
"dagster-webserver>=1.11.4,<2.0.0",
21+
"pyarrow>=21.0.0,<22.0.0", # Pin pyarrow
22+
"beautifulsoup4>=4.12.0,<5.0.0",
23+
"lxml>=5.0.0,<6.0.0",
24+
# Move dev tools to optional-dependencies
25+
"tenacity>=9.1.2,<10.0.0",
26+
"dspy>=2.6.27,<3.0.0",
2927
"dagster-sling",
30-
"google-cloud-storage>=2.10.0",
31-
"openai>=1.0.0",
32-
"anthropic>=0.18.0",
33-
"google-generativeai>=0.3.0",
28+
"google-cloud-storage>=2.10.0,<3.0.0",
29+
"openai>=1.0.0,<2.0.0",
30+
"anthropic>=0.18.0,<1.0.0",
31+
"google-generativeai>=0.3.0,<1.0.0",
3432
]
3533

3634
[project.optional-dependencies]
@@ -40,7 +38,9 @@ dev = [
4038
"pytest-cov",
4139
"pytest-xdist",
4240
"mypy",
43-
"ruff",
41+
"ruff>=0.12.7,<1.0.0", # Move ruff here
42+
"sqlfluff>=3.4.2,<4.0.0", # Move sqlfluff here
43+
"sqlfluff-templater-dbt>=3.4.2,<4.0.0", # Move here
4444
]
4545

4646
[build-system]

macro_agents/src/macro_agents/defs/agents/backtest_economy_state_analyzer.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ class BacktestConfig(dg.Config):
4040
description="Backtest economy state analysis with historical data cutoff",
4141
deps=[
4242
dg.AssetKey(["fred_series_latest_aggregates_snapshot"]),
43+
dg.AssetKey(["fred_monthly_diff"]),
4344
dg.AssetKey(["leading_econ_return_indicator_snapshot"]),
4445
dg.AssetKey(["us_sector_summary_snapshot"]),
46+
dg.AssetKey(["major_indicies_summary"]),
4547
dg.AssetKey(["energy_commodities_summary_snapshot"]),
4648
dg.AssetKey(["input_commodities_summary_snapshot"]),
4749
dg.AssetKey(["agriculture_commodities_summary_snapshot"]),
4850
dg.AssetKey(["financial_conditions_index"]),
51+
dg.AssetKey(["housing_inventory_latest_aggregates"]),
52+
dg.AssetKey(["housing_mortgage_rates"]),
53+
dg.AssetKey(["stg_treasury_yields"]),
4954
],
5055
)
5156
def backtest_analyze_economy_state(
@@ -97,6 +102,21 @@ def backtest_analyze_economy_state(
97102
md, cutoff_date=config.backtest_date
98103
)
99104

105+
context.log.info("Gathering housing market data with cutoff date...")
106+
housing_data = economic_analysis.get_housing_data(
107+
md, cutoff_date=config.backtest_date
108+
)
109+
110+
context.log.info("Gathering yield curve data with cutoff date...")
111+
yield_curve_data = economic_analysis.get_yield_curve_data(
112+
md, cutoff_date=config.backtest_date
113+
)
114+
115+
context.log.info("Gathering economic trends data with cutoff date...")
116+
economic_trends = economic_analysis.get_economic_trends(
117+
md, cutoff_date=config.backtest_date
118+
)
119+
100120
optimized_analyzer = None
101121
if config.use_optimized_models and economic_analysis.use_optimized_models:
102122
optimized_analyzer = economic_analysis.load_optimized_module(
@@ -126,12 +146,15 @@ def backtest_analyze_economy_state(
126146
)
127147

128148
context.log.info(
129-
f"Running economy state analysis with historical data including FCI (personality: {config.personality})..."
149+
f"Running economy state analysis with historical data including FCI, housing, yield curve, and trends (personality: {config.personality})..."
130150
)
131151
analysis_result = analyzer_to_use(
132152
economic_data=economic_data,
133153
commodity_data=commodity_data,
134154
financial_conditions_index=fci_data,
155+
housing_data=housing_data,
156+
yield_curve_data=yield_curve_data,
157+
economic_trends=economic_trends,
135158
personality=config.personality,
136159
)
137160

@@ -155,6 +178,16 @@ def backtest_analyze_economy_state(
155178
"agriculture_commodities_summary_snapshot",
156179
],
157180
"financial_conditions_index_table": "financial_conditions_index",
181+
"housing_data_tables": [
182+
"housing_inventory_latest_aggregates",
183+
"housing_mortgage_rates",
184+
],
185+
"yield_curve_table": "stg_treasury_yields",
186+
"economic_trends_table": "fred_monthly_diff",
187+
"market_data_tables": [
188+
"us_sector_summary_snapshot",
189+
"major_indicies_summary",
190+
],
158191
},
159192
}
160193

0 commit comments

Comments
 (0)