|
5 | 5 | from macro_agents.defs.resources.fred import fred_resource |
6 | 6 | from macro_agents.defs.resources.market_stack import marketstack_resource |
7 | 7 | from macro_agents.defs.transformation.dbt import dbt_cli_resource |
8 | | -from macro_agents.defs.agents.analysis_agent import EconomicAnalyzer |
9 | | -from macro_agents.defs.agents.economic_cycle_analyzer import EconomicCycleAnalyzer |
| 8 | +from macro_agents.defs.agents.analysis_agent import ( |
| 9 | + EconomicAnalyzer, |
| 10 | + sector_inflation_analysis, |
| 11 | + sector_inflation_specific_analysis, |
| 12 | +) |
| 13 | +from macro_agents.defs.agents.economic_cycle_analyzer import ( |
| 14 | + EconomicCycleAnalyzer, |
| 15 | + economic_cycle_analysis, |
| 16 | +) |
10 | 17 | from macro_agents.defs.agents.enhanced_economic_cycle_analyzer import ( |
11 | 18 | EnhancedEconomicCycleAnalyzer, |
12 | 19 | ) |
13 | | -from macro_agents.defs.agents.asset_allocation_analyzer import AssetAllocationAnalyzer |
| 20 | +from macro_agents.defs.agents.asset_allocation_analyzer import ( |
| 21 | + AssetAllocationAnalyzer, |
| 22 | + asset_allocation_recommendations, |
| 23 | + custom_asset_allocation, |
| 24 | +) |
| 25 | +from macro_agents.defs.agents.economic_dashboard import economic_monitoring_alerts |
14 | 26 | from macro_agents.defs.agents.dspy_evaluation import FinancialEvaluator, PromptOptimizer |
15 | 27 | from macro_agents.defs.agents.backtesting import BacktestingEngine |
16 | 28 | from macro_agents.defs.agents.model_improvement_pipeline import ModelImprovementPipeline |
17 | 29 | from macro_agents.defs.agents.backtesting_visualization import BacktestingVisualizer |
18 | 30 | from macro_agents.defs.schedules import schedules, sensors, jobs |
| 31 | +from macro_agents.defs.replication.sling import replication_assets, sling_resource |
| 32 | +from macro_agents.defs.transformation.dbt import full_dbt_assets |
| 33 | +from macro_agents.defs.transformation.financial_condition_index import ( |
| 34 | + financial_conditions_index, |
| 35 | + fci_weights_config, |
| 36 | +) |
| 37 | +from macro_agents.defs.ingestion.market_stack import ( |
| 38 | + us_sector_etfs_raw, |
| 39 | + currency_etfs_raw, |
| 40 | + major_indices_raw, |
| 41 | + fixed_income_etfs_raw, |
| 42 | + global_markets_raw, |
| 43 | + energy_commodities_raw, |
| 44 | + input_commodities_raw, |
| 45 | + agriculture_commodities_raw, |
| 46 | +) |
| 47 | +from macro_agents.defs.ingestion.fred import fred_raw |
| 48 | +from macro_agents.defs.ingestion.treasury_yields import treasury_yields_raw |
| 49 | +from macro_agents.defs.ingestion.bls import housing_inventory_raw, housing_pulse_raw |
19 | 50 |
|
20 | 51 |
|
21 | | -# Find the project root by looking for pyproject.toml |
22 | | -# In local dev: use __file__ relative path |
23 | | -# In Dagster Cloud: use working directory (where pyproject.toml is bundled) |
24 | 52 | def find_project_root(): |
25 | | - # Try working directory first (for Dagster Cloud deployments) |
26 | 53 | cwd = Path.cwd() |
27 | 54 | if (cwd / "pyproject.toml").exists(): |
28 | 55 | return cwd |
29 | 56 |
|
30 | | - # Try __file__ relative path (for local dev) |
31 | 57 | file_root = Path(__file__).parent.parent |
32 | 58 | if (file_root / "pyproject.toml").exists(): |
33 | 59 | return file_root |
34 | 60 |
|
35 | | - # Fallback: use __file__ relative path anyway |
36 | 61 | return file_root |
37 | 62 |
|
38 | 63 |
|
39 | 64 | project_root = find_project_root() |
40 | 65 |
|
41 | | -defs = dg.Definitions.merge( |
42 | | - dg.load_from_defs_folder(project_root=project_root), |
43 | | - dg.Definitions( |
44 | | - resources={ |
45 | | - "md": motherduck_resource, |
46 | | - "fred": fred_resource, |
47 | | - "marketstack": marketstack_resource, |
48 | | - "dbt": dbt_cli_resource, |
49 | | - "analyzer": EconomicAnalyzer( |
50 | | - model_name=dg.EnvVar("MODEL_NAME"), |
51 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
52 | | - ), |
53 | | - "cycle_analyzer": EconomicCycleAnalyzer( |
54 | | - model_name=dg.EnvVar("MODEL_NAME"), |
55 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
56 | | - ), |
57 | | - "enhanced_cycle_analyzer": EnhancedEconomicCycleAnalyzer( |
58 | | - model_name=dg.EnvVar("MODEL_NAME"), |
59 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
60 | | - ), |
61 | | - "allocation_analyzer": AssetAllocationAnalyzer( |
62 | | - model_name=dg.EnvVar("MODEL_NAME"), |
63 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
64 | | - ), |
65 | | - "evaluator": FinancialEvaluator( |
66 | | - model_name=dg.EnvVar("MODEL_NAME"), |
67 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
68 | | - ), |
69 | | - "optimizer": PromptOptimizer( |
70 | | - model_name=dg.EnvVar("MODEL_NAME"), |
71 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
72 | | - ), |
73 | | - "backtesting_engine": BacktestingEngine( |
74 | | - model_name=dg.EnvVar("MODEL_NAME"), |
75 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
76 | | - ), |
77 | | - "model_pipeline": ModelImprovementPipeline( |
78 | | - model_name=dg.EnvVar("MODEL_NAME"), |
79 | | - openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
80 | | - ), |
81 | | - "visualizer": BacktestingVisualizer(), |
82 | | - }, |
83 | | - schedules=schedules, |
84 | | - sensors=sensors, |
85 | | - jobs=list(jobs.values()), |
86 | | - ), |
| 66 | +defs = dg.Definitions( |
| 67 | + assets=[ |
| 68 | + replication_assets, |
| 69 | + full_dbt_assets, |
| 70 | + us_sector_etfs_raw, |
| 71 | + currency_etfs_raw, |
| 72 | + major_indices_raw, |
| 73 | + fixed_income_etfs_raw, |
| 74 | + global_markets_raw, |
| 75 | + energy_commodities_raw, |
| 76 | + input_commodities_raw, |
| 77 | + agriculture_commodities_raw, |
| 78 | + fred_raw, |
| 79 | + treasury_yields_raw, |
| 80 | + housing_inventory_raw, |
| 81 | + housing_pulse_raw, |
| 82 | + financial_conditions_index, |
| 83 | + fci_weights_config, |
| 84 | + sector_inflation_analysis, |
| 85 | + sector_inflation_specific_analysis, |
| 86 | + economic_cycle_analysis, |
| 87 | + asset_allocation_recommendations, |
| 88 | + custom_asset_allocation, |
| 89 | + economic_monitoring_alerts, |
| 90 | + ], |
| 91 | + resources={ |
| 92 | + "md": motherduck_resource, |
| 93 | + "fred": fred_resource, |
| 94 | + "marketstack": marketstack_resource, |
| 95 | + "dbt": dbt_cli_resource, |
| 96 | + "sling": sling_resource, |
| 97 | + "analyzer": EconomicAnalyzer( |
| 98 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 99 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 100 | + ), |
| 101 | + "cycle_analyzer": EconomicCycleAnalyzer( |
| 102 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 103 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 104 | + ), |
| 105 | + "enhanced_cycle_analyzer": EnhancedEconomicCycleAnalyzer( |
| 106 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 107 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 108 | + ), |
| 109 | + "allocation_analyzer": AssetAllocationAnalyzer( |
| 110 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 111 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 112 | + ), |
| 113 | + "evaluator": FinancialEvaluator( |
| 114 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 115 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 116 | + ), |
| 117 | + "optimizer": PromptOptimizer( |
| 118 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 119 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 120 | + ), |
| 121 | + "backtesting_engine": BacktestingEngine( |
| 122 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 123 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 124 | + ), |
| 125 | + "model_pipeline": ModelImprovementPipeline( |
| 126 | + model_name=dg.EnvVar("MODEL_NAME"), |
| 127 | + openai_api_key=dg.EnvVar("OPENAI_API_KEY"), |
| 128 | + ), |
| 129 | + "visualizer": BacktestingVisualizer(), |
| 130 | + }, |
| 131 | + schedules=schedules, |
| 132 | + sensors=sensors, |
| 133 | + jobs=list(jobs.values()), |
87 | 134 | ) |
0 commit comments