repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
Vibe-Trading
agent/cli/ui/banner.py
.py
"""Large startup banner for the interactive CLI.""" from __future__ import annotations from typing import Final from rich.console import Console from rich.text import Text from cli._version import __version__ as _VERSION from cli.theme import Theme _LOGO: Final[tuple[str, ...]] = ( r"__ ___ _ ...
82
2,564
Vibe-Trading
agent/skills/ashare-mootdx/references/a_mootdx_fetcher.py
.py
""" Mootdx A-Share Data Fetcher โ€” Standard adapter. Free, no API key, no IP rate limits. Usage: from a_mootdx_fetcher import fetch_daily, fetch_realtime, batch_fetch_daily """ import logging from mootdx.quotes import Quotes import pandas as pd from typing import Optional, List logger = logging.getLogger(__name__)...
89
2,979
Vibe-Trading
agent/src/market_data.py
.py
"""Shared market data helpers for MCP and local agent tools.""" from __future__ import annotations import json import logging import math import re from collections.abc import Callable from typing import Any logger = logging.getLogger(__name__) DEFAULT_MAX_ROWS = 250 # Symbol -> preferred source. The matched sourc...
240
9,751
Vibe-Trading
agent/src/ui_services.py
.py
"""UI-oriented services for run analysis and local process management. This module centralizes the data shaping needed by the frontend workbench: - parse run metadata into frontend-friendly context - reconstruct market data for historical runs when artifacts are incomplete - compute indicator overlays and trade marke...
640
21,204
Vibe-Trading
agent/src/preflight.py
.py
"""Startup preflight checks for data sources and LLM provider. Runs connectivity checks at startup and prints a status table. Non-critical failures are warnings (degraded functionality), LLM provider failure is critical (blocks startup). """ from __future__ import annotations import os from dataclasses import datacl...
337
11,176
Vibe-Trading
agent/src/swarm/presets.py
.py
"""Swarm YAML preset loader. Reads YAML preset files from the bundled ``presets/`` directory next to this module and parses them into SwarmRun / SwarmAgentSpec / SwarmTask data models. Keeping the YAMLs inside the ``src.swarm`` package guarantees identical behavior under editable installs and built wheels. User-suppl...
354
12,991
Vibe-Trading
agent/src/swarm/task_store.py
.py
"""Swarm multi-agent system โ€” Task persistence and DAG algorithms. Each task is stored independently as tasks/task-{id}.json with full CRUD support. Provides DAG algorithms: dependency resolution, cycle detection, and topological layering. """ from __future__ import annotations import threading from collections impo...
249
7,609
Vibe-Trading
agent/src/swarm/runtime.py
.py
"""Swarm DAG orchestration runtime. Core orchestrator: schedules workers by topological layer, parallel within each layer and serial between layers. Execution runs in a background daemon thread with cancellation and event callback support. """ from __future__ import annotations import logging import threading from c...
769
30,882
Vibe-Trading
agent/src/swarm/models.py
.py
"""Swarm multi-agent system โ€” data models. All Pydantic models defined here, shared by store / task_store / worker / runtime. Enums use str+Enum to ensure JSON-serialization compatibility. """ from __future__ import annotations import re from enum import Enum from pydantic import BaseModel, Field from src.tools.re...
328
11,206
Vibe-Trading
agent/src/swarm/store.py
.py
"""Swarm multi-agent system โ€” run state persistence. File-system-based persistence for SwarmRun. Directory structure: .swarm/runs/{run_id}/ โ”œโ”€โ”€ run.json # SwarmRun state (atomic write) โ”œโ”€โ”€ events.jsonl # append-only event log โ”œโ”€โ”€ tasks/ # task state files โ”œโ”€โ”€ inboxes/ ...
566
21,566
Vibe-Trading
agent/src/swarm/__init__.py
.py
"""Swarm multi-agent system โ€” package entry point.""" from __future__ import annotations from src.swarm.models import ( RunStatus, SwarmAgentSpec, SwarmEvent, SwarmRun, SwarmTask, TaskStatus, WorkerResult, ) from src.swarm.presets import build_run_from_preset, inspect_preset, list_presets,...
35
746
Vibe-Trading
agent/src/swarm/worker.py
.py
"""Swarm Worker: standalone worker execution engine with a lightweight ReAct loop. Uses ChatLLM.chat + manual for-loop directly (without instantiating AgentLoop), keeping the worker self-contained and the agent core unchanged. """ from __future__ import annotations import json import logging import shutil import tim...
1,084
45,276
Vibe-Trading
agent/src/swarm/grounding.py
.py
"""Pre-fetch market data for symbols mentioned in a swarm's user_vars. Why this exists --------------- Swarm workers are LLMs. Without explicit grounding they cheerfully quote prices from their training data โ€” which is wrong by definition for any asset that has traded since the model's cutoff. The fix can only be stru...
291
12,254
Vibe-Trading
agent/src/swarm/serialization.py
.py
"""Shared serialization helpers for the swarm read boundaries. Single source of truth for projecting a :class:`SwarmTask` into the per-task JSON dict returned by the MCP tools (``run_swarm`` / ``get_swarm_status`` / ``get_run_result``) and the in-process ``run_swarm`` agent tool. Before this module each boundary hand...
52
2,053
Vibe-Trading
agent/src/entities/cashflow.py
.py
"""Irregular dated cash flows: the non-bar half of the asset spine. SIGN CONVENTION (stated once here, enforced in code, never left to callers) -------------------------------------------------------------------------- Every amount is expressed **from the holder's point of view**: amount > 0 cash comes IN to the...
769
30,350
Vibe-Trading
agent/src/entities/models.py
.py
"""Typed entity and instrument models for the non-bar asset spine. These models describe *what* is being analysed (a fund, a bond, an issuer), never *how it traded on a given day*. Anything with a daily OHLCV bar is already served by ``backtest/loaders`` and its engines; this module exists for holdings whose economics...
397
15,170
Vibe-Trading
agent/src/entities/ingest.py
.py
"""Read irregular dated cash-flow files into a ``CashFlowSeries``. This is the entry point a user's own file takes into the system. It is a deliberately separate path from ``backtest/loaders``: that path requires an OHLC bar and drops every column it does not recognise, which is precisely why a capital call or a coupo...
1,308
51,497
Vibe-Trading
agent/src/entities/__init__.py
.py
"""Entity and irregular cash-flow spine for holdings that have no daily bar. This package is a **parallel path** to ``backtest/``, not an extension of it. The bar path is deliberately narrow: ``backtest.runner._PRICE_PANEL_COLUMNS`` fixes the panel to OHLCV-style fields and ``backtest.loaders.local_loader._normalize_c...
58
1,558
Vibe-Trading
agent/src/security/workspace_access.py
.py
"""Security workspace access compatibility helpers for channel adapters.""" from __future__ import annotations WORKSPACE_SCOPE_METADATA_KEY = "_workspace_scope" class WorkspaceScopeError(ValueError): """Raised when a path is outside the allowed workspace scope.""" @property def message(self) -> str: ...
15
405
Vibe-Trading
agent/src/security/network.py
.py
"""Security network compatibility helpers for channel adapters. Re-exports validate_url_target / validate_resolved_url from :mod:`src.channels.utils`. """ from __future__ import annotations from src.channels.utils import validate_resolved_url, validate_url_target __all__ = ["validate_resolved_url", "validate_url_ta...
11
327
Vibe-Trading
agent/src/security/__init__.py
.py
"""Security helpers for tool output sanitization and warning metadata."""
3
75
Vibe-Trading
agent/src/security/scanner.py
.py
"""Prompt-injection warning scanner for external tool content. The scanner is intentionally conservative in action: it never rewrites or drops fetched content. It only adds warning metadata to the JSON envelopes returned by reader/search tools so downstream agents can treat external text as untrusted instructions. """...
264
9,777
Vibe-Trading
agent/src/security/workspace_policy.py
.py
"""Security workspace policy compatibility helpers for channel adapters. Re-exports :func:`is_path_within` from :mod:`src.channels.utils`. """ from __future__ import annotations from src.channels.utils import is_path_within as _is_path_within # Re-export for backward compat with ported channel code is_path_within =...
12
337
Vibe-Trading
agent/src/channelsui/websocket_logging.py
.py
"""WebSocket logging bridge for channel adapters.""" from __future__ import annotations import logging websockets_server_logger = logging.getLogger("src.channelsui.websocket")
8
179
Vibe-Trading
agent/src/channelsui/mcp_presets_api.py
.py
"""MCP preset mention normalization for the WebSocket channel.""" from __future__ import annotations from typing import Any def normalize_mcp_preset_mentions(content: Any, metadata: dict[str, Any] | None = None) -> list[str]: """Normalize MCP preset mentions into a stable list of names.""" del metadata ...
20
677
Vibe-Trading
agent/src/channelsui/transcription_ws.py
.py
"""Transcription WebSocket compatibility helpers.""" from __future__ import annotations from typing import Any async def webui_transcription_event(*args: Any, **kwargs: Any) -> tuple[str, dict[str, Any]]: """Return a structured response when transcription is not configured.""" del args, kwargs return "e...
12
379
Vibe-Trading
agent/src/channelsui/gateway_services.py
.py
"""Gateway services used by the WebSocket channel.""" from __future__ import annotations import json import secrets import time from dataclasses import dataclass, field from pathlib import Path from typing import Any from src.config.paths import get_workspace_path from src.security.workspace_access import WorkspaceS...
302
10,747
Vibe-Trading
agent/src/channelsui/cli_apps_api.py
.py
"""CLI app mention normalization for the WebSocket channel.""" from __future__ import annotations from typing import Any def normalize_cli_app_mentions(content: Any, metadata: dict[str, Any] | None = None) -> list[str]: """Normalize CLI app mentions into a stable list of names.""" del metadata if conten...
20
668
Vibe-Trading
agent/src/channelsui/http_utils.py
.py
"""HTTP helpers for the WebSocket channel.""" from __future__ import annotations import asyncio from pathlib import Path from typing import Any from urllib.parse import parse_qs, urlsplit from src.channels.utils import validate_url_target _LONG_LIVED_TIMEOUT = 300 # seconds for long-lived HTTP connections def n...
79
2,428
Vibe-Trading
agent/src/channelsui/forking.py
.py
"""WebUI fork-chat compatibility for the WebSocket channel.""" from __future__ import annotations from typing import Any _HANDLE_WEBUI_FORK_CHAT = None async def handle_webui_fork_chat(*args: Any, **kwargs: Any) -> None: """Return a structured unsupported response for fork-chat requests.""" del kwargs ...
24
656
Vibe-Trading
agent/src/governance/manifest.py
.py
"""Run manifest: a content-addressed fingerprint of "what produced this run". A :class:`RunManifest` answers "under what methodology was that number produced" without carrying the methodology's raw, possibly sensitive content: the system prompt is stored only as a hash, each injected skill is stored as ``(name, conten...
567
21,977
Vibe-Trading
agent/src/governance/__init__.py
.py
"""Governance primitives: run manifests + a tamper-evident hash-chained ledger. Two independent pieces, both standalone (no dependency on the protected ``src/agent/`` tree, no wall-clock reads): - ``manifest``: :func:`build_run_manifest` fingerprints a run's methodology composition (system prompt hash, injected-ski...
64
1,876
Vibe-Trading
agent/src/governance/ledger.py
.py
"""Hash-chained, fsynced, append-only JSONL ledger. A generic, domain-agnostic primitive for governance/compliance records: each record embeds ``seq`` (1-based position) and ``prev_record_hash`` (the previous record's own hash, or :data:`GENESIS_PREV_HASH` for the first record), then commits to both plus its own paylo...
739
28,769
Vibe-Trading
agent/src/tools/qveris_tool.py
.py
"""QVeris discovery and execution tools.""" from __future__ import annotations import json import math import os import re import tempfile import threading import time from collections.abc import Mapping from dataclasses import asdict, dataclass from pathlib import Path from typing import Any import httpx from src....
665
24,688
Vibe-Trading
agent/src/tools/northbound_tool.py
.py
"""Northbound (Stock-Connect) net-flow tool backed by Eastmoney push2his. Northbound flow is the net capital moving from Hong Kong into mainland China A-shares through the Shanghai/Shenzhen Stock-Connect channels ("ๆฒช่‚ก้€š" and "ๆทฑ่‚ก้€š"). Eastmoney publishes this as a free, no-auth time series through its ``push2his`` ``kamt...
275
9,749
Vibe-Trading
agent/src/tools/goal_tool.py
.py
"""Local agent tools for finance research goals.""" from __future__ import annotations import hashlib import json from pathlib import Path from typing import Any, Callable from src.agent.tools import BaseTool from src.goal import AuditRow, EvidenceInput, GoalStatus, GoalStore, RiskTier, StaleGoalError from src.goal....
471
19,924
Vibe-Trading
agent/src/tools/tushare_fallbacks.py
.py
"""Optional Tushare fallback adapters for China-market flow tools. The public Eastmoney endpoints are free and remain the primary source for these tools. When they are unavailable, a configured Tushare token can recover the same research workflow through a separate provider with a compatible envelope. """ from __fut...
232
8,484
Vibe-Trading
agent/src/tools/options_pricing_tool.py
.py
"""Options pricing tool: Black-Scholes theoretical price and Greeks.""" from __future__ import annotations import json import math from typing import Any from src.agent.tools import BaseTool from src.quantlib.options import bs_greeks, bs_price def _validate_inputs( spot: float, strike: float, expiry_days: floa...
172
6,737
Vibe-Trading
agent/src/tools/web_reader_tool.py
.py
"""Web reader tool: fetch a URL as Markdown text via the Jina Reader API.""" from __future__ import annotations import ipaddress import json import logging from urllib.parse import urlsplit import requests from src.agent.progress import emit_progress from src.agent.tools import BaseTool from src.security.scanner im...
152
4,976
Vibe-Trading
agent/src/tools/symbol_search_tool.py
.py
"""Read-only symbol-search tool: resolve a name/ticker to symbols + market. Backed by three frozen, IP-throttled public-API clients so the agent never hits a provider un-throttled and never re-implements transport plumbing: * :mod:`backtest.loaders.eastmoney_client` โ€” Eastmoney's free suggest endpoint matches Chine...
518
20,802
Vibe-Trading
agent/src/tools/financial_rigor_tool.py
.py
"""Agent tool: financial-rigor checks with exact decimal arithmetic. A thin ``BaseTool`` wrapper around six pure-stdlib verification routines that guard investment research against numerical error and hallucinated metrics. Auto-discovered and registered via ``BaseTool.__subclasses__()``. All arithmetic uses ``decimal...
590
23,007
Vibe-Trading
agent/src/tools/image_vision_tool.py
.py
"""Vision analysis for local images via the configured multimodal LLM. The document reader only OCRs images, which fails on charts, candlestick screenshots and photos. This tool sends the image itself to the configured chat model (providers that support multimodal input, e.g. the OpenAI Codex adapter's ``input_image``...
147
5,341
Vibe-Trading
agent/src/tools/session_search_tool.py
.py
"""Session search tool: FTS5 cross-session search for past conversations.""" from __future__ import annotations import json from typing import Any from src.agent.tools import BaseTool class SessionSearchTool(BaseTool): """Search past conversation sessions by keyword using SQLite FTS5.""" name = "session_s...
79
2,662
Vibe-Trading
agent/src/tools/sdm_register_tool.py
.py
"""BaseTool wrapper for registering factors/strategies into the strategy store.""" from __future__ import annotations import json from dataclasses import asdict from typing import Any from src.agent.tools import BaseTool from src.strategy_store.models import ( Artifact, ArtifactStatus, ArtifactType, ...
244
9,522
Vibe-Trading
agent/src/tools/quantlib_tool.py
.py
"""Reach the finance-math layer from every transport, without a shell. ``src/quantlib`` holds ~250 tested functions, and until now the only way an agent could run them was ``bash`` plus an ``import``. That gate is off by default on the API and MCP transports, and correctly so: process-control tools are an RCE surface ...
450
17,751
Vibe-Trading
agent/src/tools/mcp.py
.py
"""MCP client adapter and remote tool wrappers.""" from __future__ import annotations import asyncio import hashlib import json import logging import os import re import threading from collections.abc import Mapping from copy import deepcopy from dataclasses import dataclass, is_dataclass from typing import Any, Awai...
1,251
44,265
Vibe-Trading
agent/src/tools/research_reports_tool.py
.py
"""Read-only tool: sell-side research reports + consensus EPS for A-shares. Two free, no-auth disclosure feeds are stitched into one envelope: * **Eastmoney reportapi** publishes the rolling list of broker research reports for a mainland A-share: report title, issuing brokerage, analyst, publish date, the broker'...
401
15,167
Vibe-Trading
agent/src/tools/institutional_holdings_tool.py
.py
"""Read-only tool: SEC Form 13F-HR institutional holdings from EDGAR. Every institutional investment manager exercising discretion over more than $100M of U.S. exchange-traded equities must file Form 13F-HR within 45 days of each calendar quarter end. The holdings themselves live in a separate INFORMATION TABLE docume...
2,288
102,881
Vibe-Trading
agent/src/tools/get_fundamentals_tool.py
.py
"""Read-only fundamental panel facade backed by the loader layer.""" from __future__ import annotations import json import logging import math from typing import Any import pandas as pd from src.agent.tools import BaseTool logger = logging.getLogger(__name__) _VALID_FREQS = ("annual", "quarterly", "ttm") # Mirror...
211
7,546
Vibe-Trading
agent/src/tools/trade_journal_parsers.py
.py
"""Trade journal format adapters. Each parser normalizes one broker export format into a list of TradeRecord. Supported: Tonghuashun (ๅŒ่Šฑ้กบ), Eastmoney (ไธœๆ–น่ดขๅฏŒ), Futu (ๅฏŒ้€”), generic CSV. Encoding fallback order for CSV: utf-8 โ†’ utf-8-sig โ†’ gbk โ†’ gb2312. Excel (.xlsx/.xls) always opens as utf-8 internally via openpyxl/xlrd...
587
21,045
Vibe-Trading
agent/src/tools/alpha_zoo_tool.py
.py
"""Alpha-Zoo browse tool: list / get / health on the frozen Registry contract. A single agent-facing tool with an ``action`` discriminator (list_alphas / get_alpha / health) rather than three separate tools โ€” keeps the LLM tool catalogue compact and avoids teaching three near-identical surfaces. Source-code bodies of...
196
6,371
Vibe-Trading
agent/src/tools/redaction.py
.py
"""Shared redaction helpers (CWE-209/497, P10). Three independent concerns live here: 1. ``redact_internal_paths`` โ€” replaces internal root prefixes with a ``'<redacted>'`` sentinel, keeping the relative tail. Caller-supplied or external absolute paths stay intact for diagnosability; only our own topology is...
487
20,846
Vibe-Trading
agent/src/tools/iwencai_tool.py
.py
"""iWenCai (้—ฎ่ดข) natural-language A-share research search tool. iWenCai is a Chinese-market natural-language stock screener: a research caller phrases a question in plain language ("low-PE banks with rising net profit") and the service returns the matching A-share securities with the metric columns its parser extracted...
255
9,345
Vibe-Trading
agent/src/tools/load_skill_tool.py
.py
"""Load skill tool: load a skill document as a skeleton, a section, or pages. Skill documents *are* the implementation for a large part of this product โ€” the bond maths, the implied-vol solver, the impact models and the China market structure all live in markdown the agent reads and executes. A tool result is capped a...
307
12,541
Vibe-Trading
agent/src/tools/fred_macro_tool.py
.py
"""Read-only tool: FRED macroeconomic time series (St. Louis Fed). The Federal Reserve Bank of St. Louis publishes hundreds of thousands of economic time series โ€” CPI, unemployment, GDP, federal funds rate, Treasury yields, money supply and the like โ€” through its FRED REST API. Each series is addressed by a short uppe...
260
9,523
Vibe-Trading
agent/src/tools/cashflow_analytics_tool.py
.py
"""Agent tool for client-cash-flow-aware portfolio performance. Read-only. It reports the time-weighted, Modified Dietz, and money-weighted returns of an account whose owner moved money in and out mid-period, which the backtest metric path cannot express because it is funded by a single scalar. No order path exists he...
489
19,079
Vibe-Trading
agent/src/tools/shadow_account_tool.py
.py
"""Shadow Account BaseTool wrappers (auto-discovered by `src.tools` registry). Four tools, all thin โ€” business logic lives in `src.shadow_account`: extract_shadow_strategy โ†’ extractor.extract_shadow_profile run_shadow_backtest โ†’ backtester.run_shadow_backtest render_shadow_report โ†’ reporter.render_s...
372
14,056
Vibe-Trading
agent/src/tools/trade_journal_tool.py
.py
"""Trade Journal Analyzer tool. Parses a broker CSV/Excel export and produces: - profile: holding days, trade frequency, win rate, PnL ratio, cumulative PnL, max drawdown, top symbols, market/hourly distribution - behavior (Phase 4b): disposition effect, overtrading, chasing momentum, anchoring โ€” each with...
536
19,892
Vibe-Trading
agent/src/tools/etf_holdings_tool.py
.py
"""Read-only ETF look-through: fund search + constituent holdings, US and A-share. An ETF price series says nothing about what the fund actually owns. This tool answers that second question on both sides of the Pacific from free, no-auth sources, and โ€” because every ETF holdings disclosure is *stale by construction* โ€”...
1,846
80,276
Vibe-Trading
agent/src/tools/hypothesis_tool.py
.py
"""BaseTool wrappers for the durable hypothesis registry.""" from __future__ import annotations import json from typing import Any from src.agent.tools import BaseTool from src.hypotheses import HypothesisRegistry def _ok(payload: dict[str, Any]) -> str: return json.dumps({"status": "ok", **payload}, ensure_as...
194
7,250
Vibe-Trading
agent/src/tools/bash_tool.py
.py
"""Bash tool: execute shell commands under run_dir.""" from __future__ import annotations import json import subprocess from typing import Any from src.agent.tools import BaseTool from src.tools._shell_safety import broad_python_kill_error _OUTPUT_LIMIT = 50_000 _DEFAULT_TIMEOUT = 120 class BashTool(BaseTool): ...
84
2,742
Vibe-Trading
agent/src/tools/_shell_safety.py
.py
"""Shared safety checks for host shell commands.""" from __future__ import annotations import re _PYTHON_PROCESS = r"python(?:w|\d+(?:\.\d+)*)?(?:\.exe)?\b" _TASKKILL_PYTHON = re.compile( rf"\btaskkill(?:\.exe)?\b" rf"[^;&\r\n]*(?:/im\s+{_PYTHON_PROCESS}|get-process\s+" rf"(?:-name\s+)?{_PYTHON_PROCESS})...
60
1,975
Vibe-Trading
agent/src/tools/compact_tool.py
.py
"""Compact tool: model-initiated context compression.""" from __future__ import annotations import json from typing import Any from src.agent.tools import BaseTool class CompactTool(BaseTool): """Compress conversation history to free context space.""" name = "compact" description = "Compress conversat...
27
913
Vibe-Trading
agent/src/tools/__init__.py
.py
"""Tool registry: auto-discovery via BaseTool.__subclasses__(). Adding a new tool: 1. Create a file in src/tools/ with a class extending BaseTool 2. Done. It's automatically discovered and registered. Tools with missing dependencies can override check_available() โ†’ False to be silently excluded from the registry....
365
15,037
Vibe-Trading
agent/src/tools/shareholder_count_tool.py
.py
"""Read-only tool: A-share quarterly shareholder count via Eastmoney datacenter. Eastmoney's datacenter report API publishes the periodic "่‚กไธœๆˆทๆ•ฐ" (number of registered shareholders) disclosure for mainland A-shares: the holder count per report period, the quarter-over-quarter change, and the average holding value per a...
219
7,801
Vibe-Trading
agent/src/tools/stock_news_tool.py
.py
"""Read-only news tool: per-stock and global financial headlines. Two public, no-auth news surfaces are wrapped behind one BaseTool contract: * China A-share (and general China-market finance) headlines come from Eastmoney's free ``search-api`` news-list endpoint. Like every Eastmoney surface it rate-limits by so...
417
14,411
Vibe-Trading
agent/src/tools/alpha_bench_tool.py
.py
"""Alpha bench orchestrator: registry โ†’ universe panel โ†’ IC/IR โ†’ HTML report. W2 scaffold: implements the orchestration shape and HTML rendering. Universe loaders that need network calls return a clean "not yet implemented" envelope โ€” the full universe wiring lands in W4. The HTML path is autoescaped via Jinja2, with ...
1,035
40,135
Vibe-Trading
agent/src/tools/sdm_decay_scan_tool.py
.py
"""BaseTool wrapper for batch decay monitoring scan across active artifacts.""" from __future__ import annotations import json from typing import Any from src.agent.tools import BaseTool from src.strategy_store.decay import DecayEvaluator from src.strategy_store.metrics import compute_decay_metrics, has_decay_inputs...
211
7,649
Vibe-Trading
agent/src/tools/financial_statements_tool.py
.py
"""Read-only financial-statements tool: three statements + key indicators. Pulls a single stock's balance sheet, income statement, cash-flow statement, or key per-period indicators from a market-appropriate public source: * **A-share** (``.SH`` / ``.SZ`` / ``.BJ``) โ€” Eastmoney's A-share F10 report datasets (``RPT_F...
726
26,956
Vibe-Trading
agent/src/tools/sentiment_tool.py
.py
"""Read-only market sentiment analysis tool. Two capabilities: 1. ``sentiment_score`` โ€” score arbitrary text [-1, 1] with a lexicon-based scorer 2. ``fear_greed_index`` โ€” fetch the current crypto Fear & Greed Index All computation is pure Python; the Fear & Greed call is a single HTTP GET to the free, no-auth alterna...
147
5,864
Vibe-Trading
agent/src/tools/fund_flow_tool.py
.py
"""Read-only fund-flow (capital-flow) tool backed by the Eastmoney client. Eastmoney publishes a free, no-auth capital-flow series that splits each bar's net inflow into main / large / medium / small-order buckets (the "ไธปๅŠ›/่ถ…ๅคงๅ•/ๅคงๅ•/ไธญๅ•/ๅฐๅ•" decomposition). Two ``fflow`` endpoints serve it: a daily history line and an intr...
252
9,994
Vibe-Trading
agent/src/tools/technical_indicator_tool.py
.py
"""Read-only technical indicator tool. Computes RSI, MACD, Bollinger Bands, SMA, and EMA for a given symbol using the existing market-data pipeline. All computation is pure Python (numpy/pandas); no new dependencies. """ from __future__ import annotations import json import logging from datetime import datetime, tim...
290
10,742
Vibe-Trading
agent/src/tools/lockup_expiry_tool.py
.py
"""Lockup-expiry (้™ๅ”ฎ่งฃ็ฆ) tool backed by the Eastmoney datacenter API. Chinese A-share restricted shares come off lockup on scheduled dates; a large upcoming unlock can pressure a stock as newly tradable supply hits the market. This tool surfaces both the historical unlock schedule and the upcoming window (default 90 da...
326
11,015
Vibe-Trading
agent/src/tools/alpha_compare_tool.py
.py
"""Agent tool: head-to-head comparison of hand-picked Alpha Zoo alphas. Thin wrapper over :func:`src.factors.compare_runner.compare_alphas` โ€” the same core behind ``vibe-trading alpha compare`` (CLI) and ``POST /alpha/compare`` (Web UI). Auto-discovered and registered via ``BaseTool.__subclasses__()``. Read-only: it ...
114
4,031
Vibe-Trading
agent/src/tools/skill_writer_tool.py
.py
"""Skill management tools: full CRUD + auxiliary file support. User-created skills are stored separately from bundled skills: ~/.vibe-trading/skills/user/<skill-name>/ SKILL.md # Main skill document references/ # Reference materials templates/ # Code/config templ...
370
12,917
Vibe-Trading
agent/src/tools/background_tools.py
.py
"""Background tasks: thread execution + notification queue.""" from __future__ import annotations import json import os import signal import subprocess import threading import time import uuid from pathlib import Path from typing import Any, Dict, List, Optional from src.agent.tools import BaseTool from src.tools._s...
377
13,406
Vibe-Trading
agent/src/tools/trading_connector_tool.py
.py
"""Connector-first trading tools. Tools take an optional ``connection`` profile id. If omitted, they use the selected profile from ``~/.vibe-trading/trading-connections.json``. """ from __future__ import annotations import json import math from typing import Any from src.agent.tools import BaseTool from src.trading...
906
34,436
Vibe-Trading
agent/src/tools/market_screener_tool.py
.py
"""Read-only full-market screener backed by the Eastmoney client. Eastmoney publishes a free, no-auth full-market quote list via the push2 ``clist`` endpoint. Given a market universe selector (``fs``) it returns one row per listed instrument with the latest price plus the common ranking metrics โ€” percent change, trade...
257
9,252
Vibe-Trading
agent/src/tools/sector_tool.py
.py
"""Read-only sector / concept board tool backed by the Eastmoney client. Eastmoney publishes a free, no-auth board taxonomy that groups A-shares into industry sectors (่กŒไธšๆฟๅ—) and thematic concept boards (ๆฆ‚ๅฟตๆฟๅ—). This tool exposes two read-only views over that taxonomy: * **Membership** โ€” given a stock ``code``, list th...
320
11,239
Vibe-Trading
agent/src/tools/doc_reader_tool.py
.py
"""Universal document reader: dispatches by file extension. Supported formats: - PDF (.pdf) โ€” pypdfium2 + OCR fallback for image pages - Word (.docx) โ€” python-docx (paragraphs + table cells) - Excel (.xlsx/.xls) โ€” pandas preview, all sheets - PowerPoint (.pptx) โ€” python-pptx (slide text) - Images (.png/.jpg/...
457
15,941
Vibe-Trading
agent/src/tools/pattern_tool.py
.py
"""Chart pattern recognition tool: detect technical patterns in price series. Reads OHLCV data from run_dir/artifacts/ohlcv_*.csv. Can be called before coding (to inform strategy design) or after backtest (to analyse results). """ from __future__ import annotations import json import math from typing import Any, Dic...
411
14,746
Vibe-Trading
agent/src/tools/orderbook_depth_tool.py
.py
"""Read-only crypto L2 order-book depth tool (OKX / Binance spot, via ccxt). Built to close a documented gap: ``src/swarm/presets/statistical_arbitrage_desk.yaml`` tells its microstructure analyst "There is no order-book depth or quote feed here" because that is true for the equity data sources this project has for fr...
508
22,728
Vibe-Trading
agent/src/tools/_result_paging.py
.py
"""Fit a list of records into one tool result without dropping the tail silently. A tool result is cut at :data:`src.config.limits.TOOL_RESULT_LIMIT` characters. For a JSON envelope that cut lands mid-structure, so the model receives a broken fragment and โ€” worse โ€” reads the records that survived as if they were the w...
67
2,578
Vibe-Trading
agent/src/tools/read_file_tool.py
.py
"""Read file tool: read file contents from the workspace.""" from __future__ import annotations import json from pathlib import Path from typing import Any from src.agent.tools import BaseTool from src.tools.path_utils import safe_path as _safe_path from src.tools.path_utils import safe_run_dir as _safe_run_dir from...
133
4,481
Vibe-Trading
agent/src/tools/block_trades_tool.py
.py
"""Block-trade (ๅคงๅฎ—ไบคๆ˜“) lookup tool backed by the Eastmoney datacenter. Eastmoney publishes every A-share block trade โ€” negotiated off-book deals struck at a premium or discount to the close โ€” through its free, no-auth datacenter report API (``RPT_DATA_BLOCKTRADE``). Each record carries the deal price and volume, the di...
282
9,666
Vibe-Trading
agent/src/tools/prediction_market_tool.py
.py
"""Read-only prediction-market (event-contract) data tool. Prediction markets quote binary event contracts: each outcome is a token that settles at $1 if the event happens and $0 otherwise. The live share price is therefore the market's *implied probability* of that outcome, which makes these venues an alternative dat...
1,237
52,187
Vibe-Trading
agent/src/tools/stock_profile_tool.py
.py
"""Read-only company-profile tool: key stats, estimates, and ownership. Backed by the shared Yahoo Finance quoteSummary client (:func:`backtest.loaders.yahoo_client.get_quote_summary`), which routes every request through the throttled HTTP layer and handles the cookie+crumb handshake. This tool only selects modules, p...
322
11,531
Vibe-Trading
agent/src/tools/margin_trading_tool.py
.py
"""Read-only margin-trading (่ž่ต„่žๅˆธ) balance tool backed by Eastmoney. Eastmoney's public datacenter exposes the daily exchange-published margin-financing / securities-lending (่ž่ต„่žๅˆธ) figures for individual A-share stocks: outstanding financing balance, financing buy amount, securities-lending balance, and the combined R...
250
9,130
Vibe-Trading
agent/src/tools/sec_filings_tool.py
.py
"""Read-only tool: U.S. SEC EDGAR filing index + XBRL GAAP metric series. The U.S. SEC publishes free, no-auth JSON for every reporting company: a recent filing index (10-K / 10-Q / 8-K and friends) and the full set of XBRL financial concepts the company has reported. This tool wraps both behind the project's BaseTool...
401
15,487
Vibe-Trading
agent/src/tools/dragon_tiger_tool.py
.py
"""Dragon-Tiger (้พ™่™Žๆฆœ) board tool backed by the Eastmoney datacenter API. The Shanghai/Shenzhen exchanges publish a daily "dragon-tiger" (้พ™่™Žๆฆœ) board listing every A-share that triggered an abnormal-trading disclosure, together with the brokerage seats that drove the largest buys and sells. Eastmoney re-serves this disc...
284
10,006
Vibe-Trading
agent/src/tools/propose_mandate_tool.py
.py
"""``propose_mandate_profiles`` โ€” the read-only PROPOSE half of consent. The agent calls this tool when the user expresses a live-trading intent (or when a mandate breach needs widening options). It synthesizes 2-4 numbered candidate mandate profiles, **every one clamped to the account ceilings** so even the most aggr...
246
11,089
Vibe-Trading
agent/src/tools/path_utils.py
.py
"""Path safety helpers used by file-access tools. Three helpers, three threat models: * `safe_path(p, workdir)` โ€” tool-controlled sandbox. Resolves `p` under `workdir` and rejects any escape. Used by `read_file` / `write_file` / `edit_file` where the LLM must stay inside the current run dir. * `safe_user_path(p)...
404
12,669
Vibe-Trading
agent/src/tools/edit_file_tool.py
.py
"""Edit file tool: find-and-replace in workspace files.""" from __future__ import annotations import json from typing import Any from src.agent.tools import BaseTool from src.tools.path_utils import allowed_write_roots from src.tools.path_utils import resolve_safe_path from src.tools.redaction import redact_internal...
98
3,123
Vibe-Trading
agent/src/tools/portfolio_risk_tool.py
.py
"""Agent tool: portfolio risk x-ray (Portfolio Studio slice). Wraps ``backtest.risk_xray.compute_risk_xray`` with data fetching through the standard loader fallback chain (``src.market_data.fetch_market_data``), so the agent can ask "how risky is this basket" without caring which source serves the prices. The computat...
195
7,991
Vibe-Trading
agent/src/tools/sdm_status_tool.py
.py
"""BaseTool wrapper for querying and updating strategy store artifact status.""" from __future__ import annotations import json from dataclasses import asdict from src.strategy_store.models import is_four_eyes_violation from typing import Any from src.agent.tools import BaseTool from src.strategy_store.decay import...
271
9,745
Vibe-Trading
agent/src/tools/web_search_tool.py
.py
"""Web search tool: free multi-engine search via ddgs (no API key). `ddgs` (the successor to `duckduckgo_search`) is a metasearch aggregator: it can query DuckDuckGo, Google, Bing, Brave, Mojeek, Yahoo and more behind one API, none of which need an API key. DuckDuckGo alone rate-limits aggressively from cloud / share...
349
15,057
Vibe-Trading
agent/src/tools/autopilot_tool.py
.py
"""Research Autopilot: goal-hypothesis bridge + backtest config generation. Phase 1: Connects the Hypothesis Registry to the Research Goal runtime. Phase 2: Auto-generates backtest config.json from hypothesis metadata. Phase 3: Scaffolds a contract-correct signal_engine.py stub and links backtest run-card metrics ...
667
24,685
Vibe-Trading
agent/src/tools/options_payoff_tool.py
.py
"""Agent tool for deterministic multi-leg option payoff analysis.""" from __future__ import annotations import json import math from typing import Any import numpy as np from backtest.options_payoff import OptionLeg, expiry_payoff, scenario_grid from src.agent.tools import BaseTool _MAX_LEGS = 20 _MIN_SPOT_POINTS ...
358
14,272
Vibe-Trading
agent/src/tools/backtest_tool.py
.py
"""Backtest execution tool: validates config.json + signal_engine.py and runs the built-in engine.""" from __future__ import annotations import json from pathlib import Path from backtest.loaders.registry import VALID_SOURCES from src.agent.progress import emit_progress from src.agent.tools import BaseTool from src....
95
3,359
Vibe-Trading
agent/src/tools/options_chain_tool.py
.py
"""Read-only options-chain tool backed by the shared Yahoo Finance client. Surfaces the calls/puts ladder for a US-listed underlying (strike, bid/ask, last price, volume, open interest, implied volatility, and the in/out-of-money flag) for a single expiration. All HTTP routes through :func:`backtest.loaders.yahoo_clie...
156
5,421