Skip to main content

OpenFinClaw SDK — Python client & CLI for the DeepAgent API

Project description

OpenFinClaw SDK

AI-powered financial analysis agent. Ask questions in natural language, get professional research reports.

Install

# Recommended (uv)
uv tool install "openfinclaw[cli]"

# Or pip (Python 3.10+, quote the brackets in zsh)
pip install "openfinclaw[cli]"

Update to latest version:

uv cache clean openfinclaw && uv tool install --force "openfinclaw[cli]"

Don't have uv? Install it first: curl -LsSf https://astral.sh/uv/install.sh | sh

Quick Start

CLI (Interactive Terminal)

openfinclaw-cli

Or ask a single question:

openfinclaw-cli "分析宁德时代的投资价值"

Python SDK (Programmatic)

pip install openfinclaw
from openfinclaw import OpenFinClawClient

client = OpenFinClawClient()

# Create a conversation thread
thread = client.create_thread()

# Stream the response
for event in client.stream(thread.id, "分析宁德时代的投资价值"):
    if event.type == "TEXT_DELTA":
        print(event.text, end="", flush=True)

Features

  • Multi-turn conversations — context is preserved across messages
  • Real-time streaming — see the response as it's generated (SSE)
  • 58+ financial skills — stock analysis, macro, crypto, derivatives, backtesting, and more
  • Multi-agent architecture — specialized agents (analyst, researcher, risk manager, strategist) collaborate on your query

CLI Commands

Command Description
/new Create a new conversation thread
/threads List all threads
/history Show message history
/runs Show run history
/cancel Cancel the active run
/help Show available commands
/quit Exit

SDK API Reference

client = OpenFinClawClient(api_key="your-key", base_url="https://api.openfinclaw.ai/agent")

# Thread management
thread = client.create_thread(title="My Analysis")
threads = client.list_threads()

# Messages & Runs
messages = client.list_messages(thread.id)
runs = client.list_runs(thread.id)
client.cancel_run(thread.id, run.id)

# Streaming (returns Iterator[Event])
for event in client.stream(thread.id, "your question"):
    match event.type:
        case "TEXT_DELTA":    print(event.text)       # response text chunk
        case "TOOL_START":    print(event.tool_name)   # tool being called
        case "TOOL_DONE":     ...                      # tool finished
        case "AGENT_HANDOFF": print(event.agent_name)  # agent delegation
        case "RUN_FINISHED":  ...                      # done
        case "ERROR":         print(event.error)       # error occurred

Error Handling

from openfinclaw import OpenFinClawClient, RateLimitError, AuthError

client = OpenFinClawClient()
try:
    for event in client.stream(thread.id, "question"):
        ...
except RateLimitError:
    print("Daily limit reached (30/day)")
except AuthError:
    print("Invalid API key")

Example Use Cases

A-share

You: 300750 宁德时代深度分析 — 固态电池进展和估值
You: 今天A股有哪些热门板块和涨停股?龙虎榜有什么异动?
You: 人形机器人概念还能追吗?当前处于炒作周期的什么阶段?
You: 用双均线策略回测沪深300,过去一年表现如何?

US Stock

You: NVDA 英伟达 Q4 财报分析,AI 算力需求是否见顶?
You: 对比 TSLA vs BYD,谁的估值更有吸引力?
You: 美联储降息周期下,哪些美股板块最受益?

Crypto & Macro

You: BTC 当前处于减半周期的什么阶段?山寨季来了吗?
You: 当前中国宏观经济形势如何?CPI/PPI/PMI 趋势
You: 帮我构建一个攻守兼备的A股ETF组合

Limits

  • 30 requests/day per API key
  • Beta access expires on the date specified by your key

Links

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

openfinclaw-0.2.5.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

openfinclaw-0.2.5-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file openfinclaw-0.2.5.tar.gz.

File metadata

  • Download URL: openfinclaw-0.2.5.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for openfinclaw-0.2.5.tar.gz
Algorithm Hash digest
SHA256 00f577935e40e299745af23c5834c126b50d100fbc939f6d982ee6887c97ad89
MD5 3db4b0ae24ba419b3214680f74b194ee
BLAKE2b-256 ccae98eec46f51ac126f167036cea99c32dc7f52e753a6dac86b7ddb5b13eff5

See more details on using hashes here.

File details

Details for the file openfinclaw-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: openfinclaw-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for openfinclaw-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9a2f06a60cae776a75a2e3a55c2efc223b412def6b4c40c0ccbd4a4bd79f2465
MD5 5263d2204b15b62926decd5c9e7382ec
BLAKE2b-256 a8ac23e60b5f5e22781d805ac0f096e72f799341232de364f4156b82ee3cf5b7

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