Skip to main content

efinance 命令行终端

Project description

efinance-cli

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

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

Python 3.10+ PyPI package Upstream efinance Default view observation Indicator enrichment

Installation · 30-second start · Command map · Output model · Indicator coverage · Observation examples

English | 简体中文 | 繁體中文

Discoverable
A task-shaped command tree makes it easier to find the right entrypoint than browsing raw upstream functions.
Readable
The CLI keeps terminal output consistent across table, json, csv, and tsv, with observation as the default view.
Indicator-rich
Compatible commands can be enriched with a broad built-in technical-indicator set for screening, review, and downstream analysis.

Installation

Install the published PyPI package the-efinance-cli. The package exposes both efinance and efi.

uv
uv add -U the-efinance-cli
efinance --help
pip
pip install -U the-efinance-cli
efinance --help

Python 3.10+ is required.

What This Tool Is

efinance-cli is a product layer on top of efinance, not a loose script collection.

It reorganizes upstream capability into a public command tree that is easier to browse from a terminal, easier to automate from scripts, and easier to consume in structured output. The goal is not to replace the upstream market-data library. The goal is to make that capability more stable and more usable from a CLI.

30-Second Start

1. Search first
efinance search --query AAPL --market US_stock --result-count 5 --format json
Start here when you only know a ticker, keyword, or company name.
2. Resolve quote_id
efinance resolve quote-id --symbol AAPL --market us_stock --format json
Common US instruments resolve into identifiers such as 105.AAPL.
3. Query market data
efinance stock price history --symbols AAPL --market us_stock --start-date 20250102 --end-date 20250501 --format json
Continue from there into history, latest quotes, watch loops, and export workflows.

Main Functions

Instrument discovery
  • Search instruments by keyword.
  • Resolve symbols into quote_id.
  • Move from discovery into quote and history queries without switching tools.
Cross-asset data access
  • Query stocks, funds, bonds, futures, and market-level live data.
  • Read both latest quotes and historical series.
  • Run refresh loops with one shared watch model.
Structured output
  • Export as table, json, csv, or tsv.
  • Use observation as the default public-facing view.
  • Fallback to raw when downstream consumers need the unwrapped shape.
Indicator enrichment
  • Choose basic, advanced, or full.
  • Expose trend, momentum, volatility, volume, and structure indicators.
  • Produce richer market context for review, screening, and automation.

Command Map

Top-level command Role Typical use
search Keyword-based discovery. Find candidates before you know the exact identifier.
resolve Identifier resolution. Turn a symbol into a reusable quote_id.
quote Cross-asset quote access. Use when the quote_id is already known.
market Market-level queries. Run live scans and market-mapping style lookups.
stock Stock-oriented queries. History, snapshots, live lists, flows, holders, and profiles.
fund Fund-oriented queries. NAV history, live estimates, allocation, managers, and reports.
bond Bond-oriented queries. Profiles, price history, live lists, trades, and flows.
futures Futures-oriented queries. Catalog, history, live quotes, and trade detail.
watch Refresh wrapper. Repeat a supported subcommand on a shared polling loop.

Output Model

Current real defaults
  • --format table
  • --indicator-level advanced
  • --view observation
  • --trace-window 32
Practical notes
  • observation is the default public-facing view.
  • Pass --view raw when you want the unwrapped payload shape.
  • json is usually the best target for downstream programs.
  • full gives richer indicator context than advanced, but costs more work.
Output or runtime flag Purpose
--format table|json|csv|tsv Choose terminal view or export-friendly structured output.
--full Print more complete result content.
--transpose Transpose tabular output for easier terminal reading in some cases.
--no-index Hide row indices in table output.
--limit N Keep only the first N rows in the rendered result.
--output PATH Write the rendered result to a file.
--encoding utf-8 Set file-output encoding.
--watch --interval --count --clear/--no-clear Run supported commands on a refresh loop.

Indicator Coverage

efinance-cli ships with a broad built-in indicator set. Compatible commands can expose far more than raw quotes, which makes the CLI useful for screening, review, and downstream analytics.

Moving averages and base transforms

sma · ema · rma · wma · dema · tema · trima · hma · zlema · highest · lowest · median_price · typical_price · true_range

