跳到正文
cccskills
免费在 GitHub 公开

minute-analysis

Retrieve minute-level price data for stocks and cryptocurrencies, calculate average prices and volume patterns, and test intraday trading strategies. Configure the candle interval and trading costs to examine results using historical market data.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Minute-level data analysis and backtesting. Retrieves minute candlesticks through OKX/Tushare/yfinance and can be used both for analysis and as input to the backtest engine.

集成工具Yahoo Finance
查看安装方法

适用场景

  • Analyzing cryptocurrency price movements with minute candles
  • Calculating volume-weighted and time-weighted average prices
  • Comparing trading volume by hour
  • Backtesting intraday strategies with five-minute candles

包含的文件(2)

  • SKILL.md3.4 KB
  • example_signal_engine.py4.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Minute-Level Data Analysis and Backtesting

Purpose

Retrieve minute-level candlestick data through data-source APIs and calculate intraday indicators (VWAP, TWAP, volume distribution, and more). Supports minute-level backtesting: set "interval": "5m" in config.json and use the backtest tool to run intraday strategies.

Backtest Configuration

For minute-level backtests, simply add the interval field in config.json:

{
  "source": "okx",
  "codes": ["BTC-USDT"],
  "start_date": "2026-03-01",
  "end_date": "2026-03-15",
  "interval": "5m",
  "initial_cash": 1000000,
  "commission": 0.0005
}
  • The annualization factor is inferred automatically from source + interval (OKX 5m = 365 x 288 = 105120)
  • Minute-level datasets are large. Recommended time limits: no more than 7 days for 1m, no more than 30 days for 5m, and no more than 1 year for 1H

Supported Data Sources and Intervals

Data SourceSupported IntervalsNotes
OKX1m/5m/15m/30m/1H/4HCryptocurrency, trades 7x24
Tushare1m/5m/15m/30m/1HChina A-shares, requires score >= 2000
yfinance1m/5m/15m/30m/1HHong Kong / US equities (free, no key required)

OKX Minute Candlestick API

import requests
import pandas as pd

resp = requests.get("https://www.okx.com/api/v5/market/candles", params={
    "instId": "BTC-USDT",
    "bar": "1m",       # 1m/5m/15m/30m/1H/4H
    "limit": "300",    # At most 300 rows per request
})
data = resp.json()["data"]
columns = ["ts", "open", "high", "low", "close", "vol", "volCcy", "volCcyQuote", "confirm"]
df = pd.DataFrame(reversed(data), columns=columns)
df["ts"] = pd.to_datetime(df["ts"].astype("int64"), unit="ms")
for col in ["open", "high", "low", "close", "vol"]:
    df[col] = df[col].astype(float)

Indicator Calculation Templates

VWAP (Volume-Weighted Average Price)

typical_price = (df["high"] + df["low"] + df["close"]) / 3
df["vwap"] = (typical_price * df["vol"]).cumsum() / df["vol"].cumsum()

TWAP (Time-Weighted Average Price)

df["twap"] = df["close"].expanding().mean()

Volume Distribution

df["vol_pct"] = df["vol"] / df["vol"].sum() * 100
hourly_vol = df.set_index("ts").resample("1h")["vol"].sum()

Parameters

ParameterDescription
inst_idTrading pair, such as "BTC-USDT"
bar / intervalCandlestick interval: 1m/5m/15m/30m/1H/4H
limitNumber of records to retrieve (OKX returns at most 300 per request)

Common Pitfalls

  • OKX returns at most 300 rows per request. The loader paginates automatically, but 1m datasets are still very large
  • The time range for minute-level backtests should not be too long, otherwise both data retrieval and backtesting will become slow or time out
  • Tushare minute endpoints require a score >= 2000. If the score is insufficient, the API returns empty data
  • Timestamps are Unix timestamps in milliseconds and should be converted with unit="ms"
  • Transaction costs for minute strategies should be set lower (for example 0.05% instead of 0.1%) because intraday trading is frequent

Dependencies

pip install pandas numpy requests

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Compare a Chinese company's US depositary receipts, Hong Kong shares, and mainland shares after adjusting for exchange rates and share ratios. Analyze pricing gaps, valuation differences, and delisting risks to support research into its different listings.

中文简介正在准备中。当前显示英语简介。

  • Compare A-share and H-share pricing gaps
  • Measure ADR premiums against Hong Kong shares
  • Review US delisting risks and Hong Kong listing alternatives
HKUDS/Vibe-Trading3.6万2026年10月22日 更新

akshare

免费

Retrieve stock prices, futures quotes, exchange rates, and economic indicators with the free Python library AKShare. The skill explains market-specific functions, symbol formats, and data preparation for analysis and testing strategies against historical data.

中文简介正在准备中。当前显示英语简介。

  • Retrieve historical prices for Chinese, US, and Hong Kong stocks
  • Collect Chinese GDP and consumer price data
  • Check futures quotes and foreign exchange rates
HKUDS/Vibe-Trading3.6万2026年10月22日 更新

alpha-zoo

免费

Explore bundled libraries of investment factors, signals used to compare securities, and inspect individual formulas and metadata. Evaluate a factor or an entire library across a chosen universe and period, producing aggregate performance statistics and an HTML report.

中文简介正在准备中。当前显示英语简介。

  • Find bundled momentum or reversal factors
  • Inspect a named factor's formula and metadata
  • Compare a factor library across a chosen universe and period
HKUDS/Vibe-Trading3.6万2026年10月22日 更新

Assess whether a Chinese A-share company may receive ST or *ST risk warnings next financial year. Review financial forecasts, dividends, audit opinions, and regulatory penalties, then report risk severity separately from confidence in the prediction.

中文简介正在准备中。当前显示英语简介。

  • Reviewing a Chinese A-share company's future ST risk
  • Assessing escalation risk for an existing ST or *ST stock
  • Checking revenue, equity, and dividend warning signs
HKUDS/Vibe-Trading3.6万2026年10月22日 更新

Plan portfolio allocations across assets using risk, correlations, return forecasts, and trading costs. Compare five optimization methods, produce settings for config.json, and define rebalancing rules that adjust holdings back toward their target weights.

中文简介正在准备中。当前显示英语简介。

  • Comparing allocations across stocks, bonds, and gold
  • Choosing an optimizer based on return forecasts and correlations
  • Preparing portfolio settings for config.json
HKUDS/Vibe-Trading3.6万2026年10月22日 更新

Diagnose failed or abnormal backtests, which test trading strategies on historical data. Inspect result files, strategy code, and configuration to identify bugs, make targeted repairs, rerun tests, and verify the updated metrics.

中文简介正在准备中。当前显示英语简介。

  • Investigating backtest execution errors
  • Finding why a strategy produces no trades
  • Checking delayed trades or low capital usage
HKUDS/Vibe-Trading3.6万2026年10月22日 更新

查看 HKUDS 的全部技能

报告此技能的问题