Tradier交易API工具集

提供Tradier交易API的Python库、LangChain工具和MCP服务器实现,覆盖市场数据、账户管理、订单操作和观察列表功能。

  • by lyzetam
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 lyzetam/mcp-tradier

使用说明

mcp交易员

将API交易为Python库、LangChain工具和MCP服务器。

特性

  • 16 LangChain工具 与LangChain/LangGraph代理一起使用
  • 16个MCP工具 用于Claude Code和其他MCP客户端
  • 模块化操作层 可用作独立的Python库
  • 封面 市场数据, 账户, 订单,以及 收看列表

MCP工具

类别 工具
市场数据 get_quotes, get_option_chain, get_option_expirations, get_historical_prices, search_symbols
账户 get_account_balance, get_positions, get_orders, get_order
订单 place_equity_order, place_option_order, cancel_order, modify_order
观察名单 get_watchlists, create_watchlist, add_to_watchlist

LangChain工具

类别 工具
市场数据 tradier_quotes, tradier_option_chain, tradier_option_expirations, tradier_historical, tradier_search
账户 tradier_balance, tradier_positions, tradier_orders, tradier_order
订单 tradier_place_equity, tradier_place_option, tradier_cancel, tradier_modify
观察名单 tradier_watchlists, tradier_create_watchlist, tradier_add_to_watchlist

安装

# Core library only (httpx)
pip install .

# With MCP server support
pip install ".[mcp]"

# With LangChain tools
pip install ".[langchain]"

# Everything
pip install ".[all]"

配置

所有设置都是从环境变量中读取的 TRADIER_ 前缀,或来自 .env 文件。

变量 描述 默认值
TRADIER_API_KEY Tradier API密钥 ""
TRADIER_ACCOUNT_ID Tradier帐户ID ""
TRADIER_BASE_URL Tradier API基础URL https://api.tradier.com

快速开始

作为Python库

from mcp_tradier.client import TradierClient
from mcp_tradier.operations import market_data, account

client = TradierClient()
quotes = market_data.get_quotes(client, "AAPL,GOOGL")
positions = account.get_positions(client)

作为LangChain工具

from mcp_tradier.langchain_tools import TOOLS

# Use with a LangChain agent
agent = create_react_agent(llm, TOOLS)

作为MCP服务器

mcp-tradier

.env 例子

TRADIER_API_KEY=your-api-key
TRADIER_ACCOUNT_ID=your-account-id
TRADIER_BASE_URL=https://sandbox.tradier.com

许可证

麻省理工学院