indicator-expert by marketcalls/openalgo-indicator-skills
npx skills add https://github.com/marketcalls/openalgo-indicator-skills --skill indicator-expertclient.history()、client.quotes()、client.depth())、yfinance(美国/全球市场)client.connect()、subscribe_ltp、subscribe_quote、subscribe_depth)template="plotly_dark"广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
dash-bootstrap-components 或 Streamlit 配合 st.plotly_chart()@njit(cache=True, nogil=True) + NumPypython-dotenv + find_dotenv() 从单个根目录 .env 文件加载 — 切勿硬编码密钥ta.exrem() 进行清理。在使用 exrem 之前,始终先 .fillna(False)。template="plotly_dark",K线图使用 xaxis type="category"。@njit(cache=True, nogil=True) — 切勿使用 fastmath=True(会破坏 NaN 处理)。client.connect()、client.subscribe_ltp() / subscribe_quote() / subscribe_depth() 获取实时数据。find_dotenv() 从项目根目录加载 .env 文件 — 切勿硬编码 API 密钥。| 市场 | 数据源 | 方法 | 示例代码 |
|---|---|---|---|
| 印度(股票) | OpenAlgo | client.history() | SBIN, RELIANCE, INFY |
| 印度(指数) | OpenAlgo | client.history(exchange="NSE_INDEX") | NIFTY, BANKNIFTY |
| 印度(期货与期权) | OpenAlgo | client.history(exchange="NFO") | NIFTY30DEC25FUT |
| 美国/全球 | yfinance | yf.download() | AAPL, MSFT, SPY |
| 方法 | 用途 | 返回值 |
|---|---|---|
client.history(symbol, exchange, interval, start_date, end_date) | OHLCV K线 | DataFrame(时间戳、开盘价、最高价、最低价、收盘价、成交量) |
client.quotes(symbol, exchange) | 实时快照 | Dict(开盘价、最高价、最低价、最后成交价、买价、卖价、前收盘价、成交量) |
client.multiquotes(symbols=[...]) | 多代码报价 | 报价字典列表 |
client.depth(symbol, exchange) | 市场深度(L5) | Dict(买盘、卖盘、OHLC、成交量、持仓量) |
client.intervals() | 可用时间间隔 | Dict(分钟、小时、天、周、月) |
client.connect() | WebSocket 连接 | None(建立 WS 连接) |
client.subscribe_ltp(instruments, callback) | 实时 LTP 流 | 回调函数接收 {symbol, exchange, ltp} |
client.subscribe_quote(instruments, callback) | 实时报价流 | 回调函数接收 {symbol, exchange, ohlc, ltp, volume} |
client.subscribe_depth(instruments, callback) | 实时深度流 | 回调函数接收 {symbol, exchange, bids, asks} |
所有指标通过 from openalgo import ta 访问:
ta.sma, ta.ema, ta.wma, ta.dema, ta.tema, ta.hma, ta.vwma, ta.alma, ta.kama, ta.zlema, ta.t3, ta.frama, ta.supertrend, ta.ichimoku, ta.chande_kroll_stop, ta.trima, ta.mcginley, ta.vidya, ta.alligator, ta.ma_envelopes
ta.rsi, ta.macd, ta.stochastic, ta.cci, ta.williams_r, ta.bop, ta.elder_ray, ta.fisher, ta.crsi
ta.atr, ta.bbands, ta.keltner, ta.donchian, ta.chaikin_volatility, ta.natr, ta.rvi, ta.ultimate_oscillator, ta.true_range, ta.massindex, ta.bb_percent, ta.bb_width, ta.chandelier_exit, ta.historical_volatility, ta.ulcer_index, ta.starc
ta.obv, ta.obv_smoothed, ta.vwap, ta.mfi, ta.adl, ta.cmf, ta.emv, ta.force_index, ta.nvi, ta.pvi, ta.volosc, ta.vroc, ta.kvo, ta.pvt
ta.cmo, ta.trix, ta.uo_oscillator, ta.awesome_oscillator, ta.accelerator_oscillator, ta.ppo, ta.po, ta.dpo, ta.aroon_oscillator, ta.stoch_rsi, ta.rvi_oscillator, ta.cho, ta.chop, ta.kst, ta.tsi, ta.vortex, ta.gator_oscillator, ta.stc, ta.coppock, ta.roc
ta.linreg, ta.lrslope, ta.correlation, ta.beta, ta.variance, ta.tsf, ta.median, ta.mode, ta.median_bands
ta.adx, ta.dmi, ta.aroon, ta.pivot_points, ta.sar, ta.williams_fractals, ta.rwi
ta.crossover, ta.crossunder, ta.cross, ta.highest, ta.lowest, ta.change, ta.roc, ta.stdev, ta.exrem, ta.flip, ta.valuewhen, ta.rising, ta.falling
每个主题的详细参考位于 rules/ 目录下:
| 规则文件 | 主题 |
|---|---|
| indicator-catalog | 完整的 100+ 指标参考,包含签名和参数 |
| data-fetching | OpenAlgo history/quotes/depth、yfinance、数据规范化 |
| plotting | Plotly K线图、叠加图、子图、多面板图表 |
| custom-indicators | 使用 Numba + NumPy 构建自定义指标 |
| websocket-feeds | 通过 WebSocket 进行实时 LTP/报价/深度数据流 |
| numba-optimization | Numba JIT 模式、缓存、nogil、NaN 处理 |
| dashboard-patterns | 带回调的 Plotly Dash Web 应用程序 |
| streamlit-patterns | 带侧边栏、指标、plotly 图表的 Streamlit Web 应用程序 |
| multi-timeframe | 多时间框架指标分析 |
| signal-generation | 信号生成、清理、交叉/下穿 |
| indicator-combinations | 组合指标进行汇合分析 |
| symbol-format | OpenAlgo 代码格式、交易所代码、指数代码 |
| 模板 | 路径 | 描述 |
|---|---|---|
| EMA 图表 | assets/ema_chart/chart.py | K线图上叠加 EMA |
| RSI 图表 | assets/rsi_chart/chart.py | RSI 配合超买/超卖区域 |
| MACD 图表 | assets/macd_chart/chart.py | MACD 线、信号线、柱状图 |
| Supertrend | assets/supertrend_chart/chart.py | Supertrend 叠加,带方向颜色标记 |
| Bollinger | assets/bollinger_chart/chart.py | 布林带配合挤压检测 |
| 多指标图表 | assets/multi_indicator/chart.py | K线 + EMA + RSI + MACD + 成交量 |
| 基础仪表板 | assets/dashboard_basic/app.py | 单代码 Plotly Dash 应用 |
| 多仪表板 | assets/dashboard_multi/app.py | 多代码多时间框架仪表板 |
| Streamlit 基础 | assets/streamlit_basic/app.py | 单代码 Streamlit 应用 |
| Streamlit 多框架 | assets/streamlit_multi/app.py | 多时间框架 Streamlit 应用 |
| 自定义指标 | assets/custom_indicator/template.py | Numba 自定义指标模板 |
| 实时数据流 | assets/live_feed/template.py | WebSocket 实时指标 |
| 扫描器 | assets/scanner/template.py | 多代码指标扫描器 |
import os
from datetime import datetime, timedelta
from pathlib import Path
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from dotenv import find_dotenv, load_dotenv
from openalgo import api, ta
# --- 配置 ---
script_dir = Path(__file__).resolve().parent
load_dotenv(find_dotenv(), override=False)
SYMBOL = "SBIN"
EXCHANGE = "NSE"
INTERVAL = "D"
# --- 获取数据 ---
client = api(
api_key=os.getenv("OPENALGO_API_KEY"),
host=os.getenv("OPENALGO_HOST", "http://127.0.0.1:5000"),
)
end_date = datetime.now().date()
start_date = end_date - timedelta(days=365)
df = client.history(
symbol=SYMBOL, exchange=EXCHANGE, interval=INTERVAL,
start_date=start_date.strftime("%Y-%m-%d"),
end_date=end_date.strftime("%Y-%m-%d"),
)
if "timestamp" in df.columns:
df["timestamp"] = pd.to_datetime(df["timestamp"])
df = df.set_index("timestamp")
else:
df.index = pd.to_datetime(df.index)
df = df.sort_index()
if df.index.tz is not None:
df.index = df.index.tz_convert(None)
close = df["close"]
high = df["high"]
low = df["low"]
volume = df["volume"]
# --- 计算指标 ---
ema_20 = ta.ema(close, 20)
rsi_14 = ta.rsi(close, 14)
# --- 图表 ---
fig = make_subplots(
rows=2, cols=1, shared_xaxes=True,
row_heights=[0.7, 0.3], vertical_spacing=0.03,
subplot_titles=[f"{SYMBOL} 价格 + EMA(20)", "RSI(14)"],
)
# K线图
x_labels = df.index.strftime("%Y-%m-%d")
fig.add_trace(go.Candlestick(
x=x_labels, open=df["open"], high=high, low=low, close=close,
name="价格",
), row=1, col=1)
# EMA 叠加
fig.add_trace(go.Scatter(
x=x_labels, y=ema_20, mode="lines",
name="EMA(20)", line=dict(color="cyan", width=1.5),
), row=1, col=1)
# RSI 子图
fig.add_trace(go.Scatter(
x=x_labels, y=rsi_14, mode="lines",
name="RSI(14)", line=dict(color="yellow", width=1.5),
), row=2, col=1)
fig.add_hline(y=70, line_dash="dash", line_color="red", row=2, col=1)
fig.add_hline(y=30, line_dash="dash", line_color="green", row=2, col=1)
fig.update_layout(
template="plotly_dark", title=f"{SYMBOL} 技术分析",
xaxis_rangeslider_visible=False, xaxis_type="category",
xaxis2_type="category", height=700,
)
fig.show()
每周安装次数
125
代码仓库
GitHub 星标数
5
首次出现
2026年2月28日
安全审计
安装于
codex125
opencode125
gemini-cli124
amp123
cline123
github-copilot123
client.history(), client.quotes(), client.depth()), yfinance (US/Global)client.connect(), subscribe_ltp, subscribe_quote, subscribe_depth)template="plotly_dark"dash-bootstrap-components OR Streamlit with st.plotly_chart()@njit(cache=True, nogil=True) + NumPy.env via python-dotenv + find_dotenv() — never hardcode keysta.exrem() after generating raw buy/sell signals. Always .fillna(False) before exrem.template="plotly_dark" with xaxis type="category" for candlesticks.@njit(cache=True, nogil=True) — never fastmath=True (breaks NaN handling).client.connect(), / / for real-time data.| Market | Data Source | Method | Example Symbols |
|---|---|---|---|
| India (equity) | OpenAlgo | client.history() | SBIN, RELIANCE, INFY |
| India (index) | OpenAlgo | client.history(exchange="NSE_INDEX") | NIFTY, BANKNIFTY |
| India (F&O) | OpenAlgo | client.history(exchange="NFO") | NIFTY30DEC25FUT |
| US/Global | yfinance | yf.download() | AAPL, MSFT, SPY |
| Method | Purpose | Returns |
|---|---|---|
client.history(symbol, exchange, interval, start_date, end_date) | OHLCV candles | DataFrame (timestamp, open, high, low, close, volume) |
client.quotes(symbol, exchange) | Real-time snapshot | Dict (open, high, low, ltp, bid, ask, prev_close, volume) |
client.multiquotes(symbols=[...]) | Multi-symbol quotes | List of quote dicts |
client.depth(symbol, exchange) | Market depth (L5) | Dict (bids, asks, ohlc, volume, oi) |
client.intervals() |
All indicators accessed via from openalgo import ta:
ta.sma, ta.ema, ta.wma, ta.dema, ta.tema, ta.hma, ta.vwma, ta.alma, ta.kama, ta.zlema, ta.t3, ta.frama, , , , , , , ,
ta.rsi, ta.macd, ta.stochastic, ta.cci, ta.williams_r, ta.bop, ta.elder_ray, ta.fisher, ta.crsi
ta.atr, ta.bbands, ta.keltner, ta.donchian, ta.chaikin_volatility, ta.natr, ta.rvi, ta.ultimate_oscillator, ta.true_range, ta.massindex, ta.bb_percent, ta.bb_width, , , ,
ta.obv, ta.obv_smoothed, ta.vwap, ta.mfi, ta.adl, ta.cmf, ta.emv, ta.force_index, ta.nvi, ta.pvi, ta.volosc, ta.vroc, ,
ta.cmo, ta.trix, ta.uo_oscillator, ta.awesome_oscillator, ta.accelerator_oscillator, ta.ppo, ta.po, ta.dpo, ta.aroon_oscillator, ta.stoch_rsi, ta.rvi_oscillator, ta.cho, , , , , , , ,
ta.linreg, ta.lrslope, ta.correlation, ta.beta, ta.variance, ta.tsf, ta.median, ta.mode, ta.median_bands
ta.adx, ta.dmi, ta.aroon, ta.pivot_points, ta.sar, ta.williams_fractals, ta.rwi
ta.crossover, ta.crossunder, ta.cross, ta.highest, ta.lowest, ta.change, ta.roc, ta.stdev, ta.exrem, ta.flip, ta.valuewhen, ta.rising,
Detailed reference for each topic is in rules/:
| Rule File | Topic |
|---|---|
| indicator-catalog | Complete 100+ indicator reference with signatures and parameters |
| data-fetching | OpenAlgo history/quotes/depth, yfinance, data normalization |
| plotting | Plotly candlestick, overlay, subplot, multi-panel charts |
| custom-indicators | Building custom indicators with Numba + NumPy |
| websocket-feeds | Real-time LTP/Quote/Depth streaming via WebSocket |
| numba-optimization | Numba JIT patterns, cache, nogil, NaN handling |
| Template | Path | Description |
|---|---|---|
| EMA Chart | assets/ema_chart/chart.py | EMA overlay on candlestick |
| RSI Chart | assets/rsi_chart/chart.py | RSI with overbought/oversold zones |
| MACD Chart | assets/macd_chart/chart.py | MACD line, signal, histogram |
| Supertrend | assets/supertrend_chart/chart.py | Supertrend overlay with direction coloring |
| Bollinger | assets/bollinger_chart/chart.py |
import os
from datetime import datetime, timedelta
from pathlib import Path
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from dotenv import find_dotenv, load_dotenv
from openalgo import api, ta
# --- Config ---
script_dir = Path(__file__).resolve().parent
load_dotenv(find_dotenv(), override=False)
SYMBOL = "SBIN"
EXCHANGE = "NSE"
INTERVAL = "D"
# --- Fetch Data ---
client = api(
api_key=os.getenv("OPENALGO_API_KEY"),
host=os.getenv("OPENALGO_HOST", "http://127.0.0.1:5000"),
)
end_date = datetime.now().date()
start_date = end_date - timedelta(days=365)
df = client.history(
symbol=SYMBOL, exchange=EXCHANGE, interval=INTERVAL,
start_date=start_date.strftime("%Y-%m-%d"),
end_date=end_date.strftime("%Y-%m-%d"),
)
if "timestamp" in df.columns:
df["timestamp"] = pd.to_datetime(df["timestamp"])
df = df.set_index("timestamp")
else:
df.index = pd.to_datetime(df.index)
df = df.sort_index()
if df.index.tz is not None:
df.index = df.index.tz_convert(None)
close = df["close"]
high = df["high"]
low = df["low"]
volume = df["volume"]
# --- Compute Indicators ---
ema_20 = ta.ema(close, 20)
rsi_14 = ta.rsi(close, 14)
# --- Chart ---
fig = make_subplots(
rows=2, cols=1, shared_xaxes=True,
row_heights=[0.7, 0.3], vertical_spacing=0.03,
subplot_titles=[f"{SYMBOL} Price + EMA(20)", "RSI(14)"],
)
# Candlestick
x_labels = df.index.strftime("%Y-%m-%d")
fig.add_trace(go.Candlestick(
x=x_labels, open=df["open"], high=high, low=low, close=close,
name="Price",
), row=1, col=1)
# EMA overlay
fig.add_trace(go.Scatter(
x=x_labels, y=ema_20, mode="lines",
name="EMA(20)", line=dict(color="cyan", width=1.5),
), row=1, col=1)
# RSI subplot
fig.add_trace(go.Scatter(
x=x_labels, y=rsi_14, mode="lines",
name="RSI(14)", line=dict(color="yellow", width=1.5),
), row=2, col=1)
fig.add_hline(y=70, line_dash="dash", line_color="red", row=2, col=1)
fig.add_hline(y=30, line_dash="dash", line_color="green", row=2, col=1)
fig.update_layout(
template="plotly_dark", title=f"{SYMBOL} Technical Analysis",
xaxis_rangeslider_visible=False, xaxis_type="category",
xaxis2_type="category", height=700,
)
fig.show()
Weekly Installs
125
Repository
GitHub Stars
5
First Seen
Feb 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex125
opencode125
gemini-cli124
amp123
cline123
github-copilot123
DOCX文件创建、编辑与分析完整指南 - 使用docx-js、Pandoc和Python脚本
51,800 周安装
client.subscribe_ltp()subscribe_quote()subscribe_depth().env from project root via find_dotenv() — never hardcode API keys.| Available intervals |
| Dict (minutes, hours, days, weeks, months) |
client.connect() | WebSocket connect | None (sets up WS connection) |
client.subscribe_ltp(instruments, callback) | Live LTP stream | Callback with {symbol, exchange, ltp} |
client.subscribe_quote(instruments, callback) | Live quote stream | Callback with {symbol, exchange, ohlc, ltp, volume} |
client.subscribe_depth(instruments, callback) | Live depth stream | Callback with {symbol, exchange, bids, asks} |
ta.supertrendta.ichimokuta.chande_kroll_stopta.trimata.mcginleyta.vidyata.alligatorta.ma_envelopesta.chandelier_exitta.historical_volatilityta.ulcer_indexta.starcta.kvota.pvtta.chopta.kstta.tsita.vortexta.gator_oscillatorta.stcta.coppockta.rocta.falling| Plotly Dash web applications with callbacks |
| streamlit-patterns | Streamlit web applications with sidebar, metrics, plotly charts |
| multi-timeframe | Multi-timeframe indicator analysis |
| signal-generation | Signal generation, cleaning, crossover/crossunder |
| indicator-combinations | Combining indicators for confluence analysis |
| symbol-format | OpenAlgo symbol format, exchange codes, index symbols |
| Bollinger Bands with squeeze detection |
| Multi-Indicator | assets/multi_indicator/chart.py | Candlestick + EMA + RSI + MACD + Volume |
| Basic Dashboard | assets/dashboard_basic/app.py | Single-symbol Plotly Dash app |
| Multi Dashboard | assets/dashboard_multi/app.py | Multi-symbol multi-timeframe dashboard |
| Streamlit Basic | assets/streamlit_basic/app.py | Single-symbol Streamlit app |
| Streamlit Multi | assets/streamlit_multi/app.py | Multi-timeframe Streamlit app |
| Custom Indicator | assets/custom_indicator/template.py | Numba custom indicator template |
| Live Feed | assets/live_feed/template.py | WebSocket real-time indicator |
| Scanner | assets/scanner/template.py | Multi-symbol indicator scanner |