Execution

OpenAlgo Execution Agentic Skills for Agentic Coding Tools

A comprehensive agent-skill package covering the full OpenAlgo Python SDK surface — trading execution, custom limit-order algorithms, scanners, visualization, backtesting, charting, real-time WebSocket streaming, and Telegram / WhatsApp alerts for Indian markets (NSE, BSE, NFO, BFO, CDS, BCD, MCX, NCO). Works with 40+ AI coding agents via skills.sh — including Claude Code, Cursor, Codex, OpenCode, Cline, Windsurf, GitHub Copilot, Gemini CLI, Roo Code, and more.

Broker-agnostic by design — one Python SDK talks to 30+ Indian brokers behind a unified REST + WebSocket interface. The skill is response-aware: every reference doc and example demonstrates how to chain endpoints together (e.g. place order → poll status → read fill price → compute SL → attach SL+target → alert) so the agent can write production-quality strategies, not just isolated API calls.

Quick Install

Install the skill into your project using npx skills. The CLI auto-detects your AI coding agent and installs skills to the correct directory.

# GitHub shorthand
npx skills add marketcalls/openalgo-skills

# Full GitHub URL
npx skills add https://github.com/marketcalls/openalgo-skills

Install the bundled skill explicitly:

npx skills add marketcalls/openalgo-skills -s openalgo

List available skills before installing:

npx skills add marketcalls/openalgo-skills -l

Install globally (available across all projects):

npx skills add marketcalls/openalgo-skills -g

Supported AI Coding Agents

Skills are installed via skills.sh which supports 40+ agents. Each agent reads skills from its own directory:

Agent
Skills Directory

Claude Code

.claude/skills/

Cursor

.agents/skills/

Codex

.agents/skills/

OpenCode

.agents/skills/

Cline

.agents/skills/

Windsurf

.agents/skills/

GitHub Copilot

.agents/skills/

Gemini CLI

.agents/skills/

Roo Code

.agents/skills/

+ 30 more

Auto-detected by npx skills

The npx skills add command detects which agents you have installed and places the skill files in the correct paths automatically.

Supported Use Cases

Use Case
What's Covered

Order Execution

Equity, F&O, options-by-offset (ATM/ITM/OTM), multi-leg (iron condor, straddle, diagonal), basket, split, smart-order, GTT (OCO + single-trigger)

Custom Execution Algos

Limit-order chaser (peg the touch, auto-modify, MARKET fallback), TWAP slicer, iceberg slicer, time-based cancel, price-based cancel-and-replace, conditional bracket

Scanners

Top gainers / losers, breakout (with volume confirmation), RSI oversold, volume surge, pre-open gap up / down, F&O OI delta — built on multiquotes + history pipelines

Visualization

Sector heatmap, YTD / CAGR heatmaps, OI histogram, PCR dashboard, seasonality

Backtesting

vectorbt glue with realistic Indian-market fees, NIFTY benchmark, plain-language reports, direct DuckDB Historify access for bulk multi-symbol pulls

Charting

Candlestick (no weekend gaps), option-chain OI, max-pain, IV smile, depth ladder

Real-Time Streaming

LTP / Quote / Depth WebSocket (Mode 1/2/3), depth_level 5/20/30/50, verbose control, persistent reconnect loop, callback router for per-symbol handlers

Alerts

Telegram + WhatsApp send-only endpoints with rich pre-built templates (order placed, fill, SL hit, target hit, position closed, scanner results, daily P&L, error)

Capabilities

How the Skill Triggers

The bundled skill is named openalgo. After installation it auto-loads in your agent when the conversation matches OpenAlgo-related work. Common trigger phrases:

  • "Place an order on OpenAlgo"

  • "Build a limit-order chaser for SBIN"

  • "Scan NIFTY 50 for breakouts / gainers / RSI oversold"

  • "Stream NIFTY depth with a 20-level book"

  • "Backtest an EMA crossover on Historify data"

  • "Render the option chain OI chart"

  • "Send a Telegram alert when NIFTY crosses 26000"

  • "Place an ATM straddle with auto stoploss on each leg"

  • "Fetch Greeks and pick the 25-delta strike"

The agent then reads SKILL.md for safety rules and the API surface table, and consults the deep-dive references on demand for parameter-complete API docs.

Helper Scripts (16 Composable Modules)

Script
Purpose

openalgo_client.py

get_client() — bootstraps from .env via find_dotenv(); resolves OPENALGO_API_KEY, host, ws_url, Historify DuckDB path

