← 返回 Skills 市场
alexander-panov

Finam

作者 Alexander Panov · GitHub ↗ · v1.0.4 · MIT-0
cross-platform ✓ 安全检测通过
906
总下载
1
收藏
2
当前安装
15
版本数
在 OpenClaw 中安装
/install finam
功能描述
Execute trades, manage portfolios, access real-time market data, browse and search market assets, scan volatility, and answer questions about Finam Trade API
使用说明 (SKILL.md)

Finam Trade API Skill

Setup

Prerequisites: $FINAM_API_KEY and $FINAM_ACCOUNT_ID must be already set in your environment.

If not configured by environment, follow these steps:

  1. Register and obtain your API Key from tokens page
  2. Obtain your Account ID from your Finam account dashboard
  3. Set environment variables:
export FINAM_API_KEY="your_api_key_here"
export FINAM_ACCOUNT_ID="your_account_id_here"

Obtain JWT token before using the API:

export FINAM_JWT_TOKEN=$(curl -sL "https://api.finam.ru/v1/sessions" \
--header "Content-Type: application/json" \
--data '{"secret": "'"$FINAM_API_KEY"'"}' | jq -r '.token')

Note: Token expires after 15 minutes. Re-run this command if you receive authentication errors.

Market assets

List Available Exchanges and Equities

Symbol Format: All symbols must be in ticker@mic format (e.g., SBER@MISX) Base MIC Codes:

  • MISX - Moscow Exchange
  • RUSX - RTS
  • XNGS - NASDAQ/NGS
  • XNMS - NASDAQ/NNS
  • XNYS - New York Stock Exchange

View all supported exchanges with their MIC codes:

jq -r '.exchanges[] | "\(.mic) - \(.name)"' assets/exchanges.json

List stocks available on a specific exchange:

MIC="MISX"
LIMIT=20
jq -r ".$MIC[:$LIMIT] | .[] | \"\(.symbol) - \(.name)\"" assets/equities.json

Get Asset Specification

Fetch detailed specification for a specific instrument (lot size, price step, decimals, trading schedule, etc.):

SYMBOL="SBER@MISX"
curl -sL "https://api.finam.ru/v1/assets/$SYMBOL?account_id=$FINAM_ACCOUNT_ID" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

account_id is optional but recommended — returns account-specific fields (margin, available quantity, etc.).

Search Assets

Search instruments by ticker glob pattern and/or name substring:

# By ticker glob
python3 scripts/asset_search.py 'SBER*'

# By name (case-insensitive substring)
python3 scripts/asset_search.py --name 'apple'

# By ticker glob + type filter
python3 scripts/asset_search.py 'NG*' --type FUTURES

# Search across all instruments (including archived) via /assets/all
python3 scripts/asset_search.py 'NG*' --type FUTURES --active false

Available types: EQUITIES, FUTURES, BONDS, FUNDS, SPREADS, OTHER, CURRENCIES, OPTIONS, SWAPS, INDICES

--max=N switches to GET /v1/assets/all with pagination (rate limit: 200 req/min). --active false includes archived instruments.

Get Top N Stocks by Volume

Pre-ranked lists of the 100 most liquid equities for each market, ordered by trading volume descending:

N=10
jq -r ".[:$N] | .[] | \"\(.ticker) - \(.name)\"" assets/top_ru_equities.json
N=10
jq -r ".[:$N] | .[] | \"\(.ticker) - \(.name)\"" assets/top_us_equities.json

Account Management

Get Account Portfolio

Retrieve portfolio information including positions, balances, and P&L:

curl -sL "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Market Data

Get Latest Quote

Retrieve current bid/ask prices and last trade:

SYMBOL="SBER@MISX"
curl -sL "https://api.finam.ru/v1/instruments/$SYMBOL/quotes/latest" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Get Order Book (Depth)

View current market depth with bid/ask levels:

SYMBOL="SBER@MISX"
curl -sL "https://api.finam.ru/v1/instruments/$SYMBOL/orderbook" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Get Recent Trades

List the most recent executed trades:

SYMBOL="SBER@MISX"
curl -sL "https://api.finam.ru/v1/instruments/$SYMBOL/trades/latest" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Get Historical Candles (OHLCV)

Retrieve historical price data with specified timeframe:

