Commit Graph

328 Commits

Author SHA1 Message Date
Yijia-Xiao
008ac655a9 fix(cli): send GLM traffic to the platform its key belongs to
- the provider table named the China endpoint while the key mapping and client registry named Z.AI
2026-09-17 07:31:44 +00:00
Yijia-Xiao
2ddfe4ceb5 fix(agents): give every prompt honest inputs
- the fundamentals brief reached the model as a Python tuple
- analysts no longer emit a trade call that nothing reads
- a report that was not produced says so instead of appearing as a blank section
2026-09-17 07:31:44 +00:00
Yijia-Xiao
85d9137437 feat(graph): measure an outcome over a configurable window
- holding_period_days sets it; the price request covers the calendar span those trading days occupy
- reflection states the window it judges, so a short one does not read as a failed thesis
2026-09-17 07:31:44 +00:00
Yijia-Xiao
2ca59cc795 fix(backtest): score a decision against the direction it claimed
- a Sell that fell counted as a miss and a Sell that rose as a hit
- Hold claims no direction, so it reports mean alpha and no hit rate
- the report names the window the outcomes were measured over
2026-09-17 07:31:44 +00:00
Yijia-Xiao
63989515c9 fix(cli): show what the run actually produced (#649, #784)
- a non-blank message is text, whatever it would mean as a Python literal
- the live layout renders on the alternate screen, so a tall layout does not scroll
- a run with no readable rating says so instead of looking like a normal result
- the state log keeps non-ASCII readable (#1081)
2026-09-17 05:00:08 +00:00
Yijia-Xiao
486dec1710 fix(agents): state the output shape in the decision prompts
- the field list lived only in the schema, which a provider without structured output never sees
- the trader maps the five-tier recommendation onto its three actions
2026-09-17 05:00:08 +00:00
Yijia-Xiao
8d30fee06b fix(agents): record the decision that was made, or flag it for review
- the labelled rating decides, whatever dash separates it, and a scale the model echoed is not one
- prose naming several ratings is reviewed rather than read as the first word in the text
- an unreadable decision is tagged REVIEW everywhere instead of a tradeable Hold
- unrated decisions are counted apart from the backtest figures
2026-09-17 05:00:08 +00:00
Yijia-Xiao
3244a568ed docs: document fundamentals as filed 2026-09-17 02:37:15 +00:00
Yijia-Xiao
b6dad747e9 fix(dataflows): state the vintage rule on yfinance statements
- periods are cut at the fiscal period end and the vendor reports no filing date, so the newest period may not have been published yet
2026-09-17 02:37:15 +00:00
Yijia-Xiao
f881c4a111 feat(dataflows): serve US statements as filed, from SEC EDGAR
- statements are limited to facts filed by the run's date, at the values filed then
- quarterly figures are picked by span, so a year to date total is not read as a quarter
- a fourth quarter is reported unavailable rather than derived
- opt in with sec_edgar in the fundamental_data chain; a non-filer falls through
2026-09-17 02:37:15 +00:00
Yijia-Xiao
8ac4371387 fix(llm): suppress object-form tool_choice for Ollama (#1062)
- Ollama takes the local-compatible client, like the generic endpoint
2026-09-17 01:10:48 +00:00
Yijia-Xiao
60dcf64723 fix(graph): keep a failed reflection from stopping the next run (#645)
- settling a past decision is per entry; a provider error leaves it pending
- an explicitly configured benchmark ticker is normalized like any other symbol (#1075)
2026-09-17 01:10:48 +00:00
Yijia-Xiao
8d64416436 fix(dataflows): trim global news to the window before the limit (#1356)
- out-of-window articles no longer spend the article budget or cut the remaining searches short
2026-09-17 01:10:48 +00:00
Yijia-Xiao
c4152d6946 docs: note the backtest command and remembered selections 2026-09-16 21:45:08 +00:00
Yijia-Xiao
375af054b7 feat(cli): offer the previous run's selections as defaults (#1236, #920)
- analysts, depth, provider, models and language prefill; prompts still shown
- values no longer offered by the current catalog are dropped
- environment variables keep skipping their step
2026-09-16 21:45:08 +00:00
Yijia-Xiao
d8eceb6571 feat(cli): add a backtest command (#1234)
- analysis stays the bare invocation; backtest runs a ticker and date grid
- selections name the models as the config does
- the pending note prints only when a cell is pending
2026-09-16 21:45:08 +00:00
Yijia-Xiao
63738c8f2c docs: drop the analyze subcommand from the CLI examples 2026-09-16 20:19:49 +00:00
Yijia-Xiao
7bf2117491 docs: document the portfolio input and decision evaluation 2026-09-16 20:19:49 +00:00
Yijia-Xiao
8721b92f65 feat: evaluate decisions over a grid of tickers and dates (#1234)
- run_backtest runs the pipeline per cell into its own decision log and resumes by skipping logged cells
- summarize scores settled cells by rating on realized alpha
- settle_pending settles a ticker whose last decision would otherwise stay open
2026-09-16 20:19:49 +00:00
Yijia-Xiao
9794a90734 fix(memory): keep a settled decision from being logged twice
- the duplicate guard matched only pending entries, so re-running a settled ticker and date appended a second one
2026-09-16 20:19:49 +00:00
Yijia-Xiao
6436d1ff30 feat(graph): accept the caller's portfolio as run input (#1304, #1166)
- PortfolioContext input, rendered once into state and read by the trader, risk and portfolio agents
- --portfolio JSON file on the CLI
- a run without it is never treated as a flat book
- the checkpoint signature keys on the portfolio
2026-09-16 20:19:49 +00:00
Yijia-Xiao
dffff22951 fix(dataflows): use configured defaults for omitted Alpha Vantage global-news options (#1326) 2026-09-15 01:33:48 +00:00
Yijia-Xiao
ef52d4452b docs: add uv install and Docker rebuild notes (#1173, #1297)
- uv alternative to conda and pip
- rebuild the Docker image after updating
2026-09-15 01:33:48 +00:00
Yijia-Xiao
2942655f70 fix(dataflows): map Shanghai .SH tickers to Yahoo's .SS (#1260)
- normalize_symbol maps 600519.SH to 600519.SS
- the alpha benchmark is resolved from the normalized symbol
2026-09-15 00:04:25 +00:00
Yijia-Xiao
fadc698e20 fix(dataflows): bound insider filings and prediction markets by the trade date
- insider transactions are filtered to filings on or before the run date
- prediction-market odds are withheld from a historical run
2026-09-15 00:00:26 +00:00
Yijia-Xiao
29e331a9af fix(dataflows): keep one OHLCV cache file per symbol (#1330)
- the cache file is keyed by symbol and serves only on the day it was written
2026-09-14 23:51:48 +00:00
Yijia-Xiao
99313bfdbc fix(dataflows): zero-pad HK ticker codes to Yahoo's 4-digit form (#1342)
- normalize_symbol maps 09992.HK to 9992.HK and 700.HK to 0700.HK (#957)
2026-09-14 23:37:48 +00:00
Yijia-Xiao
d04693a208 fix(agents): bound tool dates by the run's trade date
- dated tools read trade_date from graph state and clamp later or missing dates #1331
- propagate() rejects non-canonical and future trade dates #1319
2026-09-14 23:24:31 +00:00
Yijia-Xiao
4a9f196e92 fix(cli): read and write the decision log on the CLI path
- shared create_run_state and record_decision for propagate() and the CLI #1332 #1347
2026-09-14 23:12:17 +00:00
Yijia-Xiao
2c1ba388d6 chore: remove two unused scripts
- test.py
- scripts/smoke_structured_output.py
2026-09-14 23:12:17 +00:00
Yijia-Xiao
b9666f6e09 docs: use a current date in the usage examples 2026-09-14 22:38:19 +00:00
Yijia-Xiao
34899bd320 fix(cli): save prompted API keys to an owner-only .env
- the key prompt created .env with the default umask, typically readable by
  other local users
- create it 0600 and tighten an existing file before writing the key; a
  read-only file is still updated
2026-09-14 22:38:19 +00:00
Yijia-Xiao
b20c8e60a4 fix(dataflows): keep vendor API keys out of request errors
- FRED and Alpha Vantage authenticate with a query parameter, and requests
  quotes the full URL in HTTP, connection and timeout errors, so the key was
  written into any log or traceback that recorded one
- route both vendors through one request helper that re-raises a requests error
  as the same class with the key removed, carrying no request, response or
  exception chain, each of which still held the URL #1324
2026-09-14 22:38:19 +00:00
Yijia-Xiao
241638da68 fix(dataflows): search all subreddits in one Reddit request
- anonymous RSS allows about one request per minute per IP, so fetching each
  subreddit separately hit a 429 and a 60s back-off on nearly every run
- search the subreddits as one combined feed at Reddit's full page size and
  group posts by the subreddit each entry names; each subreddit keeps its own
  limit, and a full page is not taken as evidence of absence
- drop the unused JSON search path, still blocked with a 403, and the
  per-subreddit pacing; arguments after subreddits are keyword-only
- the sentiment prompt no longer asks for vote and comment counts, which the
  RSS feed does not carry
2026-09-14 22:07:42 +00:00
Yijia-Xiao
2e38b47dca fix(dataflows): report windows a feed cannot observe as unavailable
- Yahoo news and the Reddit and StockTwits feeds serve only recent items, so a
  historical window trimmed to nothing was reported as "no news" or "no
  posts", and the sentiment analyst scored that silence as a neutral signal
- judge each empty window in one shared rule: it is a real absence only when
  the feed's coverage reaches the window's first day and the window ends by
  today; otherwise report it unavailable with where coverage starts
- coverage comes from the returned timestamps, which are newest-first on these
  feeds, plus Reddit's one-week search lookback; merged global-news searches
  prove no continuity and are bounded by the present alone
- state in the sentiment analyst that historical sentiment inputs are not
  guaranteed to be point-in-time
2026-09-14 22:07:41 +00:00
Yijia-Xiao
673abb3c68 feat(llm): add GPT-6 Astra, Gemini 3.8 Flash and the current Claude models
- OpenAI: gpt-6-astra
- Google: gemini-3.8-flash and gemini-3.5-flash-lite
- Anthropic: claude-opus-5 and claude-fable-5-1
- models taken out of the picker stay valid through LEGACY_MODELS, so configs
  that name them run without an unknown-model warning
2026-09-14 18:09:33 +00:00
Yijia-Xiao
9b4c741d33 fix(llm): forward reasoning effort to GPT-6 and gate minimal thinking
- reasoning_effort was forwarded only to IDs matching gpt-5 or the o-series, so
  GPT-6 models silently dropped the configured effort; match GPT-5 and later,
  with a version boundary so unrelated IDs do not match
- Gemini Pro, 3.8+ and the -latest aliases reject thinking_level "minimal"
  with a 400; send it only to numbered Flash models before 3.8 and map it to
  "low" elsewhere, since aliases move between generations
2026-09-14 18:09:33 +00:00
Yijia-Xiao
62d3479217 fix(agents): stop conflict alone from defaulting the verdict to Hold
- both manager prompts and both rating fields listed "materially conflicting"
  as a Hold condition, and every bull/bear and risk debate is conflicting, so
  a modest directional edge collapsed to Hold
- state one rule at all four sites: conflict alone is not a reason to Hold,
  commit to the stronger side sized by how decisively it wins, and Hold only
  when the evidence is still balanced after weighing or too thin for a call
- a modest bull edge now resolves to Overweight; a genuinely balanced debate
  still resolves to Hold #1321
2026-09-14 18:09:33 +00:00
Tauric-Research
be952b8ecc Merge pull request #1310 from TauricResearch/v0.4.2
Point-in-time fixes, honest failure reporting, and housekeeping
2026-09-07 17:30:55 -05:00
Yijia-Xiao
821848bb82 docs: tighten the comments on the point-in-time guards
- keep what the code cannot state itself: which session a closeless bar is,
  where the drop actually happens, and why the trim must stay unguarded
- drop the field-by-field enumeration, the account of what the previous
  behaviour got wrong, and the restatements of adjacent calls
2026-09-07 22:21:20 +00:00
Yijia-Xiao
d6ca23aee5 feat(llm): add the current Kimi models to the picker
- list kimi-k3 (flagship, 1M context) and kimi-k2.6 (256K, thinking modes) on
  both tiers, replacing the custom-only entry
- keep Custom model ID for models newer than the list
- omit the k2.7-code variants: coding specialists, not analysis models
2026-09-07 21:52:29 +00:00
Yijia-Xiao
ef383df8f4 fix(dataflows): don't report a symbol as unavailable over an unsettled bar
- a newest bar with no close made load_ohlcv reject the whole frame, so the
  routing layer answered with its no-data sentinel: the caller lost the entire
  price history and was told the symbol may be invalid, delisted or not
  covered, when only the latest session had not settled
- treat a closeless newest bar as an unsettled session instead. The gap fill
  already drops it, here and mid-series alike, so the frame ends at the last
  settled bar; only a range with no close anywhere is still no data
- the staleness check keeps deciding whether what remains is recent enough, so
  falling back cannot resurrect a long-dead series
- log which bars had no close and which date is being used as the latest close
2026-09-07 21:42:25 +00:00
Yijia-Xiao
d58b838081 test: keep the Ollama endpoint assertions off the terminal colour
- the console highlights numbers and URLs, so with colour enabled the rendered
  output splits asserted substrings with escape codes and two tests fail
- strip the codes before asserting so the result no longer depends on where the
  suite runs
2026-09-07 21:28:52 +00:00
Yijia-Xiao
ffd5d9a180 chore(dataflows): use the module logger and drop dead helpers
- four modules wrote to stdout with print() while ten others use a module
  logger; a warning printed into the rendered CLI output is effectively
  invisible, which is how the trim failure above went unnoticed
- convert the remaining calls to logger.warning with lazy formatting
- remove save_output, SavePathType, decorate_all_methods and get_next_weekday
  from utils, none of which had a caller, along with the pandas and typing
  imports that only they needed
2026-09-07 21:28:52 +00:00
Yijia-Xiao
16f7fd613c fix(dataflows): fail closed when the Alpha Vantage date trim fails
- get_stock requests the full daily series up to today, so trimming to the
  requested window is the only thing keeping bars after end_date out of a
  historical run
- the trim caught every exception, warned, and returned the untrimmed body, so
  a parse failure fed future prices into a backtest with no usable signal that
  it had happened
- let a parse failure propagate instead: the routing layer already logs the
  vendor failure, falls through to the next vendor, and surfaces the real error
  if none can serve
2026-09-07 21:28:52 +00:00
Yijia-Xiao
260c899c72 chore: drop the lint exclude for a directory not in the repo
- ruff's extend-exclude listed a path that is not part of the repository, so
  the entry never matched anything in CI
- keep the generated results/ exclude, which is a real runtime output directory
2026-09-07 20:54:19 +00:00
Yijia-Xiao
94113c8d11 test: stop the sentiment-analyst tests hitting the live network
- create_sentiment_analyst pre-fetches news, StockTwits and Reddit before
  prompting, and TestSentimentAnalystAgent invoked it unstubbed, so every run
  made live requests and a real 429 stalled the suite for minutes
- stub the three sources as the sibling prompt tests already do; the file drops
  from ~84s to under a second, and the suite no longer depends on Reddit or
  Yahoo being reachable
2026-09-07 20:54:19 +00:00
Yijia-Xiao
7cc478ad07 fix(dataflows): report a failed Reddit fetch as unavailable, not silence
- a failed fetch and an empty search both returned [], so a 429 rendered as
  'no posts found' and the sentiment analyst read throttling as real silence;
  when every subreddit was throttled the summary asserted it outright
- a failed fetch now returns None and renders as unavailable, and the summary
  only claims silence for subreddits actually searched
- raise the headerless-429 back-off to 60s, which is where a retry starts
  succeeding; pay it at most once per run so three throttled subreddits do not
  stall the analysis, and match the Retry-After cap to it #1295
2026-09-07 20:54:19 +00:00
Yijia-Xiao
1c44dd1ffc fix(agents): require absolute price levels from the Trader
- asking the Trader for concrete entry/stop levels invited a percentage
  (stop_loss: '15%'), which is not a price and failed the whole structured
  parse, dropping the run to a free-text retry
- state the requirement in the prompt and in both field descriptions
- a percentage now nulls that field instead of failing the proposal; it is
  never salvaged, since 15% must not become a 15 stop. Human-formatted
  prices with a currency symbol or thousands separator parse #1288
2026-09-07 20:54:19 +00:00
Yijia-Xiao
96111aa368 fix(dataflows): withhold the live profile from historical fundamentals
- both fundamentals vendors accepted curr_date and ignored it, serving a
  present-day company profile into a run dated in the past: yfinance via
  Ticker.info, Alpha Vantage via OVERVIEW
- that profile has no historical vintage, not even name/sector/industry (which
  move when a company renames or is reclassified), so a past curr_date now
  withholds it and says why; live runs are unchanged
- the rule lives once in date_window next to the existing look-ahead helpers,
  so switching data_vendors between the two cannot reintroduce the leak, and
  the guard runs before the request rather than discarding a paid-for response
- point-in-time fundamentals for a past date already come from the balance
  sheet, income statement and cash flow tools, which filter on curr_date #1300
2026-09-07 20:54:19 +00:00