symbols.py

Build / parse equity, futures, options symbols; common index lists; client.symbol and client.search wrappers

lotsize.py

F&O lot validation from bundled LotSize.csv; nearest_lot() + authoritative live lookup via client.symbol(...).lotsize

orders.py

preview_order, place_with_retry, modify_with_retry, cancel_with_retry, poll_until_terminal — handles rate limits

execution.py

LimitChaser, TWAPSlicer, IcebergSlicer — composable execution-algo primitives

responses.py

Response navigation helpersextract_orderid, avg_fill_price, poll_until_filled, extract_ltp, extract_touch, etc.

workflows.py

High-level chains: place_with_sl_target, enter_options_atm_with_sl, square_off_with_alert, place_smart_with_position_check

option_analytics.py

chain_to_df, pcr, max_pain, iv_skew, payoff (multi-leg P&L diagram)

scanner.py

Scanner — multi-symbol filter pipeline over multiquotes + history, parallelized with thread pool

stream.py

subscribe() context manager, run_until_interrupt, CallbackRouter, reconnect_loop

plotting.py

Candlestick (no weekend gaps), OI histogram, heatmap, depth ladder, payoff chart — all Plotly dark theme

duckdb_data.py

Direct Historify access for bulk pulls (load_ohlcv, load_multi, resample_ist, list_symbols, date_range)

alerts.py

Telegram + WhatsApp dispatcher with rich fmt_* templates and one-call notify(via=...) and alert_order_lifecycle

fees.py

Indian-market cost model (delivery / intraday / F&O futures / F&O options / currency / commodity) — fees_pct + fixed_fees_inr

ta_helpers.py

Ergonomic wrappers: TA-Lib (EMA, SMA, RSI, MACD, ATR, BBANDS, ADX) + openalgo.ta (Supertrend, Donchian, Ichimoku, HMA, KAMA)

trade_logger.py

CsvJournal and SqliteJournal with identical .write() surface — persistent trade journals

Knowledge Base (19 Reference Files)

Every SDK endpoint has a dedicated reference with Request / Success-Response / Error-Response / Field-extraction / Chains-with sections. The response shapes are documented inline so the agent knows exactly which fields to read and where the chain goes next.

Category
What's Covered

Order Management

placeorder, placesmartorder, optionsorder, optionsmultiorder, basketorder, splitorder, modifyorder, cancelorder, cancelallorder, closeposition, GTT family

Order Information

orderstatus, openposition — the polling pattern and data.average_price extraction

Market Data

quotes, multiquotes, depth, history (REST + Historify DuckDB), intervals

Symbol Services

symbol, search, expiry, instruments — lot sizes, freeze quantities, tick sizes

Options Services

optionsymbol (ATM / ITMn / OTMn resolution), optionchain, syntheticfuture, optiongreeks (delta / gamma / theta / vega / rho + IV)

Account Services

funds, margin (multi-leg margin calculator), orderbook, tradebook, positionbook, holdings

Market Calendar

holidays(year), timings(date), checkholiday — schedule-aware strategy startup

Analyzer (Sandbox) Mode

analyzerstatus, analyzertoggle(mode=True) — iterate safely before going live

WebSocket Streaming

Modes 1 (LTP) / 2 (Quote) / 3 (Depth with depth_level 5/20/30/50), verbose 0/1/2, heartbeat, reconnect

Alerts

telegram(username, message) and full whatsapp(text, to=..., image=..., document=...) surface incl. broadcast (≤5) and slash-command receiving

Indicators

TA-Lib mandatory for standard set; openalgo.ta for Supertrend / Donchian / Ichimoku / HMA / KAMA / ALMA / ZLEMA / VWMA + exrem / crossover / flip

Execution Algorithms

Limit chaser algorithm + TWAP + iceberg primitives, plus patterns for time-cancel, price-replace, conditional bracket

DuckDB Historify

Direct read-only access to <openalgo>/db/historify.duckdb; bulk multi-symbol pulls; NSE 09:15 IST-aligned resampling

Symbol Format

Equity (RELIANCE), Futures (NIFTY30JUN26FUT), Options (NIFTY30JUN2626500CE) + full index symbol lists (NSE_INDEX, BSE_INDEX, GLOBAL_INDEX, MCX_INDEX)

F&O Lot Sizes

Bundled LotSize.csv (Apr / May / Jun 2026 SEBI snapshot); live client.symbol(...).lotsize for authoritative value

Order Constants