SYMBOL="SBER@MISX"
TIMEFRAME="TIME_FRAME_D"
START_TIME="2024-01-01T00:00:00Z"
END_TIME="2024-04-01T00:00:00Z"
curl -sL "https://api.finam.ru/v1/instruments/$SYMBOL/bars?timeframe=$TIMEFRAME&interval.start_time=$START_TIME&interval.end_time=$END_TIME" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Available Timeframes:

Timeframe Description Max data depth (end_time - start_time)
TIME_FRAME_UNSPECIFIED Not specified
TIME_FRAME_M1 1 minute 7 days
TIME_FRAME_M5 5 minutes 30 days
TIME_FRAME_M15 15 minutes 30 days
TIME_FRAME_M30 30 minutes 30 days
TIME_FRAME_H1 1 hour 30 days
TIME_FRAME_H2 2 hours 30 days
TIME_FRAME_H4 4 hours 30 days
TIME_FRAME_H8 8 hours 30 days
TIME_FRAME_D Day 365 days
TIME_FRAME_W Week ~5 years
TIME_FRAME_MN Month ~5 years
TIME_FRAME_QR Quarter ~5 years

Note: The max data depth is the maximum allowed range for end_time - start_time. If the range exceeds the limit, the API returns empty data.

Date Format (RFC 3339):

  • Format: YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+HH:MM
  • start_time - Inclusive (interval start, included in results)
  • end_time - Exclusive (interval end, NOT included in results)
  • Examples:
    • 2024-01-15T10:30:00Z (UTC)
    • 2024-01-15T10:30:00+03:00 (Moscow time, UTC+3)

News

Get Latest Market News

Fetch and display the latest news headlines. No JWT token required.

Russian market news

curl -sL "https://www.finam.ru/analysis/conews/rsspoint/" | python3 -c "
import sys, xml.etree.ElementTree as ET
root = ET.parse(sys.stdin).getroot()
for item in reversed(root.findall('.//item')):
    print(f'* {item.findtext('title','')}. {item.findtext('description','').split('...')[0]}')
"

US market news

curl -sL "https://www.finam.ru/international/advanced/rsspoint/" | python3 -c "
import sys, xml.etree.ElementTree as ET
root = ET.parse(sys.stdin).getroot()
for item in reversed(root.findall('.//item')):
    print(f'* {item.findtext('title','')}. {item.findtext('description','').split('...')[0]}')
"

Parameters:

  • Change [:10] to any number to control how many headlines to display

Order Management

IMPORTANT: Before placing or cancelling any order, you MUST explicitly confirm the details with the user and receive their approval. State the full order parameters (symbol, side, quantity, type, price) and wait for confirmation before executing.

Place Order

Order Types:

  • ORDER_TYPE_MARKET - Market order (executes immediately, no limit_price required)
  • ORDER_TYPE_LIMIT - Limit order (requires limit_price)
curl -sL "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID/orders" \
  --header "Authorization: $FINAM_JWT_TOKEN" \
  --header "Content-Type: application/json" \
  --data "$(jq -n \
    --arg symbol   "SBER@MISX" \
    --arg quantity "10" \
    --arg side     "SIDE_BUY" \
    --arg type     "ORDER_TYPE_LIMIT" \
    --arg price    "310.50" \
    '{symbol: $symbol, quantity: {value: $quantity}, side: $side, type: $type, limit_price: {value: $price}}')" \
  | jq

Parameters:

  • symbol - Instrument (e.g., SBER@MISX)
  • quantity.value - Number of shares/contracts
  • side - SIDE_BUY or SIDE_SELL
  • type - ORDER_TYPE_MARKET or ORDER_TYPE_LIMIT
  • limit_price - Only for ORDER_TYPE_LIMIT (omit for market orders)

Get Order Status

Check the status of a specific order:

ORDER_ID="12345678"
curl -sL "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID/orders/$ORDER_ID" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Cancel Order

Cancel a pending order:

ORDER_ID="12345678"
curl -sL --request DELETE "https://api.finam.ru/v1/accounts/$FINAM_ACCOUNT_ID/orders/$ORDER_ID" \
  --header "Authorization: $FINAM_JWT_TOKEN" | jq

Volatility Scanner

Scans the top-100 stocks for a given market and prints the most volatile ones based on annualized historical volatility (close-to-close, last 60 days).

Usage:

python3 scripts/volatility.py [ru|us] [N]

Arguments:

  • ru / us — market to scan (default: ru)
  • N — number of top results to display (default: 10)

Examples:

