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/src/tools/market_data_tool.py | .py | """Local market data tool backed by the shared loader layer."""
from __future__ import annotations
from typing import Any
from src.agent.tools import BaseTool
from src.market_data import DEFAULT_MAX_ROWS, fetch_market_data_json
class MarketDataTool(BaseTool):
"""Fetch normalized OHLCV data through repository l... | 107 | 4,187 |
Vibe-Trading | agent/src/tools/remember_tool.py | .py | """Remember tool: LLM-initiated persistent memory operations (save / recall / forget / reinforce)."""
from __future__ import annotations
import json
from typing import Any
from src.agent.tools import BaseTool
from src.memory.lifecycle import MemoryLifecycle
from src.memory.persistent import PersistentMemory
class ... | 178 | 6,516 |
Vibe-Trading | agent/src/tools/research_papers_tool.py | .py | """Read-only academic-paper tool that ends in a factor-implementation brief.
Two free, no-key scholarly endpoints back this tool:
* **arXiv classic API** (``https://export.arxiv.org/api/query``) returns an Atom
feed of preprints. It is the live source for ``q-fin.*`` plus the ``cs.LG`` /
``stat.ML`` work that nev... | 1,663 | 70,500 |
Vibe-Trading | agent/src/tools/taiwan_stock_data_tool.py | .py | """Read-only Taiwan stock data tool backed by a published SQLite snapshot."""
from __future__ import annotations
import json
import math
import re
import sqlite3
from contextlib import closing
from datetime import date
from itertools import zip_longest
from pathlib import Path
from typing import Any
from src.agent.t... | 1,203 | 36,167 |
Vibe-Trading | agent/src/tools/write_file_tool.py | .py | """Write file tool: create or overwrite files in the workspace."""
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_... | 107 | 3,552 |
Vibe-Trading | agent/src/tools/factor_analysis_tool.py | .py | """Factor analysis tool: compute IC/IR, layered backtest, and output analysis report."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import pandas as pd
from src.agent.tools import BaseTool
from src.factors.factor_analysis_core import compute_ic_series, compute_gro... | 152 | 5,376 |
Vibe-Trading | agent/src/tools/report_audit_tool.py | .py | """Agent tool: research-report data audit (extract → verify → verdict).
A ``BaseTool`` wrapper around the report-audit routines that guard published
research against hallucinated numbers. Auto-discovered and registered via
``BaseTool.__subclasses__()``.
Two-phase quality gate:
1. ``extract`` — parse a markdown repor... | 503 | 19,664 |
Vibe-Trading | agent/src/tools/swarm_tool.py | .py | """SwarmTool: tool for the main agent to invoke a swarm multi-agent team.
The user provides a natural-language prompt; the tool auto-selects the best preset and extracts variables.
Blocks synchronously until the run completes and returns a JSON summary.
"""
from __future__ import annotations
import json
import loggi... | 913 | 28,783 |
Vibe-Trading | agent/src/tools/ocr/__init__.py | .py | """OCR engine package."""
from src.tools.ocr.engine import OcrEngine, get_ocr_engine, get_ocr_install_hint
__all__ = ["OcrEngine", "get_ocr_engine", "get_ocr_install_hint"]
| 6 | 175 |
Vibe-Trading | agent/src/tools/ocr/engine.py | .py | """Pluggable OCR engine interface and factory.
Allows users to swap between local OCR (RapidOCR) and cloud vision models
(any OpenAI-compatible provider) via environment variable VIBE_TRADING_OCR_ENGINE.
Third-party OCR engines can be installed as pip packages and are automatically
discovered via entry_points (group:... | 212 | 7,456 |
Vibe-Trading | agent/src/tools/ocr/rapid_ocr.py | .py | """RapidOCR engine — local, ONNX Runtime based, no API key needed."""
from __future__ import annotations
import numpy as np
class RapidOcrEngine:
"""Local OCR engine using RapidOCR (PaddleOCR-derived, ONNX Runtime)."""
name = "rapid"
is_cloud = False
install_hint = "pip install rapidocr_onnxruntime... | 43 | 1,335 |
Vibe-Trading | agent/src/tools/ocr/llm_vision_ocr.py | .py | """Built-in LLM vision OCR engine — works with any OpenAI-compatible provider
that has a vision-capable model.
Provider config (base_url, api_key) is resolved via the existing
``provider_env_names()`` function in ``src/providers/capabilities.py``,
which already covers 18+ providers. No separate provider mapping is nee... | 299 | 11,605 |
Vibe-Trading | agent/src/trading/types.py | .py | """Shared trading connector data types."""
from __future__ import annotations
from dataclasses import asdict, dataclass, field
from typing import Any, Literal
Environment = Literal["paper", "live"]
Transport = Literal["local_tws", "remote_mcp", "broker_sdk"]
READ_CAPABILITIES = (
"account.read",
"positions.... | 52 | 1,517 |
Vibe-Trading | agent/src/trading/__init__.py | .py | """Trading connector profiles and operations."""
from src.trading.profiles import (
list_profiles,
load_selected_profile_id,
profile_by_id,
save_selected_profile_id,
)
from src.trading.service import (
check_connection,
get_account,
get_history,
get_open_orders,
get_positions,
g... | 32 | 643 |
Vibe-Trading | agent/src/trading/service.py | .py | """Connector-first trading operations used by CLI, MCP, and agent tools."""
from __future__ import annotations
import math
from typing import Any
from src.trading.profiles import list_profiles, profile_by_id
from src.trading.types import TradingProfile
RUNNER_CAPABILITY = "runner.manage.requires_mandate"
#: Direct... | 1,077 | 39,726 |
Vibe-Trading | agent/src/trading/profiles.py | .py | """Trading connector profile registry and selected-profile storage."""
from __future__ import annotations
import json
from pathlib import Path
from src.config.paths import get_runtime_root
from src.trading.connectors.alpaca.profiles import ALPACA_PROFILES
from src.trading.connectors.binance.profiles import BINANCE_P... | 100 | 3,240 |
Vibe-Trading | agent/src/trading/tap_forward.py | .py | """Route a broker request through the TAP proxy (Tool Authorization Protocol).
Credential-isolation hook. When TAP is configured (``TAP_PROXY_URL`` +
``TAP_AGENT_KEY`` present in the environment — e.g. loaded from the project
``.env``), outbound broker calls are sent to TAP's ``/forward`` endpoint
instead of hitting t... | 234 | 10,418 |
Vibe-Trading | agent/src/trading/connectors/__init__.py | .py | """Broker-specific trading connector implementations."""
| 3 | 58 |
Vibe-Trading | agent/src/trading/connectors/okx/__init__.py | .py | """OKX trading connector.
Read-only account/market access in Layer A via the optional ``python-okx`` SDK
(``AccountAPI`` + ``TradeAPI`` + ``MarketAPI`` over REST). A ``broker_sdk``
transport. Order placement (paper and mandate-gated live) is layered on top in
later phases; no place/cancel method is exposed here.
Pape... | 16 | 860 |
Vibe-Trading | agent/src/trading/connectors/okx/classification.py | .py | """Curated read/write classification for OKX SDK operations.
The trading layer classifies each connector operation as READ or WRITE so the
live gate can keep writes behind the mandate. OKX is a direct-SDK connector (not
MCP), so the keys here are the OKX SDK method names rather than remote MCP tool
names. Anything not... | 30 | 1,131 |
Vibe-Trading | agent/src/trading/connectors/okx/sdk.py | .py | """Read-only OKX connector via the optional ``python-okx`` SDK.
Wraps ``AccountAPI`` (account/positions), ``TradeAPI`` (orders/fills) and
``MarketAPI`` (quote/candles) for the five read operations. No order-placement
method is exposed here.
Paper-vs-live is selected by the SDK ``flag`` (``"1"`` demo/paper sets the
``... | 783 | 28,035 |
Vibe-Trading | agent/src/trading/connectors/okx/profiles.py | .py | """Built-in OKX connector profiles.
Layer A ships read-only paper (demo) and live profiles. OKX demo keys live in a
separate key namespace from live keys and select the environment via the SDK
``flag`` (``"1"`` demo, ``"0"`` live), so they are distinct profiles. The
order-placing profiles (``okx-paper-trade`` / ``okx-... | 71 | 2,545 |
Vibe-Trading | agent/src/trading/connectors/futu/__init__.py | .py | """Futu (moomoo) trading connector.
Read-only account/market access in Layer A via the official ``futu-api`` Python
SDK talking to a user-owned LOCAL OpenD gateway (default ``127.0.0.1:11111``).
Like the IBKR connector, this is a local-gateway transport: OpenD runs on the
operator's machine, holds the Futu login, and ... | 53 | 1,673 |
Vibe-Trading | agent/src/trading/connectors/futu/classification.py | .py | """Curated read/write classification for Futu (futu-api) SDK operations.
The trading layer classifies each connector operation as READ or WRITE so the
live gate can keep writes behind the mandate. Futu is a direct local-SDK
connector (the SDK talks to a local OpenD gateway, not a remote MCP server), so
the keys here a... | 32 | 1,284 |
Vibe-Trading | agent/src/trading/connectors/futu/sdk.py | .py | """Read-only Futu (moomoo) connector via the official ``futu-api`` SDK.
This module wraps Futu's ``OpenSecTradeContext`` / ``OpenQuoteContext`` for the
five read operations the trading layer exposes (account / positions / orders /
quote / history). It holds no order-placement method and never calls
``unlock_trade`` — ... | 927 | 32,862 |
Vibe-Trading | agent/src/trading/connectors/futu/profiles.py | .py | """Built-in Futu (moomoo) connector profiles.
Read-only paper and live profiles sit alongside order-placing paper and live
profiles. All four reach the same local OpenD gateway; the profile chooses the
trade environment (``SIMULATE`` vs ``REAL``) and the account is resolved by its
``trd_env`` at runtime. The order-pla... | 81 | 3,377 |
Vibe-Trading | agent/src/trading/connectors/longbridge/__init__.py | .py | """Longbridge (LongPort OpenAPI) trading connector.
Read-only account/market access in Layer A via the official ``longbridge``
Python SDK (``TradeContext`` / ``QuoteContext`` over REST). A ``broker_sdk``
transport, like Tiger.
Safety note: Longbridge exposes no runtime field that distinguishes a paper
account from a ... | 14 | 656 |
Vibe-Trading | agent/src/trading/connectors/longbridge/classification.py | .py | """Curated read/write classification for Longbridge SDK operations.
Keys are the connector's own operation names (Longbridge is a direct-SDK
connector, not MCP). Order-mutating SDK calls are pinned WRITE so the live gate
never treats them as plain reads; anything unlisted and not a known read is
treated as WRITE (fail... | 30 | 991 |
Vibe-Trading | agent/src/trading/connectors/longbridge/sdk.py | .py | """Read-only Longbridge (LongPort OpenAPI) connector via the official SDK.
Wraps ``TradeContext`` / ``QuoteContext`` for the five read operations the
trading layer exposes (account / positions / orders / quote / history). No
order-placement method is exposed here.
Auth is static-key (App Key + App Secret + Access Tok... | 893 | 33,729 |
Vibe-Trading | agent/src/trading/connectors/longbridge/credentials.py | .py | """Atomic credential resolution for the Longbridge connector."""
from __future__ import annotations
import hmac
import json
from dataclasses import dataclass, field
from pathlib import Path
from typing import Literal, Mapping
from src.config.accessor import get_env_config
from src.config.paths import get_runtime_roo... | 167 | 5,314 |
Vibe-Trading | agent/src/trading/connectors/longbridge/profiles.py | .py | """Built-in Longbridge connector profiles.
Layer A ships read-only paper and live profiles. Because Longbridge exposes no
runtime paper/live discriminator, the paper profile's environment is
operator-declared (config-trust) and order placement is not exposed here.
"""
from __future__ import annotations
from src.trad... | 56 | 2,171 |
Vibe-Trading | agent/src/trading/connectors/robinhood/mcp.py | .py | """Robinhood remote MCP generic-operation mapping."""
from __future__ import annotations
from typing import Any
_REMOTE_TOOL_NAMES = {
"account": "get_portfolio",
"positions": "get_equity_positions",
"orders": "get_equity_orders",
"quote": "get_equity_quotes",
}
_RUNNER_TOOL_NAMES = {
"account":... | 50 | 1,784 |
Vibe-Trading | agent/src/trading/connectors/robinhood/__init__.py | .py | """Robinhood connector package."""
| 3 | 36 |
Vibe-Trading | agent/src/trading/connectors/robinhood/extractor.py | .py | """Robinhood order-intent extractor (SPEC.md Mandate Enforcement §4).
Maps Robinhood's ``place_equity_order`` tool kwargs to the normalized
:class:`~src.live.enforcement.OrderIntent`. Pinned against the frozen Robinhood
catalog: the only order-placing WRITE tool is ``place_equity_order``
(``cancel_equity_order`` is a ... | 166 | 6,138 |
Vibe-Trading | agent/src/trading/connectors/robinhood/classification.py | .py | """Curated read/write classification map for Robinhood Agentic Trading.
Tier 2 of the classification ladder (:mod:`src.live.classification`): an
explicit, version-controlled map keyed by the broker's remote tool name. Map
entries are authoritative and override Tier-1 ``annotations`` when they
disagree (a deceptive ``r... | 36 | 1,536 |
Vibe-Trading | agent/src/trading/connectors/robinhood/profiles.py | .py | """Built-in Robinhood connector profiles."""
from __future__ import annotations
from src.trading.types import TradingProfile
ROBINHOOD_PROFILES: tuple[TradingProfile, ...] = (
TradingProfile(
id="robinhood-live-mcp",
connector="robinhood",
label="Robinhood Live · Agentic MCP",
env... | 27 | 785 |
Vibe-Trading | agent/src/trading/connectors/alpaca/__init__.py | .py | """Alpaca trading connector.
Read-only account/market access in Layer A via the official ``alpaca-py`` SDK
(``TradingClient`` + ``StockHistoricalDataClient`` over REST). A ``broker_sdk``
transport.
Paper-vs-live separation is structural: paper and live use DIFFERENT API keys
and DIFFERENT hosts (``paper-api.alpaca.ma... | 14 | 615 |
Vibe-Trading | agent/src/trading/connectors/alpaca/classification.py | .py | """Curated read/write classification for Alpaca SDK operations.
Keys are the connector's own operation names. Order-mutating SDK calls are
pinned WRITE so the live gate never treats them as plain reads; anything
unlisted and not a known read is treated as WRITE (fail-closed) by the gate.
"""
from __future__ import an... | 26 | 844 |
Vibe-Trading | agent/src/trading/connectors/alpaca/sdk.py | .py | """Alpaca connector via the official ``alpaca-py`` SDK — with opt-in TAP routing.
Exposes the five reads (account/positions/orders via ``TradingClient``,
quote/bars via ``StockHistoricalDataClient``) plus order placement and cancel.
Credential isolation (opt-in): when TAP is configured (``TAP_PROXY_URL`` +
``TAP_AGEN... | 887 | 33,821 |
Vibe-Trading | agent/src/trading/connectors/alpaca/profiles.py | .py | """Built-in Alpaca connector profiles.
Layer A ships read-only paper and live profiles; the trade profiles add order
placement. Paper and live use different key pairs and different hosts, so they
are distinct profiles. The live-trade profile carries an
``orders.place.requires_mandate`` capability — placement on live f... | 72 | 2,656 |
Vibe-Trading | agent/src/trading/connectors/tiger/__init__.py | .py | """Tiger Brokers (TigerOpen) trading connector.
Read-only account/market access in Layer A. Order placement (paper and
mandate-gated live) is layered on top in later phases. The connector talks to
Tiger's official ``tigeropen`` Python SDK directly (RSA-signed REST), so it is a
``broker_sdk`` transport rather than a lo... | 8 | 357 |
Vibe-Trading | agent/src/trading/connectors/tiger/classification.py | .py | """Curated read/write classification for Tiger Brokers SDK operations.
The trading layer classifies each connector operation as READ or WRITE so the
live gate can keep writes behind the mandate. Tiger is a direct-SDK connector
(not MCP), so the keys here are the connector's own operation names rather than
remote MCP t... | 32 | 1,226 |
Vibe-Trading | agent/src/trading/connectors/tiger/sdk.py | .py | """Read-only Tiger Brokers (TigerOpen) connector via the official ``tigeropen`` SDK.
This module wraps Tiger's ``QuoteClient`` / ``TradeClient`` for the five read
operations the trading layer exposes (account / positions / orders / quote /
history). It holds no order-placement method — writes are introduced in a later... | 742 | 27,834 |
Vibe-Trading | agent/src/trading/connectors/tiger/profiles.py | .py | """Built-in Tiger Brokers connector profiles.
Layer A ships read-only paper and live profiles. Layer B/C adds two
order-placing profiles: a paper-execution profile (sandbox orders) and a
mandate-gated live profile. Read-only profiles stay ``readonly=True``; the
trade profiles set ``readonly=False`` and add the relevan... | 75 | 2,792 |
Vibe-Trading | agent/src/trading/connectors/shoonya/__init__.py | .py | """Shoonya (Finvasia) trading connector.
Read-only and paper/live account access via the ``NorenRestApiPy`` SDK.
A ``broker_sdk`` transport for the Indian equity and F&O markets (NSE/BSE).
Shoonya offers ZERO brokerage and free API access — the cheapest Indian broker
for algo trading. Supports NSE/BSE equities, F&O, ... | 9 | 351 |
Vibe-Trading | agent/src/trading/connectors/shoonya/classification.py | .py | """Curated read/write classification for Shoonya (Finvasia) SDK operations.
Keys are the connector's own operation names. Order-mutating SDK calls are
pinned WRITE so the live gate never treats them as plain reads; anything
unlisted and not a known read is treated as WRITE (fail-closed) by the gate.
"""
from __future... | 30 | 999 |
Vibe-Trading | agent/src/trading/connectors/shoonya/sdk.py | .py | """Read-only + order Shoonya (Finvasia) connector via ``NorenRestApiPy`` SDK.
Wraps the Shoonya/NorenApi client for account, positions, orders, quotes, and
historical data. Supports NSE/BSE equities and F&O (NIFTY/BANKNIFTY options).
Zero brokerage on ALL segments — the cheapest Indian broker for algo trading.
Authe... | 661 | 21,030 |
Vibe-Trading | agent/src/trading/connectors/shoonya/profiles.py | .py | """Built-in Shoonya (Finvasia) connector profiles.
Shoonya (https://shoonya.com) by Finvasia offers ZERO brokerage on all
segments — the cheapest Indian broker for algorithmic trading.
Supports NSE/BSE equities, F&O (NIFTY/BANKNIFTY options), currency, and
commodity. The API uses a TOTP-based login flow (vendor code ... | 71 | 2,852 |
Vibe-Trading | agent/src/trading/connectors/binance/__init__.py | .py | """Binance (spot) trading connector.
Read-only account/market access in Layer A via the ``ccxt`` library's unified
``binance`` exchange client (REST). A ``broker_sdk`` transport. Order placement
is not exposed here — writes are introduced in a later layer behind the paper
guard and, for live, the mandate gate.
Paper-... | 16 | 870 |
Vibe-Trading | agent/src/trading/connectors/binance/classification.py | .py | """Curated read/write classification for Binance (ccxt) spot operations.
Keys are the ccxt unified method names this connector uses. Order-mutating ccxt
calls are pinned WRITE so the live gate never treats them as plain reads;
anything unlisted and not a known read is treated as WRITE (fail-closed) by the
gate.
"""
f... | 25 | 787 |
Vibe-Trading | agent/src/trading/connectors/binance/sdk.py | .py | """Read-only Binance (spot) connector via the ``ccxt`` unified exchange client.
Wraps ccxt's ``binance`` exchange for the five read operations the trading layer
exposes (account / positions / orders / quote / history). No order-placement
method is exposed here — writes are introduced in a later layer behind the paper
... | 782 | 28,846 |
Vibe-Trading | agent/src/trading/connectors/binance/profiles.py | .py | """Built-in Binance (spot) connector profiles.
Read-only paper (testnet) and live profiles plus order-placing paper and live
profiles. Paper and live use different key pairs and different hosts, so they
are distinct profiles. The order-placing live profile carries an
``orders.place.requires_mandate`` capability — the ... | 71 | 2,699 |
Vibe-Trading | agent/src/trading/connectors/ibkr/__init__.py | .py | """Interactive Brokers connector package."""
from src.trading.connectors.ibkr.local import (
DEFAULT_ENDPOINTS,
IBKRLocalConfig,
check_local_status,
get_account_snapshot,
get_historical_bars,
get_open_orders,
get_positions,
get_quote,
save_config,
)
__all__ = [
"DEFAULT_ENDPOIN... | 26 | 511 |
Vibe-Trading | agent/src/trading/connectors/ibkr/classification.py | .py | """Curated IBKR MCP tool classification overrides.
IBKR's official MCP tool catalog is discovered only after OAuth, so this map is
intentionally sparse. READ tools are expected to come from MCP annotations under
the read-only ``mcp.read`` scope. State-changing names listed here are pinned
WRITE when they appear, and a... | 27 | 976 |
Vibe-Trading | agent/src/trading/connectors/ibkr/local.py | .py | """Local read-only Interactive Brokers connector via TWS / IB Gateway.
This module intentionally connects only to a user-owned local TWS or IB Gateway
session. It does not handle IBKR credentials, does not talk to cloud broker
endpoints directly, and exposes no order-placement method.
"""
from __future__ import annot... | 804 | 28,063 |
Vibe-Trading | agent/src/trading/connectors/ibkr/profiles.py | .py | """Built-in Interactive Brokers connector profiles."""
from __future__ import annotations
from src.trading.types import READ_CAPABILITIES, TradingProfile
IBKR_PROFILES: tuple[TradingProfile, ...] = (
TradingProfile(
id="ibkr-paper-local",
connector="ibkr",
label="IBKR Paper · TWS / Gatewa... | 45 | 1,608 |
Vibe-Trading | agent/src/trading/connectors/etoro/__init__.py | .py | """eToro Public API connector (demo + real read/write).
Demo and real share one API key pair; profiles select ``/demo`` vs production
API paths. Live write profiles require mandate enforcement via the live action
gate.
"""
| 7 | 224 |
Vibe-Trading | agent/src/trading/connectors/etoro/copy_trading.py | .py | """eToro copy-trading workflows."""
from __future__ import annotations
import math
import re
import time
import uuid
from typing import Any
from src.trading.connectors.etoro.client import (
COPY_TRADING_PAPER_UNSUPPORTED,
EtoroAPIError,
EtoroConfig,
copy_root,
make_client,
)
# ``COPY_TRADING_PAP... | 245 | 7,615 |
Vibe-Trading | agent/src/trading/connectors/etoro/classification.py | .py | """Curated read/write classification for eToro Public API operations.
Unlisted tool names are classified as UNKNOWN and fail closed as writes by the
live registry (see ``src.live.registry``).
"""
from __future__ import annotations
from src.live.classification import ToolClass
ETORO_TOOL_CLASS: dict[str, ToolClass] ... | 36 | 1,184 |
Vibe-Trading | agent/src/trading/connectors/etoro/trading.py | .py | """eToro trading write operations (open, close, cancel, edit)."""
from __future__ import annotations
import math
import uuid
from typing import Any
from src.trading.connectors.etoro.client import (
EtoroAPIError,
EtoroConfig,
execution_root,
execution_v1_root,
make_client,
positions_root,
)
f... | 311 | 10,844 |
Vibe-Trading | agent/src/trading/connectors/etoro/client.py | .py | """HTTP transport and path builders for the eToro Public API.
Paper-vs-live is structural: ``profile == "paper"`` routes to ``/demo`` API
paths; live profiles use production paths on the same host. eToro uses one API
key pair for both environments — the configured profile selects paths, not
different credentials.
"""
... | 378 | 12,743 |
Vibe-Trading | agent/src/trading/connectors/etoro/sdk.py | .py | """Read adapters and generic broker_sdk entry points for eToro."""
from __future__ import annotations
from datetime import datetime, timezone
from typing import Any
from src.trading.connectors.etoro.client import (
BASE_URL,
EtoroAPIError,
EtoroConfig,
EtoroConfigError,
MARKET_DATA_RATES_PATH,
... | 540 | 18,174 |
Vibe-Trading | agent/src/trading/connectors/etoro/profiles.py | .py | """Built-in eToro connector profiles.
Layer A ships read-only paper and live profiles; the trade profiles add order
placement, position management, and copy-trading workflows. Demo and real share
one API key pair — the profile selects ``/demo`` vs production API paths.
"""
from __future__ import annotations
from src... | 82 | 2,634 |
Vibe-Trading | agent/src/trading/connectors/etoro/instruments.py | .py | """Instrument search and symbol resolution for eToro.
eToro Public API conventions (see eToro builders docs):
- Exact ticker lookup: ``GET /market-data/search?internalSymbolFull=BTC``
- Fuzzy discovery: ``GET /market-data/search?search=<query>&limit=<n>``
- Asset-class browse: ``GET /market-data/instruments?instrument... | 587 | 19,812 |
Vibe-Trading | agent/src/trading/connectors/mt5/reads.py | .py | """MT5 read operations: status, account, positions, orders, quote, history.
Every read runs through :func:`_client._session` (identity guard included)
and returns a fail-closed ``{"status": "error", ...}`` envelope instead of
raising, so tools and CLI degrade cleanly when the SDK/terminal is absent.
"""
from __future... | 301 | 12,180 |
Vibe-Trading | agent/src/trading/connectors/mt5/symbols.py | .py | """Pure MT5 symbol normalization + mandate classification (no SDK import).
Broker symbol resolution (suffix discovery against a live terminal) lives in
``_client``; this module is the terminal-free half the order gate uses, so it
must stay importable and correct on any platform.
"""
from __future__ import annotations... | 77 | 3,080 |
Vibe-Trading | agent/src/trading/connectors/mt5/orders.py | .py | """MT5 order operations: sizing hook, place, cancel/close (risk-reducing).
Validation runs before any SDK touch and every failure returns a fail-closed
``{"status": "error", ...}`` payload. Connector-level size guards
(``max_order_volume`` / ``max_order_notional_usd``) apply to demo AND live —
defense-in-depth underne... | 408 | 17,165 |
Vibe-Trading | agent/src/trading/connectors/mt5/__init__.py | .py | """MetaTrader 5 connector (Exness-style MT5 brokers) — ``broker_sdk`` transport.
Talks to a locally running MT5 terminal through the official ``MetaTrader5``
Python package, which is **Windows-only** and an opt-in extra
(``pip install "vibe-trading-ai[mt5]"``). Credentials live in
``~/.vibe-trading/mt5.json``.
Paper/... | 15 | 774 |
Vibe-Trading | agent/src/trading/connectors/mt5/classification.py | .py | """Curated read/write classification for MT5 SDK operations.
Keys are the MetaTrader5 module functions the connector touches plus the
connector's own public order methods. Anything not listed and not a known
read resolves to WRITE (fail-closed) when the live gate consults this map.
"""
from __future__ import annotati... | 33 | 1,137 |
Vibe-Trading | agent/src/trading/connectors/mt5/sdk.py | .py | """MT5 connector facade — the module ``service._sdk_module("mt5")`` imports.
Re-exports the full duck-typed ``broker_sdk`` surface from the split
implementation modules (kept under the repo's file-size ceiling). Tests
monkeypatch one seam — ``_client._require_mt5`` — and the whole connector
runs against the injected f... | 66 | 1,525 |
Vibe-Trading | agent/src/trading/connectors/mt5/_client.py | .py | """MT5 config, session lifecycle, identity guard, and USD sizing helpers.
The ``MetaTrader5`` Python API is process-global and stateful: one
``initialize()`` per process, module-level functions, ``shutdown()`` to
detach. Every operation therefore runs inside :func:`_session` — a lock,
initialize, bidirectional profile... | 380 | 14,924 |
Vibe-Trading | agent/src/trading/connectors/mt5/profiles.py | .py | """Built-in MetaTrader 5 connector profiles.
"Paper" is the broker's DEMO MT5 account (e.g. an Exness demo) — MT5 has no
separate sandbox API. Unlike key-scoped connectors the discriminator is hard:
every session re-reads ``account_info().trade_mode`` from the terminal and
rejects a paper profile attached to a real-mo... | 79 | 3,061 |
Vibe-Trading | agent/src/trading/connectors/dhan/__init__.py | .py | """Dhan trading connector.
Read-only and paper/live account access via the official ``dhanhq`` SDK.
A ``broker_sdk`` transport for the Indian equity and F&O markets (NSE/BSE).
Dhan provides free API access with a trading account. Paper trading uses the
Dhan sandbox environment; live uses production endpoints.
"""
| 9 | 317 |
Vibe-Trading | agent/src/trading/connectors/dhan/classification.py | .py | """Curated read/write classification for Dhan SDK operations.
Keys are the connector's own operation names. Order-mutating SDK calls are
pinned WRITE so the live gate never treats them as plain reads; anything
unlisted and not a known read is treated as WRITE (fail-closed) by the gate.
"""
from __future__ import anno... | 33 | 1,086 |
Vibe-Trading | agent/src/trading/connectors/dhan/sdk.py | .py | """Read-only + order Dhan connector via the official ``dhanhq`` SDK.
Wraps ``DhanHQ`` client for account, positions, orders, quotes, and historical
data. Supports NSE/BSE equities and F&O (NIFTY/BANKNIFTY options).
Paper-vs-live: Dhan has no sandbox environment. Paper mode uses the same API
for market data reads but ... | 617 | 19,778 |
Vibe-Trading | agent/src/trading/connectors/dhan/profiles.py | .py | """Built-in Dhan connector profiles.
Dhan (https://dhan.co) is an Indian discount broker with free API access.
Supports NSE/BSE equities, F&O (NIFTY/BANKNIFTY options), currency, and
commodity segments.
Paper-only by design: Dhan exposes no sandbox and no runtime paper/live
discriminator — a single Access Token reads... | 68 | 2,615 |
Vibe-Trading | agent/src/trading/connectors/trading212/__init__.py | .py | """Trading 212 broker connector.
Read-only account, portfolio, order, order-history, and instrument-metadata
access through Trading 212's public REST API. The public API does not expose a
runtime paper/live discriminator that this connector can verify, so order
placement and cancellation are intentionally disabled.
""... | 8 | 322 |
Vibe-Trading | agent/src/trading/connectors/trading212/classification.py | .py | """Curated read/write classification for Trading 212 REST operations.
Keys are the connector's public operation names and the Trading 212 REST
operation names they wrap. Mutating order operations are pinned WRITE even
though this read-only connector refuses them at runtime, so the live gate never
treats a future Tradi... | 41 | 1,526 |
Vibe-Trading | agent/src/trading/connectors/trading212/sdk.py | .py | """Read-only Trading 212 connector via the public REST API.
Wraps Trading 212's account cash/info, portfolio, open-order, order-history,
and metadata endpoints. Market quotes and OHLCV bars are not exposed by the
public API, so the generic quote/history entry points return a clear unsupported
payload instead of fabric... | 587 | 20,921 |
Vibe-Trading | agent/src/trading/connectors/trading212/profiles.py | .py | """Built-in Trading 212 connector profiles.
Trading 212's public REST API is registered here as read-only only. The API key
selects whatever account Trading 212 has bound to it; this connector has no
runtime paper/live discriminator it can independently verify, so order
placement is not exposed by any built-in profile... | 53 | 1,845 |
Vibe-Trading | agent/src/strategy_store/decay.py | .py | """Decay state machine — pure logic for evaluating factor/strategy health."""
from __future__ import annotations
from dataclasses import dataclass
from src.strategy_store.models import (
ArtifactStatus,
DecaySignal,
)
@dataclass(frozen=True)
class DecayThresholds:
"""Configurable thresholds for decay e... | 274 | 8,996 |
Vibe-Trading | agent/src/strategy_store/models.py | .py | """Data models for strategy development artifacts and decay monitoring."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import Enum
class ArtifactType(str, Enum):
"""Type of research artifact."""
FACTOR = "factor"
STRATEGY = "strategy"
class ArtifactStatus(str... | 257 | 8,516 |
Vibe-Trading | agent/src/strategy_store/store.py | .py | """Strategy and factor artifact store — Protocol + in-memory reference implementation.
The ``StrategyStoreProtocol`` defines the abstract interface for persisting
strategy/factor artifacts, bench results, and decay snapshots. Concrete
backends (SQLite, DuckDB, JSON, …) will be decided by the community via
GitHub Issu... | 332 | 10,870 |
Vibe-Trading | agent/src/strategy_store/__init__.py | .py | """Strategy Development Manager — artifact store and decay monitoring."""
from src.strategy_store.models import (
Artifact,
ArtifactStatus,
ArtifactType,
BenchCategory,
BenchResult,
DecaySignal,
DecaySnapshot,
)
__all__ = [
"Artifact",
"ArtifactStatus",
"ArtifactType",
"Ben... | 22 | 396 |
Vibe-Trading | agent/src/strategy_store/_shared.py | .py | """Shared store singleton for SDM tools.
All SDM tools (sdm_register, sdm_status, sdm_decay_scan) import
``get_store()`` from this module to share a single ``SqliteStrategyStore``
instance. The SQLite backend provides WAL-mode persistence with FK
constraints and schema migrations via ``PRAGMA user_version``.
"""
fro... | 22 | 660 |
Vibe-Trading | agent/src/strategy_store/metrics.py | .py | """Shared decay metrics computation for bench history.
Both ``sdm_decay_scan`` and ``sdm_status`` tools call this to compute
baseline/rolling IC and Sharpe metrics from a chronologically ordered
bench-history list.
"""
from __future__ import annotations
from typing import Any
_DECAY_INPUT_KEYS = ("ic_ratio", "rolli... | 90 | 3,166 |
Vibe-Trading | agent/src/strategy_store/sqlite_store.py | .py | """SQLite-backed strategy/factor artifact store.
Satisfies ``StrategyStoreProtocol``. Uses WAL mode for concurrent reads,
FK constraints for referential integrity, and ``PRAGMA user_version``
for schema migrations.
"""
from __future__ import annotations
import json
import sqlite3
import threading
import uuid
from c... | 702 | 27,937 |
Vibe-Trading | agent/src/shadow_account/codegen.py | .py | """Shadow Account — code generation (rules → signal_engine.py + config.json).
Inputs are always a ``ShadowProfile`` (contract-stable). Outputs are:
* ``signal_engine.py`` source, validated with ``ast.parse`` + a shape
check on ``class SignalEngine.generate``.
* ``config.json`` dict, ready to drop into a ... | 229 | 7,507 |
Vibe-Trading | agent/src/shadow_account/storage.py | .py | """Shadow Account persistence under the configured runtime root.
Layout:
<runtime-root>/shadow_accounts/<shadow_id>.json ShadowProfile
<runtime-root>/shadow_runs/<shadow_id>/ backtest run dir
<runtime-root>/shadow_reports/<shadow_id>.pdf rendered report
"""
from __future__ import annotatio... | 130 | 4,059 |
Vibe-Trading | agent/src/shadow_account/reporter.py | .py | """Shadow Account — 8-section report rendering (HTML + optional PDF).
The pipeline:
ShadowProfile + ShadowBacktestResult (+ optional today signals)
→ `_build_sections` build a strict dict for the template
→ `_render_charts` matplotlib PNG files on disk
→ Jinja2 render HTML
→ ... | 354 | 12,263 |
Vibe-Trading | agent/src/shadow_account/models.py | .py | """Shadow Account data contracts (frozen dataclasses).
See `docs/shadow-account-spec.md` for the full contract. These types are the
stable boundary between extractor / codegen / backtester / reporter.
"""
from __future__ import annotations
from dataclasses import asdict, dataclass, field
from typing import Any
#: D... | 111 | 3,857 |
Vibe-Trading | agent/src/shadow_account/__init__.py | .py | """Shadow Account — extract a user's profitable pattern as a re-runnable shadow.
Public API (for tools/tests/external callers):
extract_shadow_profile: journal → ShadowProfile
ShadowProfile / ShadowRule / ShadowBacktestResult / AttributionBreakdown
storage: save_profile / load_profile / find_by_journal_has... | 54 | 1,403 |
Vibe-Trading | agent/src/shadow_account/extractor.py | .py | """Shadow Account — strategy extraction from profitable roundtrips.
Pipeline:
trades_df → FIFO pair → filter (pnl > 0) → feature engineer
→ KMeans cluster (k auto 2-5) → per-cluster decision tree (max_depth=3)
→ path extraction → structured entry_condition dict
→ LLM-light natural-language translation ... | 620 | 22,613 |
Vibe-Trading | agent/src/shadow_account/fonts.py | .py | """Shadow Account — font handling for PDF rendering.
Tries to guarantee that Chinese characters render; falls back to DejaVu Sans
(English-only, logs a warning) when CJK resources are unavailable. Matplotlib
and weasyprint both consume ``cjk_font_path()`` or at least see the family
name via ``apply_matplotlib_cjk_font... | 144 | 4,648 |
Vibe-Trading | agent/src/shadow_account/scanner.py | .py | """Shadow Account — today signals scanner.
Deterministic research scanner: evaluate each Shadow rule against injected
recent OHLCV bars. The scanner never fabricates matches when data is absent.
"""
from __future__ import annotations
from datetime import date, datetime
from typing import Any, Callable
import pandas... | 303 | 10,619 |
Vibe-Trading | agent/src/shadow_account/backtester.py | .py | """Shadow Account — multi-market backtest driver + delta-PnL attribution.
Responsibilities:
1. Pick representative symbols per market based on the user's preferred
markets (with a liquid-basket fallback).
2. Group the selection by settlement currency, render one run_dir per
currency pool (via ``c... | 640 | 23,899 |
Vibe-Trading | agent/src/quantlib/factormodel.py | .py | """Cross-sectional style factor model: exposures, factor returns, drift.
This is the machinery behind "what is this portfolio actually betting on" --
whether a fund's outperformance came from a persistent tilt toward small, cheap,
high-momentum names, or from something the tilts do not explain.
IT IS NOT BARRA
------... | 516 | 21,008 |
Vibe-Trading | agent/src/quantlib/options.py | .py | """Black-Scholes pricing, Greeks and implied-volatility inversion.
One implementation, called by both the backtest engine and the
``options-payoff`` skill. It merges two copies that had drifted apart: the
engine's (``backtest/engines/options_portfolio.py``, no dividend yield, no rho,
but with correct degenerate-input ... | 449 | 18,970 |
Vibe-Trading | agent/src/quantlib/fixedincome.py | .py | """Fixed-income primitives: day count, bond math and yield-curve fitting.
This module is the executable form of the formulas that used to live as markdown
code blocks in ``src/skills/credit-analysis/SKILL.md``. Two things are deliberately
different from the markdown originals:
* **Day count is explicit.** The markdow... | 795 | 27,773 |
Vibe-Trading | agent/src/quantlib/var_backtest.py | .py | """VaR model backtesting: does the model's stated confidence level hold up?
``src.quantlib.risk`` *produces* VaR numbers. This module *validates* them, which
is a separate job with a separate consumer: a risk function has to demonstrate
that a 99% VaR was breached on roughly 1% of days, and that the breaches did not
a... | 655 | 24,687 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.