Exchange / Product / Price-type / Action / Validity / Offset / WS mode / Verbose level — all enums

Rate Limits

Order APIs 10/sec, smart orders 2/sec, general 50/sec, webhooks 100/min — retry-on-429 helper

Common Workflows

10 end-to-end response-chained recipes covering the canonical patterns

Error Codes

Common SDK errors and step-by-step fixes (invalid key, session expired, lot violation, insufficient margin, etc.)

Examples Catalog (33 Production-Ready Scripts)

Folder
Scripts
Coverage

01_execution

6

Equity LIMIT with quote-anchored pricing, ATM straddle with auto-SL, iron condor with margin pre-check, basket rebalance, SL+target workflow, Supertrend live

02_scanners

5

NIFTY 50 gainers / losers, 20-day breakout (with volume confirmation), RSI oversold, volume surge, pre-open gap

03_visualization

4

Sector heatmap (treemap), YTD heatmap, OI change histogram, PCR dashboard

04_backtesting

3

EMA crossover, Supertrend, multi-symbol screener — all with NIFTY benchmark, Indian fees, plain-language reports

05_charting

4

Candlestick with EMA + Supertrend overlays, option-chain OI, max-pain profile, market-depth ladder

06_streaming

4

Basic LTP stream, 20-level depth stream with parquet logging, Telegram alert on price breach, persistent reconnect loop

07_execution_algos

7

Limit chaser, TWAP slicer, iceberg slicer, time-based cancel, price-based cancel-and-replace, conditional bracket, cancel-all-with-alert

Prerequisites

1. AI Coding Agent

Install any supported AI coding agent. For example:

Then install the skill:

2. OpenAlgo Instance

Order placement, real-time data, and most other endpoints require a running OpenAlgo instance:

OpenAlgo runs locally at http://127.0.0.1:5000 (REST) and ws://127.0.0.1:8765 (WebSocket). You need a broker account connected via OpenAlgo and an API key from the dashboard. See the OpenAlgo documentation for installation and broker setup.

Backtesting-only? If you intend to use this skill purely for backtesting against Historify market data, you can skip the broker session — just point HISTORIFY_DUCKDB_PATH at a populated historify.duckdb file.

3. Python Environment Setup

requirements.txt ships with:

  • openalgo[indicators] — SDK + JIT-accelerated openalgo.ta indicators

  • python-dotenv, pandas, numpy, duckdb, pyarrow

  • TA-Lib for standard indicators

  • vectorbt for backtesting (composes with the vectorbt-backtesting-skills package)

  • plotly, matplotlib, seaborn for charting

  • APScheduler, pytz for scheduled / intraday loops

4. Configure API Keys

The .env file supports:

Usage Examples

The skill is single-skill (no slash commands) — interact with it through natural language. The agent loads the relevant references and helpers on demand.

Order Execution

Custom Execution Algorithms

Scanners

Visualization & Charting

Backtesting (with vectorbt)

Real-Time Streaming

Alerts

Key Features

Response-Aware Design (The Canonical Chain)

Every reference doc and example chains endpoints together. The agent knows not just how to call an endpoint, but how to read the response and feed the right field into the next step. The canonical example — automatic SL + target on the actual fill price:

Under the hood: placeorder → orderstatus(poll) → data.average_price → compute SL+target → placeorder(SL-M) → placeorder(LIMIT) → alert. All wrapped in one call. All responses validated.

Comprehensive Telegram + WhatsApp Alerts

Pre-built templates for every common event:

Event
Template Function

Order placed

fmt_order_placed(...)

Order filled

fmt_order_filled(...)

Stoploss triggered

fmt_stoploss_triggered(...)

Target hit

fmt_target_hit(...)

Position closed

fmt_position_closed(...)

Scanner results

fmt_scanner_results(...)

Daily P&L

fmt_daily_pnl(...)

Error

fmt_error(...)

One-call multi-channel dispatch via notify(client, message, via=("telegram", "whatsapp")). WhatsApp supports text, image with caption, and document (PDF / CSV) attachments. Broadcasts up to 5 recipients. All failures degrade gracefully — alert errors never crash the strategy.

Custom Execution Algorithms — First-Class

Three reusable execution-algo primitives with full configurability:

Plus standalone patterns for time-based cancel, price-based cancel-and-replace, and conditional bracket (wait for X% move, then attach SL).

Direct DuckDB Historify Access

client.history(..., source="db") works via REST, but for bulk multi-symbol pulls or full-lookback backtests, hit the DuckDB file directly:

Performance: 50 symbols × 1 year of daily completes in ~50ms direct vs ~15s via REST.

Sandbox / Analyzer Mode

Iterate without sending real orders to the broker. Toggle at the top of any strategy:

The SDK returns fake orderids and logs every call to the analyzer log (viewable at /analyzer). Sandbox has ₹1 Crore default capital and exchange-aligned auto-square-off.

Indian-Market Cost Model

Realistic fees by segment with Zerodha-style fee table — configurable for any broker:

Segment

fees

fixed_fees

Equity Delivery

0.00111 (0.111%)

Rs 0/order

Equity Intraday

0.000225 (0.0225%)

Rs 20/order

F&O Futures

0.00018 (0.018%)

Rs 20/order

F&O Options

0.00098 (0.098%)

Rs 20/order

Currency Futures

0.00009 (0.009%)

Rs 20/order

Currency Options

0.00098 (0.098%)

Rs 20/order

Commodity Futures

0.00018 (0.018%)

Rs 20/order

Commodity Options

0.00098 (0.098%)

Rs 20/order

scripts/fees.py exposes fees_pct(segment) and fixed_fees_inr(segment) for direct use in vectorbt.Portfolio.from_signals(fees=..., fixed_fees=...). estimate_charges(...) returns a full breakdown (STT, exchange txn, SEBI, GST, stamp) for live order preview.

F&O Lot Sizes (SEBI Snapshot)

Index
Lot Size (Jun 2026)
Exchange

NIFTY 50

65

NFO

Nifty Bank

30

NFO

Nifty Financial Services

60

NFO

Nifty Midcap Select

120

NFO

Nifty Next 50

25

NFO

Bundled in assets/LotSize.csv (~200 underlyings, Apr / May / Jun 2026 columns). client.symbol(symbol, exchange='NFO').data.lotsize returns the authoritative live value when the snapshot is stale.

File-Output Convention

Generated scripts and outputs land in a per-action subfolder, vectorbt-style, created on demand:

Each subfolder is self-contained — script, generated data, plots, logs. The user can move, share, or rm -rf any single experiment without disturbing the rest.

Rate-Limit Handling

Order APIs are capped at 10/sec (smart orders 2/sec); general data APIs at 50/sec. The helper layer retries transparently:

Scanners auto-batch via multiquotes (one call for many symbols) rather than looping quotes.

Project Structure

Reference Files

Reference File
Description

order-management.md

placeorder, smart, options, multi-leg, basket, split, modify, cancel, close, GTT — full request / response

order-information.md

orderstatus, openposition — polling loop, data.average_price extraction

market-data.md

quotes, multiquotes, depth, history, intervals — REST and DuckDB-backed

symbol-services.md

symbol, search, expiry, instruments — lot sizes, freeze quantities, broker tokens

options-services.md

optionsymbol, optionchain, syntheticfuture, optiongreeks — ATM/ITM/OTM offsets, full Greek chain

account-services.md

funds, margin (multi-leg), orderbook, tradebook, positionbook, holdings

market-calendar.md

holidays(year), timings(date), checkholiday — schedule-aware startup

analyzer-services.md

analyzerstatus, analyzertoggle(mode=True) — sandbox iteration

websocket-streaming.md

Modes 1/2/3, depth_level 5/20/30/50, verbose levels, heartbeat, reconnect

alerts.md

telegram and whatsapp send-only endpoints with full template library and slash-command receiving

indicators.md

TA-Lib + openalgo.ta complete reference with signal-cleaning patterns

execution-algos.md

Limit chaser, TWAP, iceberg algorithms — building blocks for custom execution strategies

duckdb-historify.md

Direct DuckDB schema, single-symbol load, multi-symbol wide load, IST-aligned resampling

symbol-format.md

Equity / Futures / Options grammar + full index symbol lists (NSE_INDEX, BSE_INDEX, GLOBAL_INDEX, MCX_INDEX, NCO)

lot-sizes.md

F&O lot-size CSV + live client.symbol lookup, validation, sizing patterns

order-constants.md

All enum values (exchange, product, price type, action, validity, offset, WS mode, verbose level)

rate-limits.md

Per-bucket limits, retry-on-429 helper, scanner batching guidance

common-workflows.md

10 canonical response-chained recipes (order→SL→target, scanner→alert, etc.)

error-codes.md

Common SDK errors and step-by-step fixes

All three share the same .env convention, file-output layout, and Indian-market cost model. You can install them side by side.


Last updated