Trend and channel indicators

macd · bollinger_bands · donchian_channel · keltner_channel · moving_average_envelope · aroon_indicator · dmi · adx · supertrend · parabolic_sar · ichimoku_cloud

Momentum indicators

momentum · roc · rsi · stochastic_oscillator · kdj · cci · williams_r · trix · tsi · ultimate_oscillator · dpo · ppo

Volume and money-flow indicators

obv · accumulation_distribution · chaikin_money_flow · chaikin_oscillator · mfi · vwap · force_index · ease_of_movement · price_volume_trend · volume_ratio

Volatility indicators

atr · natr · historical_volatility · chaikin_volatility · mass_index

Price-structure indicators

pivot_points · fibonacci_retracement · rolling_support_resistance

Common Chinese-market technical indicators

bias · bbi · psy · vr · mtm · dma · brar · cr · emv · asi

Level What it gives you in practice
basic The core trend and momentum set 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, ADL, Chaikin Oscillator, Chaikin Volatility, and EMV.

Observation Examples

The examples below only show the public-facing observation format.

Latest quote observation

Command

efinance quote price latest --quote-ids 105.AAPL --format table --indicator-level full --trace-window 4

Typical output

+-----------------------------+
| meta                        |
+-----------------------------+
| module: common              |
| function: get_quote_history |
| view: observation           |
| indicator_level: full       |
| trace_window: 4             |
| row_count: 4                |
| code: AAPL                  |
| name: Apple Inc.            |
| as_of: 2026-05-28           |
+-----------------------------+

+------------------+
| latest_quote     |
+------------------+
| code: AAPL       |
| name: Apple Inc. |
| date: 2026-05-28 |
| close: 106       |
| open: 105        |
| high: 107        |
| low: 104         |
| volume: 1700     |
+------------------+

+---------------------+
| current_metrics     |
+---------------------+
| close: 106          |
| open: 105           |
| high: 107           |
| low: 104            |
| volume: 1700        |
| ma5: 103            |
| ma10: 102.5         |
| macd_dif: 0.36      |
| macd_dea: 0.26      |
| rsi14: 59           |
+---------------------+

+-----------------------------------+
| trace_points.price_ma             |
+-----------------------------------+
| [block 1] bar_offset: -3 -> 0     |
| bar_offset: -3 | -2 | -1 | 0      |
| close: 100 | 102 | 104 | 106      |
| ma5: 99.8 | 100.5 | 102 | 103     |
| ma10: 100.1 | 100.4 | 101 | 102.5 |
+-----------------------------------+

+-------------------------------------------------------------+
| recent_events                                               |
+-------------------------------------------------------------+
| [1] bars_ago: -2                                            |
|     event_key: ma5_crossed_above_ma10                       |
|     subject_a: ma5                                          |
|     relation: crossed_above                                 |
|     subject_b: ma10                                         |
|     description: ma5 moved from below to above ma10         |
| prev_a: 99.8   prev_b: 100.1   curr_a: 100.5   curr_b:      |
| 100.4                                                     |
+-------------------------------------------------------------+
History observation

Command

efinance stock price history --symbols AAPL --market us_stock --start-date 20250102 --end-date 20250501 --format table --indicator-level advanced --trace-window 4

Typical output

+-----------------------------+
| meta                        |
+-----------------------------+
| module: common              |
| function: get_quote_history |
| view: observation           |
| indicator_level: full       |
| trace_window: 4             |
| row_count: 4                |
| code: AAPL                  |
| name: Apple Inc.            |
| as_of: 2026-05-28           |
+-----------------------------+

+---------------------+
| current_metrics     |
+---------------------+
| close: 106          |
| ma5: 103            |
| ma10: 102.5         |
| ma20: 101.4         |
| ema12: 102.9        |
| ema26: 101.7        |
| macd_dif: 0.36      |
| macd_dea: 0.26      |
| rsi14: 59           |
| kdj_k: 62           |
| kdj_d: 60           |
| plus_di: 28         |
| minus_di: 16        |
| adx: 28             |
+---------------------+

