Skip to main content

OpenTrade

Market data in your terminal, shaped for humans and agents.

Search instruments, inspect quotes, review history, export datasets, and read indicator-rich observation output from one consistent command tree.

Python 3.10+ PyPI package Backend akshare Backend efinance Backend yfinance

Installation · Agent Skills · Quick start · Command tree · Output and defaults · Indicator support · More docs

English | 简体中文 | 繁體中文

Installation

Install the published PyPI package opentrade. The package exposes both opentrade and optr.

uv add -U opentrade
opentrade --help
pip install -U opentrade
opentrade --help

Python 3.10+ is required.

Agent Skills

OpenTrade also provides agent skills for automated investment research workflows.

When you want Codex, Claude Code, or another coding agent to install them, just say:

Please install skills from https://github.com/vortezwohl/OpenTrade, and place them in my global user skill directory.

These skills are designed for automated research across stocks, funds, bonds, futures, and broader market workflows.

Quick Start

opentrade search --query AAPL --market US_stock --result-count 5 --format json

Use this when you only know a ticker, keyword, or company name.

2. Latest quote

opentrade quote price latest --symbols AAPL --format json

Use shared quote commands when you want a cross-backend symbol or ticker workflow.

3. History

opentrade quote price history --symbols AAPL --market us_stock --start-date 20250501 --end-date 20250601 --format json

Use history commands when you need candles, backfill, indicators, or exports.

Python API

OpenTrade also exposes an importable object-oriented Python API.

from opentrade import OpenTrade

ot = OpenTrade()

search_result = ot.search.instruments("AAPL", result_count=5)
latest_quote = ot.quote.price_latest(["AAPL"])
history = ot.stock.price_history(
    ["AAPL"],
    start_date="20250501",
    end_date="20250601",
    backend="yfinance",
)
quote_id = ot.resolve.quote_id("000001")

Practical notes:

  • The Python API is object-oriented only; the top-level import is OpenTrade.
  • The Python API does not expose watch.
  • Methods return Python objects directly instead of terminal-rendered text.
  • Shared commands keep the same backend semantics as the CLI.

Technical indicators remain in the indicators subpackage:

from opentrade.indicators import macd, rsi
from opentrade.indicators.trend import macd as trend_macd

Command Tree

Command Role Typical use
search Keyword-based discovery Find candidates before you know the exact identifier
resolve Identifier resolution Turn a symbol into a provider-specific quote ID when needed
quote Cross-asset shared queries Shared latest, history, and profile access
stock Stock-specific workflows Price, snapshot, flow, holders, profile
fund Fund-specific workflows NAV history, estimates, allocation, managers, reports
bond Bond-specific workflows Price, profile, trades, flows
futures Futures-specific workflows Catalog, history, live quotes, trades
market Market-level queries Live scans and mapping-style lookups
watch Refresh wrapper Repeat a supported command on an interval

Output and Defaults

Current real defaults for shared commands:

  • --format table
  • --indicator-level advanced
  • --view observation
  • --trace-window 32
  • omitted --backend resolves to auto

Practical notes:

  • observation is the default public-facing view.
  • Use --view raw when you want the unwrapped payload shape.
  • json is usually the best target for scripts and agents.
  • full gives richer indicator context than advanced, but it costs more backfill and computation.

Indicator Support

Indicator enrichment is a core part of opentrade and remains available on compatible commands.

Level What it gives you in practice
basic Core trend and momentum coverage such as MA, EMA, MACD, RSI, KDJ, BOLL, ATR, and OBV
advanced Broader trend-strength, channel, and money-flow coverage such as ADX, Donchian, Keltner, SuperTrend, MFI, PVT, CMF, VWAP, VR, and PSY
full Richer structure and market-context layers such as Ichimoku, SAR, Mass Index, Pivot Points, Fibonacci Retracement, support/resistance, Chaikin Oscillator, Chaikin Volatility, and EMV

Representative indicator families:

  • Moving averages and base transforms
  • Trend and channel indicators
  • Momentum indicators
  • Volume and money-flow indicators
  • Volatility indicators
  • Price-structure indicators
  • Common Chinese-market technical indicators

See docs/indicator-coverage.md for the fuller list and grouping.

Backend Notes

  • Shared commands default to auto, and auto may fall back when an earlier backend candidate fails.
  • Shared symbols are not Eastmoney quote_id values.
  • yfinance intraday history has strict window limits and is mostly single-symbol oriented in this project.
  • A command that succeeds under auto may still have lost enriched observation fields after a failed history backfill on the chosen backend.

See docs/backend-notes.md for deeper backend-specific constraints and troubleshooting notes.

Common Tasks

Search and inspect

opentrade search --query NVDA --market US_stock
opentrade quote price latest --symbols NVDA

Review history

opentrade stock price history --symbols AAPL --market us_stock --start-date 20250501 --end-date 20250601 --format json

Watch quotes

opentrade watch --interval 5 --count 3 quote price latest --symbols AAPL --format json

Export data

opentrade quote price history --symbols AAPL --market us_stock --start-date 20250501 --end-date 20250601 --format csv --output aapl-history.csv

More Docs

License

MIT License.

Metadata

Release files for opentrade 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentrade 1.2.0
File Size Uploaded Provenance Actions
opentrade-1.2.0.tar.gz 154.0 kB Without provenance Details for opentrade-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opentrade 1.2.0
File Interpreter ABI Platform Actions
opentrade-1.2.0-py3-none-any.whl Python 3 none any Details for opentrade-1.2.0-py3-none-any.whl

Total release size: 284.8 kB

Release files / opentrade-1.2.0.tar.gz

Download URL opentrade-1.2.0.tar.gz
Size 154.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7b991df3e26cc15183480fb5575018fd624d720a226ffdc68ea003b00281e68c
BLAKE2b-256 checksum
How to use checksums
45227fbbf36492c2c3c37a6ac3168e3d410fc3fcab32825d141fbf2499e2d566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / opentrade-1.2.0-py3-none-any.whl

Download URL opentrade-1.2.0-py3-none-any.whl
Size 130.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
646af76b7ed9237f517ab821fa09f14276cbc4432272258534ee35413da867fc
BLAKE2b-256 checksum
How to use checksums
c69d6b0cb4f0440d1990c0083f1211b343850e7c0c3cc1739c4447daa95fb2d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for opentrade 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page