# Top 10 most volatile Russian stocks
python3 scripts/volatility.py ru 10

# Top 5 most volatile US stocks
python3 scripts/volatility.py us 5

All scripts support --help for usage details (e.g. python3 scripts/volatility.py --help).

REST vs gRPC — When to Use Which

Use REST when:

  • Fetching historical OHLCV data for backtesting or analysis
  • Retrieving account info, positions, balances, and trade history
  • Searching instruments or fetching asset specifications
  • Placing or cancelling a one-off order where 100–200 ms latency is acceptable
  • Checking order status after placement

Use gRPC when:

  • Subscribing to real-time market data: quotes, order book, trade feed
  • Processing live bar data (M1, M5) for signal generation in event-driven strategies
  • Monitoring own orders and trades in real time via subscription
  • Your strategy requires minimal latency for rapid order placement/cancellation
  • Building long-running trading bots that need persistent, auto-reconnecting connections

For gRPC, use the FinamPy Python library ( pip install git+https://github.com/cia76/FinamPy.git). Full usage reference: gRPC Python Reference


For full REST API details, use the local file: REST Reference For extra gRPC API details, fetch from: gRPC Reference

安全使用建议
This skill appears to be a legitimate Finam Trade API client. Before installing, be aware that: (1) FINAM_API_KEY is sensitive — anyone with it can obtain JWTs and interact with your trading account, so store it securely; (2) running the included scripts (especially --active false or pagination over /assets/all and the volatility scanner) can generate many API requests and may hit rate limits or trigger account activity; (3) the skill will suggest exporting a short-lived JWT (FINAM_JWT_TOKEN) to your shell for convenience — only do that in trusted shells and sessions. If you only need read-only market data, consider using an API key/account with limited privileges if Finam supports that.
功能分析
Type: OpenClaw Skill Name: finam Version: 1.0.4 The skill bundle provides a legitimate interface for the Finam Trade API, allowing users to manage portfolios, fetch market data, and execute trades. The code in `scripts/utils.py`, `scripts/asset_search.py`, and `scripts/volatility.py` correctly interacts with official Finam API endpoints (api.finam.ru) and handles sensitive credentials via environment variables. Notably, `SKILL.md` includes a safety instruction requiring the AI agent to obtain explicit user confirmation before executing any trade orders, which mitigates the risk of unauthorized financial transactions.
能力标签
cryptorequires-sensitive-credentials
能力评估
Purpose & Capability
Name/description, required binaries (curl, jq, python3), required env vars (FINAM_API_KEY, FINAM_ACCOUNT_ID), included scripts, and referenced endpoints (api.finam.ru, finam.ru, FinamPy GitHub) all align with a Finam Trade API client. The provided assets and reference docs match the described functionality.
Instruction Scope
SKILL.md instructs the agent to obtain a JWT from Finam and then call Finam REST endpoints or run bundled Python scripts. The scripts only access the Finam API and local asset files; they do not read unrelated system paths or request unrelated credentials. Note: the scripts may perform many API requests (e.g., fetching /assets/all or scanning top-100 tickers) and will surface account-specific data when FINAM_API_KEY / ACCOUNT_ID are used, which is expected for this purpose.
Install Mechanism
No install spec is provided (instruction-only), so nothing is downloaded or installed by the skill itself. The skill expects standard binaries already present (curl, jq, python3) which is proportionate to the task.
Credentials
The skill only requires FINAM_API_KEY and FINAM_ACCOUNT_ID, which are the reasonable credentials for this API. Treat FINAM_API_KEY as sensitive: it can be used to obtain short-lived JWTs and perform account operations (including trades) per the API. The helper will optionally store a JWT in FINAM_JWT_TOKEN (process environment or user-exported shell variable) for convenience.
Persistence & Privilege
always is false and the skill does not request system-wide config or other skills' credentials. The scripts set FINAM_JWT_TOKEN in the process environment (and examples show exporting it in the shell) but do not attempt to modify other skills or global agent configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install finam
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /finam 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.4
- Fixed parameter and field names in API query examples for consistency (e.g., `accountId` → `account_id`, `limitPrice` → `limit_price`, `startTime` → `start_time`). - Updated historical candles (OHLCV) section with a new table of timeframes and their max data depth limits. - Clarified usage of timeframe date parameters and provided guidance on valid ranges. - Improved accuracy of several API command examples.
v1.0.3
- Added "Get Asset Specification" section with instructions to fetch detailed instrument specification via the Finam Trade API. - The new section documents how to retrieve instrument details such as lot size, price step, decimals, and trading schedule. - No other major changes detected.
v1.0.2
- Added gRPC API reference file: references/GRPC.md - Expanded documentation to include a new section: "REST vs gRPC — When to Use Which" - No changes made to code or functionality; update is documentation-only
v1.0.1
- Added advanced asset search capability via the new asset_search.py script, supporting ticker glob, name substring, type filter, active/archived toggle, and pagination. - Removed static asset lists (assets/equities.json, assets/openapi.json) in favor of dynamic, script-based asset discovery. - Updated documentation: asset search and filtering examples now use scripts/asset_search.py and explain new options. - Added REST API reference file (references/REST.md) and utility scripts (scripts/utils.py). - All scripts now support --help for usage details.
v1.0.0
Initial release of the Finam Trade API skill. - Execute trades and manage portfolios via Finam's API. - Access real-time market data: quotes, order books, historical candles, and trades. - Browse and search market assets across MIC exchanges; fetch top equities by volume. - Run scripts to scan for volatility among Russian or US stocks. - Retrieve the latest Russian and US financial news headlines. - Order placement, status, and cancellation with explicit confirmation required.
v0.0.10
No changes detected in this version. - No file changes were made for version 0.0.10. - Functionality, usage, and documentation remain identical to the previous release.
v0.0.9
- Improved setup instructions with clearer prerequisites and step-by-step environment variable configuration. - Added API key and account ID acquisition guidance for first-time users. - Enhanced clarity for environment setup to prevent authentication issues. - No changes to functionality, endpoints, or usage examples.
v0.0.8
No user-visible changes in this version. - No file changes were detected.
v0.0.7
- Added OpenAPI schema (assets/openapi.json) for comprehensive Finam Trade API reference. - Updated skill description to include answering questions about the Finam Trade API. - Mentioned the new OpenAPI reference in documentation. - Removed "primaryEnv" from metadata. - No changes to functionality or setup steps.
v0.0.6
No changes detected in this version. - This release does not include any file changes or updates.
v0.0.5
- Added a "News" section with commands to fetch the latest Russian and US market news headlines (no authentication required). - Updated order management instructions: now requires explicit user approval with full order details before placing or cancelling any order. - Minor improvements to order placement command for greater clarity and safety confirmation. - No code changes; documentation only.
v0.0.4
- Replaced top100 equity sample files with new top_ru_equities.json and top_us_equities.json. - Updated documentation to match new data asset file names for top equities. - Refined and clarified shell usage examples for searching, listing, and working with market assets. - Minor documentation improvements for clarity and usability. - Added python3 to requirements for volatility scanning scripts.
v0.0.3
- Added pre-ranked lists for the 100 most liquid Russian and US equities by trading volume. - Introduced a volatility scanner script (volatility.py) to identify the most volatile stocks among the top-100 equities. - Updated documentation to include examples for retrieving top stocks by volume and using the new volatility scanner. - Removed the OpenAPI reference file (assets/openapi.json).
v0.0.2
- Added explicit instructions and examples for date/time formatting (RFC 3339) to the "Get Historical Candles (OHLCV)" section. - Clarified the inclusivity/exclusivity rules for `startTime` and `endTime` in candle queries. - Improved formatting of multi-line shell commands in the setup instructions. - No functional or API changes; documentation improvements only.
v0.0.1
Initial release: Access trading, portfolio management, and real-time market data via Finam Trade API. - Provides commands for executing trades, viewing portfolios, and real-time quotes. - Supports order placement, order status checks, and cancellations. - Includes endpoints for recent trades, order book data, and historical OHLCV candles. - Offers reference data utilities to list supported exchanges and equities by market. - Requires `curl`, `jq`, and environmental variables for API key and account ID.
元数据
Slug finam
版本 1.0.4
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 15
常见问题

Finam 是什么?

Execute trades, manage portfolios, access real-time market data, browse and search market assets, scan volatility, and answer questions about Finam Trade API. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 906 次。

如何安装 Finam?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install finam」即可一键安装,无需额外配置。

Finam 是免费的吗?

是的,Finam 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Finam 支持哪些平台?

Finam 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Finam?

由 Alexander Panov(@alexander-panov)开发并维护,当前版本 v1.0.4。

💬 留言讨论