+---------------------------------------+
| trace_points.macd_osc                 |
+---------------------------------------+
| [block 1] bar_offset: -3 -> 0         |
| bar_offset: -3 | -2 | -1 | 0          |
| macd_dif: 0.05 | 0.2 | 0.28 | 0.36    |
| macd_dea: -0.02 | 0.08 | 0.18 | 0.26  |
| rsi14: 51 | 54 | 56 | 59              |
| kdj_k: 50 | 55 | 60 | 62              |
| kdj_d: 47 | 52 | 57 | 60              |
+---------------------------------------+

+-------------------------------------------------------------+
| recent_events                                               |
+-------------------------------------------------------------+
| [1] bars_ago: 0                                             |
|     event_key: volume_ratio_5_crossed_above_1               |
|     subject_a: volume_ratio_5                               |
|     relation: crossed_above                                 |
|     subject_b: 1.0                                          |
|     description: volume_ratio_5 moved from at-or-below to   |
|     above 1                                                 |
| prev_a: 1   prev_b: 1   curr_a: 1.3   curr_b: 1             |
+-------------------------------------------------------------+
Multi-source fund observation

Command

efinance fund nav history-batch --symbols 161725 --symbols 005827 --format table --view observation --trace-window 4

Typical output

+---------------+
| source.161725 |
+---------------+

+-----------------------------+
| meta                        |
+-----------------------------+
| module: common              |
| function: get_quote_history |
| view: observation           |
| indicator_level: full       |
| trace_window: 4             |
| row_count: 4                |
| code: AAPL                  |
| name: Apple Inc.            |
| as_of: 2026-05-28           |
+-----------------------------+

+------------------+
| latest_quote     |
+------------------+
| code: AAPL       |
| name: Apple Inc. |
| date: 2026-05-28 |
| close: 106       |
+------------------+

+---------------+
| source.005827 |
+---------------+

+-----------------------------+
| meta                        |
+-----------------------------+
| module: common              |
| function: get_quote_history |
| view: observation           |
| indicator_level: full       |
| trace_window: 4             |
| row_count: 4                |
| code: AAPL                  |
| name: Apple Inc.            |
| as_of: 2026-05-28           |
+-----------------------------+

+------------------+
| latest_quote     |
+------------------+
| code: AAPL       |
| name: Apple Inc. |
| date: 2026-05-28 |
| close: 106       |
+------------------+

Common Workflows

Search and inspect
efinance search --query NVDA --market US_stock
efinance resolve quote-id --symbol NVDA --market us_stock
efinance quote price latest --quote-ids 105.NVDA
Watch a quote
efinance watch --interval 5 --count 3 quote price latest --quote-ids 105.AAPL --format json
Batch fund history
efinance fund nav history-batch --symbols 161725 --symbols 005827 --format json
Market-level live scan
efinance market price live --market m:105+t:3 --format json

Notes

Data-source boundaries
  • The CLI depends on upstream market-data availability.
  • Realtime stability depends on network conditions and source-side behavior.
  • Some commands support richer indicator enrichment than others.
Usage boundaries
  • Use side-effect commands such as report download intentionally.
  • Prefer json when another program will consume the result.
  • Prefer observation when a human or agent needs concise market context instead of raw tables.

License

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

the_efinance_cli-0.2.0.tar.gz (73.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

the_efinance_cli-0.2.0-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

Details for the file the_efinance_cli-0.2.0.tar.gz.

File metadata

  • Download URL: the_efinance_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for the_efinance_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8e8216c5e50b2a6cb6030e0f2fa91341321fbae33833c4c0b1beaf72f07c115b
MD5 2b9ad07360c05d335d3c68917d7696e7
BLAKE2b-256 c270cdc58495a9277e3f67182081e870873c48574a0d390c1b6aa35a4668788e

See more details on using hashes here.

File details

Details for the file the_efinance_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: the_efinance_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 59.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for the_efinance_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9229f05ceacccad4550ebf10fc85a00d1e8cc708ec077bcee24a2932103d764
MD5 976a6c4da6ddbbffd3cfb6ffa0199a8d
BLAKE2b-256 714fc0547359af5277f80e92937ac46286b5209275acb58abe93cf473c758d4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page