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/quantlib/credit.py | .py | """Credit-risk primitives: Altman Z-Score, Merton/KMV, and spread analytics.
Executable form of the credit models that used to live as markdown code blocks
in ``src/skills/credit-analysis/SKILL.md``. Differences from those originals are
deliberate and each is called out in the relevant docstring; the two that bite
har... | 676 | 24,899 |
Vibe-Trading | agent/src/quantlib/impact.py | .py | """Market-impact and slippage models for backtest execution.
Four models, ordered by how much of the order book they claim to know:
========================= ================================== =====================
Model Impact Use when
========================= =======... | 282 | 11,511 |
Vibe-Trading | agent/src/quantlib/crossvalidation.py | .py | """Purged and embargoed cross-validation for overlapping financial labels.
Plain K-fold assumes observations are independent. Financial labels are not: a
label formed at time ``t`` from the next 20 days of returns overlaps the labels
of the following 19 observations. Split such a sample naively and the training
set co... | 474 | 18,489 |
Vibe-Trading | agent/src/quantlib/timeseries.py | .py | """Time-series and statistical tests for quantitative research.
Promoted verbatim-in-behaviour from the ``quant-statistics`` skill, where these
eleven routines existed only as markdown the LLM retyped on every run. One
implementation, pinned by tests, is now importable::
from src.quantlib.timeseries import adf_te... | 782 | 33,246 |
Vibe-Trading | agent/src/quantlib/__init__.py | .py | """Tested financial-mathematics primitives.
Formulas here were previously carried as markdown inside skills, where the LLM
retyped them into throwaway Python on every run. That delivery model is not
reproducible (different code each run), not reviewable (no tests, no version)
and not auditable (no artifact). Everythin... | 38 | 2,128 |
Vibe-Trading | agent/src/quantlib/fundmath.py | .py | """Private-markets fund mathematics on irregular cash flows.
This module is the analytics half of the asset spine: :mod:`src.entities.cashflow`
carries dated, signed, single-currency movements, and everything here turns such
a series into the numbers an LP or a fund controller actually reports.
Three things are delib... | 2,332 | 92,896 |
Vibe-Trading | agent/src/quantlib/multipletesting.py | .py | """Multiple-testing control: how much of a backtest's edge is search luck?
Run 462 factors over one history, keep the best Sharpe, and you have not
measured an edge -- you have measured the maximum of 462 draws. Under a null
where every factor is worthless, that maximum is comfortably positive, and it
grows with how m... | 569 | 21,923 |
Vibe-Trading | agent/src/quantlib/attribution.py | .py | """Brinson-Fachler performance attribution with residual-free multi-period linking.
Single-period decomposition splits the active return (portfolio minus benchmark)
into three sector-level effects::
Allocation_i = (w_p,i - w_b,i) * (r_b,i - R_b)
Selection_i = w_b,i * (r_p,i - r_b,i)
Interacti... | 413 | 17,226 |
Vibe-Trading | agent/src/quantlib/risk.py | .py | """Risk measures: VaR/CVaR, drawdown, Monte Carlo simulation and EVT tail fitting.
SIGN CONVENTION -- read this before using anything here
------------------------------------------------------
**A loss is a positive number.** Every risk *magnitude* this module returns is
non-negative and grows as the risk gets worse:... | 512 | 22,164 |
Vibe-Trading | agent/src/quantlib/eventstudy.py | .py | """Event study: abnormal returns around a dated corporate or macro event.
The question this answers is "did the market react to the event, beyond what it
would have done anyway", and the whole method is the *beyond* clause. A raw
return around an earnings date is not evidence of anything: the index moved too.
So a nor... | 499 | 20,142 |
Vibe-Trading | agent/src/quantlib/performance.py | .py | """Portfolio return when the client, not the manager, moves the money.
``backtest/metrics.py`` computes every figure from an equity curve and a single
scalar ``initial_cash``. That is the right model for a backtest, where the only
capital event is the opening deposit. It cannot express a real client account,
where mon... | 941 | 37,391 |
Vibe-Trading | agent/src/quantlib/valuation/threestatement.py | .py | """Linked three-statement projection: P&L, cash flow and balance sheet, one model.
A three-statement model is only as good as its linkage. It is trivial to build
three spreadsheets that each look plausible in isolation and disagree the moment
you check whether assets equal liabilities plus equity -- that disagreement ... | 728 | 31,253 |
Vibe-Trading | agent/src/quantlib/valuation/contracts.py | .py | """Shared input discipline for every valuation model in this package.
The modules here -- DCF, comps, three-statement -- deliberately own their own
result types and share almost nothing. What they DO share is the one rule that
decides whether a valuation is a measurement or a story:
**A missing input makes the mo... | 161 | 5,691 |
Vibe-Trading | agent/src/quantlib/valuation/artifact.py | .py | """Versioned model artifacts for DCF / comps / three-statement, plus export.
:mod:`dcf`, :mod:`comps` and :mod:`threestatement` each answer "what is this
worth" for one run. None of them answer three questions every real valuation
practice needs answered on top of that: *which* inputs produced this number,
*can I tell... | 1,616 | 67,462 |
Vibe-Trading | agent/src/quantlib/valuation/__init__.py | .py | """Valuation models: DCF, comparable companies, three-statement projection.
The audit that motivated this package found no executable DCF, WACC, terminal
value or comps engine anywhere in the repository -- only markdown describing
them. These modules are the executable form.
Import submodules directly, so a missing o... | 25 | 1,135 |
Vibe-Trading | agent/src/quantlib/valuation/comps.py | .py | """Comparable-companies (comps) valuation: EV bridge, calendarisation, multiples.
A comps valuation answers "what is this company worth, given what the market
pays for similar companies" -- by building a multiple (EV/EBITDA, P/E, ...) for
each peer and applying the peer set's distribution to the target's own
financial... | 1,178 | 49,122 |
Vibe-Trading | agent/src/quantlib/valuation/dcf.py | .py | """Discounted cash flow valuation: WACC, the FCFF bridge, dual terminal value,
discounting, and the bridge from enterprise value to value per share.
This module is the executable form of the DCF walkthrough that used to live as
markdown in valuation write-ups -- a WACC formula, an FCFF formula, a Gordon
growth termina... | 1,346 | 56,982 |
Vibe-Trading | agent/src/scheduled_research/playbooks.py | .py | """Ready-to-run research playbooks for the scheduled-research scheduler.
A playbook is a markdown file with a YAML frontmatter header, living in the
``playbooks/`` data directory beside this module. The frontmatter is the
catalogue record (name, description, suggested cadence, the data capabilities
a run needs); the b... | 419 | 17,126 |
Vibe-Trading | agent/src/scheduled_research/models.py | .py | """Data model for scheduled research jobs.
A ``ScheduledResearchJob`` records everything needed to describe a deferred
research or backtest run: the prompt/query, when to run it, and an opaque
``config`` dict for future backtest parameters. Execution wiring is deferred
to a follow-up PR once the product shape is confi... | 328 | 13,256 |
Vibe-Trading | agent/src/scheduled_research/store.py | .py | """Crash-safe store for scheduled research jobs.
Uses the same atomic write pattern as ``src.live.runtime.jobstore`` (write a
temp file in the same directory, fsync, replace, fsync the parent dir) so the
store survives a SIGKILL at any point without corruption.
A missing store file is the only clean empty result. A f... | 273 | 9,800 |
Vibe-Trading | agent/src/scheduled_research/__init__.py | .py | """Scheduled research job data model and durable store.
This package provides the data model (``ScheduledResearchJob``) and
crash-safe persistence (``ScheduledResearchJobStore``) for scheduled
research / backtest jobs. It intentionally does NOT wire execution --
recording and exposing jobs is the only responsibility h... | 17 | 564 |
Vibe-Trading | agent/src/scheduled_research/executor.py | .py | """Executor for persisted scheduled research jobs.
The executor polls :class:`ScheduledResearchJobStore`, dispatches due jobs via
an injected async callable, and persists lifecycle/next-run updates after each
attempt. Schedule math is intentionally pure and clock-injected so tests can
exercise it without sleeping or r... | 452 | 19,073 |
Vibe-Trading | agent/src/config/accessor.py | .py | """Lazy singleton accessor for EnvConfig.
Use :func:`get_env_config` to get the cached config instance. The first call
creates an :class:`~src.config.env_schema.EnvConfig` (which reads
``os.environ``) and caches it; subsequent calls return the same object.
Call :func:`reset_env_config` after modifying ``os.environ``... | 149 | 5,170 |
Vibe-Trading | agent/src/config/__init__.py | .py | """Agent configuration helpers for MCP client integration."""
from src.config.loader import (
load_agent_config,
load_runtime_agent_config,
load_swarm_agent_config,
merge_agent_config_overrides,
sanitize_session_overrides,
)
from src.config.paths import get_config_path, get_data_dir, get_runtime_ro... | 25 | 665 |
Vibe-Trading | agent/src/config/env_schema.py | .py | """Single source of truth for all Vibe-Trading environment variable defaults.
This module defines Pydantic models for every environment variable consumed by
the Vibe-Trading agent, grouped by functional category. Each field carries the
correct type, default value, and env-var alias so that ``EnvConfig()`` with no
arg... | 593 | 24,199 |
Vibe-Trading | agent/src/config/schema.py | .py | """Structured agent config schema for MCP client integration."""
from __future__ import annotations
import json
from typing import Literal
from urllib.parse import urlsplit
from pydantic import BaseModel, ConfigDict, Field, model_validator
# Live-broker MCP server keys. These channels may place real orders, so a
# ... | 513 | 21,707 |
Vibe-Trading | agent/src/config/limits.py | .py | """Shared runtime limits for tool results.
The cap on a tool result used to live in :mod:`src.agent.loop` and was copied as
a bare literal into :mod:`src.swarm.worker`, so the two could drift. It lives
here instead: a leaf module with no imports of its own, which the agent loop,
the swarm worker and individual tools c... | 49 | 1,995 |
Vibe-Trading | agent/src/config/paths.py | .py | """Path helpers for agent-level structured config."""
from __future__ import annotations
import os
from pathlib import Path
_DEFAULT_FILENAMES = ("agent.json", "agent.yaml", "agent.yml")
_HOME_ENV_VAR = "VIBE_TRADING_HOME"
def get_runtime_root(config_path: Path | None = None) -> Path:
"""Return the runtime ro... | 113 | 3,640 |
Vibe-Trading | agent/src/config/loader.py | .py | """Structured agent config loading utilities."""
from __future__ import annotations
import json
import logging
import os
from pathlib import Path
from typing import Any, Mapping
from pydantic import ValidationError
from src.config.paths import get_config_path, get_runtime_root
from src.config.schema import AgentCon... | 346 | 12,714 |
Vibe-Trading | agent/src/config/migrate.py | .py | """One-time migration of code-relative state into the runtime root.
Before issue #904 was fixed, ``sessions/``, ``runs/``, ``.swarm/runs/`` and
``uploads/`` were resolved relative to the installed code (``site-packages``
on a pip install, the checkout on an editable install). They now live under
:func:`src.config.path... | 153 | 6,080 |
Vibe-Trading | agent/src/core/state.py | .py | """Run state persistence: creates run directories and records status."""
from __future__ import annotations
import json
import os
import uuid
from datetime import datetime
from pathlib import Path
from typing import Any, Dict
class RunStateStore:
"""Run state store: manages run directories and their lifecycle s... | 87 | 2,820 |
Vibe-Trading | agent/src/core/runner.py | .py | """Runner module for executing generated backtest code and collecting artifacts."""
from __future__ import annotations
import json
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable... | 627 | 23,207 |
Vibe-Trading | agent/src/openbb_bridge/models.py | .py | """Pydantic models for the OpenBB Workspace bridge layer.
Only the ``/agents.json`` manifest needs a model: OpenBB Workspace is a
stateless caller that supplies the full conversation history on every
``/v1/query`` request, so the bridge keeps no cross-request session bookkeeping.
"""
from __future__ import annotation... | 34 | 1,269 |
Vibe-Trading | agent/src/openbb_bridge/__init__.py | .py | """OpenBB Workspace bridge for Vibe-Trading.
This package exposes Vibe-Trading's :class:`AgentLoop` as an OpenBB Workspace
custom agent. It is a non-invasive adapter layer: it does not modify any of
Vibe-Trading's core components (AgentLoop, ToolRegistry, SessionService) and can
be enabled or removed independently of ... | 58 | 1,964 |
Vibe-Trading | agent/src/openbb_bridge/event_mapper.py | .py | """Map Vibe-Trading internal events to OpenBB Workspace SSE events.
Vibe-Trading's :class:`AgentLoop` emits fine-grained events through the session
event bus (``text_delta``, ``tool_call``, ``tool_result``, ...). OpenBB
Workspace expects a different, smaller vocabulary of Server-Sent Events built
with the ``openbb_ai`... | 144 | 5,237 |
Vibe-Trading | agent/src/openbb_bridge/context_injector.py | .py | """Inject OpenBB Workspace context into a user message.
Every ``/v1/query`` request carries the workspace state alongside the question.
Vibe-Trading's :class:`AgentLoop` has no concept of OpenBB widgets, so this
module distils the request into a compact natural-language prefix prepended to
the user's message.
Three s... | 345 | 13,262 |
Vibe-Trading | agent/src/openbb_bridge/routes.py | .py | """FastAPI routes exposing Vibe-Trading as an OpenBB Workspace custom agent.
Two endpoints make up the OpenBB Workspace custom-agent contract:
* ``GET /agents.json`` -- the agent manifest used for discovery. Static
metadata only (name, description, avatar URL, endpoint, feature flags), so it
stays unauthenticate... | 162 | 6,239 |
Vibe-Trading | agent/src/openbb_bridge/adapter.py | .py | """Core adapter bridging OpenBB Workspace ``/v1/query`` to Vibe-Trading.
The :class:`OpenBBQueryAdapter` is responsible for:
* creating one **ephemeral** Vibe-Trading session per ``/v1/query`` request and
replaying the full history the request carried into it;
* injecting workspace context (explicit context items, ... | 317 | 12,729 |
Vibe-Trading | agent/src/factors/factor_analysis_core.py | .py | """Pure IC/IR + layered backtest math shared by factor_analysis_tool and alpha_bench_tool."""
import pandas as pd
_MIN_VALID_PER_DATE = 5
def compute_ic_series(factor_df: pd.DataFrame, return_df: pd.DataFrame) -> pd.Series:
"""Compute daily Spearman rank correlation (IC) between factor values and returns.
... | 103 | 3,892 |
Vibe-Trading | agent/src/factors/cli_handlers.py | .py | """CLI handlers for ``vibe-trading alpha {list,show,bench,compare,export-manifest}``.
All logic lives here; ``agent/cli.py`` only wires this in via :func:`add_subparser`
and :func:`dispatch`. Handlers print to stdout (Rich when available, plain
``print`` fallback) and return an int exit code. Errors are reported as a
... | 1,085 | 40,832 |
Vibe-Trading | agent/src/factors/__init__.py | .py | """Alpha Zoo: 5 zoos (alpha101 / gtja191 / qlib158 / academic / fundamental) × 460 alphas.
See `docs/alpha-zoo/spec.md` for the panel format contract and operator semantics.
"""
from src.factors.base import (
Alpha,
AlphaCompute,
Market,
decay_linear,
delta,
rank,
safe_div,
scale,
... | 49 | 767 |
Vibe-Trading | agent/src/factors/bench_runner.py | .py | """Bench runner: compute IC stats for every alpha in a zoo over one universe.
Extracted from ``agent/scripts/w4a_run_benches.py`` so the same pipeline can be
called by:
- the CLI bench driver (``w4a_run_benches.py``)
- the Web UI background worker (``src/api/alpha_routes.py``)
The math is unchanged — only the carrie... | 409 | 16,012 |
Vibe-Trading | agent/src/factors/registry.py | .py | """Alpha registry: AST-scan zoo modules, validate metadata, lazy-import on compute.
Design contract (frozen — referenced by W3 zoo-porting agents):
AlphaMeta (pydantic, ``extra="forbid", frozen=True``) — see fields below
Registry.list(zoo=None, theme=None, universe=None) -> list[str]
Registry.get(alpha_id)... | 454 | 16,514 |
Vibe-Trading | agent/src/factors/_backend.py | .py | """Graceful bottleneck import with env-var override.
Bottleneck provides C-compiled moving-window operators (move_argmax,
move_argmin) that are 100-350x faster than pandas rolling().apply().
When bottleneck is unavailable or disabled via env var, the operators
fall back to the original pandas path — identical results... | 69 | 2,318 |
Vibe-Trading | agent/src/factors/compare_runner.py | .py | """Head-to-head comparison of hand-picked alphas.
Shared core behind the three ``alpha compare`` surfaces:
* ``vibe-trading alpha compare`` (CLI — ``factors/cli_handlers.py``)
* ``POST /alpha/compare`` (Web UI — ``api/alpha_routes.py``)
* the ``alpha_compare`` agent tool (``tools/alpha_compare_tool.py``)
All three r... | 210 | 7,526 |
Vibe-Trading | agent/src/factors/base.py | .py | """Alpha Zoo base operators.
Operators all act on **wide** ``pd.DataFrame`` where ``index = trading_date``
(DatetimeIndex) and ``columns = instrument_code`` (str). The factor compute
contract returns a DataFrame of the same shape — raw scores, NaN preserved
in warmup / missing data; +/- inf is forbidden (registry reje... | 356 | 13,266 |
Vibe-Trading | agent/src/factors/bench_runner_strict.py | .py | """Strict bench runner: IC + random control + train/test OOS split.
Companion to ``bench_runner.py``. The math in ``run_bench()`` is unchanged
— this module adds a stricter category gate that requires a same-universe
random-control comparison and (optionally) an out-of-sample split before
an alpha is allowed to gradua... | 630 | 25,161 |
Vibe-Trading | agent/src/factors/zoo/fundamental/asset_growth.py | .py | """Fundamental asset-growth investment factor."""
from __future__ import annotations
import pandas as pd
from src.factors.base import zscore
__alpha_meta__ = {
"id": "fund_asset_growth",
"nickname": "Asset growth - inverse investment factor",
"theme": ["growth"],
"formula_latex": r"-\mathrm{zscore}_... | 30 | 938 |
Vibe-Trading | agent/src/factors/zoo/fundamental/earnings_yield.py | .py | """Fundamental earnings-yield value factor."""
from __future__ import annotations
import pandas as pd
from src.factors.base import safe_div
from src.factors.base import zscore
__alpha_meta__ = {
"id": "fund_earnings_yield",
"nickname": "Earnings yield - net income over market cap",
"theme": ["value"],
... | 37 | 1,225 |
Vibe-Trading | agent/src/factors/zoo/fundamental/gross_profitability.py | .py | """Fundamental gross-profitability quality factor."""
from __future__ import annotations
import pandas as pd
from src.factors.base import zscore
__alpha_meta__ = {
"id": "fund_gross_profitability",
"nickname": "Gross profitability - gross profit over total assets",
"theme": ["quality"],
"formula_lat... | 29 | 945 |
Vibe-Trading | agent/src/factors/zoo/fundamental/roe.py | .py | """Fundamental ROE quality factor."""
from __future__ import annotations
import pandas as pd
from src.factors.base import zscore
__alpha_meta__ = {
"id": "fund_roe",
"nickname": "ROE - return on equity (PIT-safe fundamentals)",
"theme": ["quality"],
"formula_latex": r"\mathrm{zscore}_{x}(\mathrm{ROE... | 30 | 867 |
Vibe-Trading | agent/src/factors/zoo/qlib158/vstd10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 成交量标准差比 10日
# 简要说明: ts_std(volume, 10) / volume,10日成交量变异系数。
# 典型用途: 衡量10日成交量的波动稳定性,值低表示成交量稳定。
# ... | 30 | 1,253 |
Vibe-Trading | agent/src/factors/zoo/qlib158/corr60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 价量相关性 60日
# 简要说明: ts_corr(close, log(volume+1), 60),60日收盘价与成交量的相关系数。
# 典型用途: 衡量60日价格与成交量的同步性,正相关... | 33 | 1,359 |
Vibe-Trading | agent/src/factors/zoo/qlib158/rsqr10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: R平方 10日
# 简要说明: ts_corr(close, t, 10)^2,收盘价对时间的10日线性回归拟合度。
# 典型用途: 衡量10日价格趋势的线性强度,值高表示趋势明确。
# ==... | 34 | 1,389 |
Vibe-Trading | agent/src/factors/zoo/qlib158/qtld60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下分位数 60日
# 简要说明: quantile_0.2(close, 60) / close,60日20%分位价格与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于60日低分位的位置... | 31 | 1,320 |
Vibe-Trading | agent/src/factors/zoo/qlib158/qtlu10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上分位数 10日
# 简要说明: quantile_0.8(close, 10) / close,10日80%分位价格与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于10日高分位的位置... | 31 | 1,320 |
Vibe-Trading | agent/src/factors/zoo/qlib158/std5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 价格标准差比 5日
# 简要说明: ts_std(close, 5) / close,5日收盘价标准差与收盘价的比率(变异系数)。
# 典型用途: 衡量5日价格波动幅度相对于价格水平的比率,用... | 30 | 1,258 |
Vibe-Trading | agent/src/factors/zoo/qlib158/imin20.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 最低价位置 20日
# 简要说明: ts_argmin(low, 20) / 20,20日内最低价出现位置的归一化指标。
# 典型用途: 值接近0表示最低价出现在近期,接近1表示出现在较早期。... | 30 | 1,211 |
Vibe-Trading | agent/src/factors/zoo/qlib158/rsqr5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: R平方 5日
# 简要说明: ts_corr(close, t, 5)^2,收盘价对时间的5日线性回归拟合度。
# 典型用途: 衡量5日价格趋势的线性强度,值高表示趋势明确。
# ======... | 34 | 1,377 |
Vibe-Trading | agent/src/factors/zoo/qlib158/min5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 最小价 5日
# 简要说明: ts_min(low, 5) / close,5日最低价与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于5日最低点的位置,接近1表示接近近期低点。
# =... | 31 | 1,253 |
Vibe-Trading | agent/src/factors/zoo/qlib158/vstd60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 成交量标准差比 60日
# 简要说明: ts_std(volume, 60) / volume,60日成交量变异系数。
# 典型用途: 衡量60日成交量的波动稳定性,值低表示成交量稳定。
# ... | 30 | 1,253 |
Vibe-Trading | agent/src/factors/zoo/qlib158/rsv10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 未成熟随机值 10日
# 简要说明: (close - ts_min(low, 10)) / (ts_max(high, 10) - ts_min(low, 10)),KDJ指标中的RSV值。... | 34 | 1,573 |
Vibe-Trading | agent/src/factors/zoo/qlib158/corr10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 价量相关性 10日
# 简要说明: ts_corr(close, log(volume+1), 10),10日收盘价与成交量的相关系数。
# 典型用途: 衡量10日价格与成交量的同步性,正相关... | 33 | 1,359 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cord60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 收益率-量变化相关性 60日
# 简要说明: ts_corr(close/close_prev, log(v/v_prev), 60),60日收益率与成交量变化率的相关系数。
# 典型用途: ... | 35 | 1,598 |
Vibe-Trading | agent/src/factors/zoo/qlib158/kmid.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 涨跌幅
# 简要说明: (close - open) / open,即当日收盘相对于开盘的简单收益率。
# 典型用途: 日内动量因子,正值为多头占优,负值为空头占优。
# ==========... | 31 | 1,221 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntp60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上涨天数计数 60日
# 简要说明: rolling_mean(1[close>close_prev], 60),60日内上涨天数占比。
# 典型用途: 衡量60日内上涨频率,值高表示持续上涨... | 30 | 1,291 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sumd10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 涨跌差 10日
# 简要说明: SUMP_10 - SUMN_10,10日内上涨强度与下跌强度的差值。
# 典型用途: 判断10日内的整体涨跌倾向,正值表示上涨动量占优。
# ========... | 37 | 1,462 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntp5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上涨天数计数 5日
# 简要说明: rolling_mean(1[close>close_prev], 5),5日内上涨天数占比。
# 典型用途: 衡量5日内上涨频率,值高表示持续上涨行情。
... | 30 | 1,278 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cord10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 收益率-量变化相关性 10日
# 简要说明: ts_corr(close/close_prev, log(v/v_prev), 10),10日收益率与成交量变化率的相关系数。
# 典型用途: ... | 35 | 1,598 |
Vibe-Trading | agent/src/factors/zoo/qlib158/klow.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下影线比率
# 简要说明: (min(open,close) - low) / open,衡量下影线长度相对于开盘价的比率。
# 典型用途: 反映日内买方支撑力度,下影线较长意味着低位有买盘承... | 33 | 1,361 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntn5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下跌天数计数 5日
# 简要说明: rolling_mean(1[close<close_prev], 5),5日内下跌天数占比。
# 典型用途: 衡量5日内下跌频率,值高表示持续下跌行情。
... | 30 | 1,278 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntn60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下跌天数计数 60日
# 简要说明: rolling_mean(1[close<close_prev], 60),60日内下跌天数占比。
# 典型用途: 衡量60日内下跌频率,值高表示持续下跌... | 30 | 1,291 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntp10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上涨天数计数 10日
# 简要说明: rolling_mean(1[close>close_prev], 10),10日内上涨天数占比。
# 典型用途: 衡量10日内上涨频率,值高表示持续上涨... | 30 | 1,291 |
Vibe-Trading | agent/src/factors/zoo/qlib158/qtld30.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下分位数 30日
# 简要说明: quantile_0.2(close, 30) / close,30日20%分位价格与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于30日低分位的位置... | 31 | 1,320 |
Vibe-Trading | agent/src/factors/zoo/qlib158/ma5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 移动均线比 5日
# 简要说明: ts_mean(close, 5) / close,5日简单移动平均与收盘价的比率。
# 典型用途: 价格相对于均线的位置,大于1表示价格在均线上方,用于趋势... | 30 | 1,245 |
Vibe-Trading | agent/src/factors/zoo/qlib158/vsumd5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 成交量涨跌差 5日
# 简要说明: VSUMP_5 - VSUMN_5,5日内成交量加权的上涨与下跌强度差。
# 典型用途: 结合成交量判断5日内的趋势可信度,量价配合时信号更强。
# ===... | 37 | 1,493 |
Vibe-Trading | agent/src/factors/zoo/qlib158/corr20.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 价量相关性 20日
# 简要说明: ts_corr(close, log(volume+1), 20),20日收盘价与成交量的相关系数。
# 典型用途: 衡量20日价格与成交量的同步性,正相关... | 33 | 1,359 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sumd30.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 涨跌差 30日
# 简要说明: SUMP_30 - SUMN_30,30日内上涨强度与下跌强度的差值。
# 典型用途: 判断30日内的整体涨跌倾向,正值表示上涨动量占优。
# ========... | 37 | 1,462 |
Vibe-Trading | agent/src/factors/zoo/qlib158/max30.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 最大价 30日
# 简要说明: ts_max(high, 30) / close,30日最高价与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于30日最高点的位置,接近1表示接近近期高点... | 31 | 1,268 |
Vibe-Trading | agent/src/factors/zoo/qlib158/max5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 最大价 5日
# 简要说明: ts_max(high, 5) / close,5日最高价与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于5日最高点的位置,接近1表示接近近期高点。
# ... | 31 | 1,256 |
Vibe-Trading | agent/src/factors/zoo/qlib158/imin5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 最低价位置 5日
# 简要说明: ts_argmin(low, 5) / 5,5日内最低价出现位置的归一化指标。
# 典型用途: 值接近0表示最低价出现在近期,接近1表示出现在较早期。
# =... | 30 | 1,196 |
Vibe-Trading | agent/src/factors/zoo/qlib158/kup2.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上影线相对比率
# 简要说明: (high - max(open,close)) / (high - low),衡量上影线在整根K线中的占比。
# 典型用途: 用于识别冲高回落形态,上影线占比... | 34 | 1,439 |
Vibe-Trading | agent/src/factors/zoo/qlib158/wvma20.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 成交量加权波动 20日
# 简要说明: ts_std(ret*v, 20) / ts_mean(|ret|*v, 20),成交量加权的价格波动归一化指标。
# 典型用途: 衡量成交量调整后的价... | 34 | 1,528 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sumn60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下跌强度 60日
# 简要说明: sum(max(-delta_close, 0)) / sum(|delta_close|),60日内负收益占比。
# 典型用途: 衡量60日下跌日的比例强度... | 35 | 1,450 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntn10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下跌天数计数 10日
# 简要说明: rolling_mean(1[close<close_prev], 10),10日内下跌天数占比。
# 典型用途: 衡量10日内下跌频率,值高表示持续下跌... | 30 | 1,291 |
Vibe-Trading | agent/src/factors/zoo/qlib158/ma10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 移动均线比 10日
# 简要说明: ts_mean(close, 10) / close,10日简单移动平均与收盘价的比率。
# 典型用途: 价格相对于均线的位置,大于1表示价格在均线上方,用... | 30 | 1,256 |
Vibe-Trading | agent/src/factors/zoo/qlib158/beta10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: Beta系数 10日
# 简要说明: ts_cov(close, ts_mean(close, 10), 10) / ts_var(close, 10),个股相对于自身的10日Beta。
# ... | 30 | 1,308 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sumd60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 涨跌差 60日
# 简要说明: SUMP_60 - SUMN_60,60日内上涨强度与下跌强度的差值。
# 典型用途: 判断60日内的整体涨跌倾向,正值表示上涨动量占优。
# ========... | 37 | 1,462 |
Vibe-Trading | agent/src/factors/zoo/qlib158/resi10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 残差 10日
# 简要说明: (close - ts_mean(close, 10)) / close,价格相对10日均线的偏离度。
# 典型用途: 衡量价格偏离均线的程度,用于均值回复策略。... | 30 | 1,272 |
Vibe-Trading | agent/src/factors/zoo/qlib158/imxd10.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 极值跨度 10日
# 简要说明: (ts_argmax(high, 10) - ts_argmin(low, 10)) / 10,最高与最低出现位置的时间差。
# 典型用途: 衡量10日内从最... | 31 | 1,387 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sump5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上涨强度 5日
# 简要说明: sum(max(delta_close, 0)) / sum(|delta_close|),5日内正收益占比。
# 典型用途: 衡量5日上涨日的比例强度,值接近... | 35 | 1,432 |
Vibe-Trading | agent/src/factors/zoo/qlib158/roc5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 变动率 5日
# 简要说明: close_t / close_{t-5} - 1,5日收益率。
# 典型用途: 经典的5日动量因子,正值为上涨趋势,负值为下跌趋势。
# ===========... | 30 | 1,167 |
Vibe-Trading | agent/src/factors/zoo/qlib158/min20.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 最小价 20日
# 简要说明: ts_min(low, 20) / close,20日最低价与当前收盘价的比率。
# 典型用途: 衡量当前价格相对于20日最低点的位置,接近1表示接近近期低点。... | 31 | 1,265 |
Vibe-Trading | agent/src/factors/zoo/qlib158/cntd30.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 涨跌天数差 30日
# 简要说明: CNTP_30 - CNTN_30,30日内上涨天数与下跌天数之差。
# 典型用途: 综合衡量30日内的涨跌方向,正值表示多头天数占优。
# =======... | 33 | 1,321 |
Vibe-Trading | agent/src/factors/zoo/qlib158/kmid2.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: K线中部相对位置
# 简要说明: (close - open) / (high - low),收盘价在当日振幅中的相对位置。
# 典型用途: 衡量收盘强度,值接近1表示收盘接近最高点,多方主导... | 33 | 1,348 |
Vibe-Trading | agent/src/factors/zoo/qlib158/roc60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 变动率 60日
# 简要说明: close_t / close_{t-60} - 1,60日收益率。
# 典型用途: 经典的60日动量因子,正值为上涨趋势,负值为下跌趋势。
# =======... | 30 | 1,179 |
Vibe-Trading | agent/src/factors/zoo/qlib158/beta5.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: Beta系数 5日
# 简要说明: ts_cov(close, ts_mean(close, 5), 5) / ts_var(close, 5),个股相对于自身的5日Beta。
# 典型用途:... | 30 | 1,291 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sump60.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 上涨强度 60日
# 简要说明: sum(max(delta_close, 0)) / sum(|delta_close|),60日内正收益占比。
# 典型用途: 衡量60日上涨日的比例强度,... | 35 | 1,444 |
Vibe-Trading | agent/src/factors/zoo/qlib158/sumn30.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 下跌强度 30日
# 简要说明: sum(max(-delta_close, 0)) / sum(|delta_close|),30日内负收益占比。
# 典型用途: 衡量30日下跌日的比例强度... | 35 | 1,450 |
Vibe-Trading | agent/src/factors/zoo/qlib158/rank20.py | .py | # Adapted from microsoft/qlib@d5379c520f66a39953bad76234a7019a72796fd0:qlib/contrib/data/handler.py
# (Apache-2.0). Copyright (c) Microsoft Corporation.
# ============================================================
# 中文名称: 时间序列排名 20日
# 简要说明: ts_rank(close, 20),当前收盘价在20日窗口内的百分位排名。
# 典型用途: 衡量当前价格在过去20日中的相对位置,高排名表示处于近期高位... | 30 | 1,206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.