Implementation:AI4Finance Foundation FinRobot build technical analysis
| Knowledge Sources | |
|---|---|
| Domains | Finance, Technical_Analysis, Deterministic_Compute |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Concrete tool for assembling Monte Carlo, sniper, and historical-band technical analysis into a single TechnicalAnalysis payload, provided by the FinRobot compute coordinators layer.
Description
The build_technical_analysis async function runs three best-effort branches and assembles them into a TechnicalAnalysis payload:
- Monte Carlo: Simulates price paths from DCF inputs to derive a probability distribution of the implied price.
- Sniper: Builds support/resistance from the trailing 1-year price history. Anchors a directional trade when the DCF target publishes; drops to levels-only when the target is withheld (has_anchor_target=False).
- Historical bands: Plots the current EV/EBITDA against a multi-year band (default 10y via REPORT_BAND_WINDOW_YEARS).
Each branch catches its own failure and records a warning so the payload stays partial-but-honest. Price history is FX-normalized via price_fx_to_usd to prevent currency-caliber drift (native-currency closes vs USD DCF target).
Usage
- Equity_Research workflow (Step 6): The primary technical analysis step.
- Import this when you need the technical analysis payload for an equity research report. Pass has_anchor_target = `not valuation_synthesis.valuation_withheld` to gate the sniper.
Code Reference
Source Location
- Repository: FinRobot
- File: finrobot_desktop/finrobot/engine/compute/coordinators/technical_payload.py
Signature
async def build_technical_analysis(
ticker: str,
dcf_inputs: DCFInputs,
dcf_target: float,
current_price: float,
data_layer: DataLayer,
band_years: int = REPORT_BAND_WINDOW_YEARS,
*,
has_anchor_target: bool = True,
current_ev_ebitda: float | None = None,
price_fx_to_usd: float = 1.0,
) -> TechnicalAnalysis:
"""Run MC + Sniper + Bands and assemble the payload.
All three branches are best-effort: each catches its own failure and
records a warning so the artifact stays partial-but-honest rather than
failing the whole research pipeline.
Args:
has_anchor_target: not valuation_synthesis.valuation_withheld — when
False the sniper drops to levels-only (a LONG/SHORT keyed to a
withheld target is self-contradictory).
current_ev_ebitda: canonical TTM EV/EBITDA for the band's current point.
None → band falls back to trailing-annual EBITDA.
price_fx_to_usd: quote→USD spot factor for the raw price history.
1.0 (default) for USD-quoted issuers.
"""
Import
from finrobot.engine.compute.coordinators.technical_payload import build_technical_analysis
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| ticker | str | Yes | Target company symbol |
| dcf_inputs | DCFInputs | Yes DCF inputs for Monte Carlo simulation | |
| dcf_target | float | Yes | DCF implied price (target for sniper anchoring) |
| current_price | float | Yes | Current market price |
| data_layer | DataLayer | Yes | For fetching price history |
| band_years | int | No | Historical band window (default REPORT_BAND_WINDOW_YEARS) |
| has_anchor_target | bool | No | Gate sniper directional trade (default True) |
| current_ev_ebitda | float | No | TTM EV/EBITDA for band current point |
| price_fx_to_usd | float | No | FX factor for price history normalization (default 1.0) |
Outputs
| Name | Type | Description |
|---|---|---|
| TechnicalAnalysis | TechnicalAnalysis | monte_carlo, sniper, historical_bands, warnings |
Usage Examples
Build Technical Analysis
from finrobot.engine.compute.coordinators.technical_payload import build_technical_analysis
tech = await build_technical_analysis(
ticker="AAPL",
dcf_inputs=dcf_inputs,
dcf_target=dcf_result.implied_price,
current_price=financial_data.market.current_price,
data_layer=deps.data_layer,
has_anchor_target=not valuation_synthesis.valuation_withheld,
current_ev_ebitda=peer_comps.target.ev_ebitda,
)
print(f"Monte Carlo median: {tech.monte_carlo.median_price:.2f}")
print(f"Sniper: {tech.sniper}")
print(f"Warnings: {tech.warnings}")