Skip to content

echo17666/TradeAnalysisAgent

Repository files navigation

Trade Analysis Agent / 交易分析代理

A professional cryptocurrency trading analysis agent built on the Mastra framework, specialized for analyzing Coinbase trading data.

一个基于 Mastra 框架构建的专业加密货币交易分析代理,专门用于分析 Coinbase 交易数据。

Features / 功能特性

Trading Data Analysis / 交易数据分析

  • Spot Trading Analysis / 现货交易分析 - Analyze Coinbase spot trading historical data / 分析 Coinbase 现货交易历史数据
  • Perpetual Futures Analysis / 永续合约分析 - Analyze INTX perpetual contract trading data / 分析 INTX 永续合约交易数据
  • Smart Product ID Handling / 智能产品ID处理 - Support simplified input (e.g., "BTC", "ETH") and full format / 支持简化输入(如 "BTC", "ETH")和完整格式

Core Analysis Tools / 核心分析工具

  • Profit & Loss Calculation / 盈亏计算 - Calculate detailed P&L for specific time periods / 计算指定时间段的详细盈亏情况
  • Entry & Exit Analysis / 进出场分析 - Analyze buy/sell patterns and position profitability / 分析买入/卖出模式和头寸盈利能力
  • Trading Statistics / 交易统计 - Provide comprehensive trading statistics and performance metrics / 提供全面的交易统计数据和绩效指标
  • Time Range Filtering / 时间范围过滤 - Support filtering trading data by date range / 支持按日期范围筛选交易数据
  • Cryptocurrency Filtering / 加密货币过滤 - Support data analysis by specific digital assets / 支持按特定数字资产进行数据分析

Supported Trading Pairs / 支持的交易对

  • Spot Trading / 现货交易: BTC-USDC, ETH-USDT, and other major trading pairs / 等主流交易对
  • Perpetual Contracts / 永续合约: BTC-PERP-INTX, ETH-PERP-INTX, etc. / 等

Getting Started / 快速开始

Environment Setup / 环境配置

  1. Copy the environment variables template / 复制环境变量模板:
cp .env.example .env
  1. Configure your Coinbase API credentials in the .env file / 在 .env 文件中配置您的 Coinbase API 凭证:
COINBASE_API_KEY=your-api-key-id
COINBASE_API_SECRET_KEY=your-private-key
COINBASE_PERP_API_KEY=your-perp-api-key (optional/可选)
COINBASE_PERP_API_SECRET_KEY=your-perp-private-key (optional/可选)

Start Application / 启动应用

Install dependencies and start the development server / 安装依赖并启动开发服务器:

npm install
npm run dev

Open http://localhost:4111 to access Mastra Studio. You can test the trading analysis agent through the interactive interface and access all features via REST API.

打开 http://localhost:4111 访问 Mastra Studio。您可以通过交互式界面测试交易分析代理,并通过 REST API 访问所有功能。

Usage Examples / 使用示例

Interact with the trading analysis agent through Mastra Studio or API:

通过 Mastra Studio 或 API 与交易分析代理交互:

  • Query BTC spot trading records for specific date ranges / 查询特定日期范围的 BTC 现货交易记录
  • Analyze ETH perpetual contract P&L / 分析 ETH 永续合约的盈亏情况
  • Get overall trading performance statistics / 获取整体交易绩效统计
  • Analyze buy/sell patterns for specific cryptocurrencies / 分析特定币种的买卖模式

Deployment / 部署

Production Build / 生产构建

npm run build

Mastra Cloud Deployment / Mastra Cloud 部署

Mastra Cloud provides a serverless agent environment with atomic deployments. Access your agents from anywhere and monitor performance.

Mastra Cloud 提供无服务器代理环境,支持原子部署。您可以从任何地方访问您的代理并监控性能。

Check out the deployment guide for more details.

查看部署指南了解更多详情。

More Resources / 更多资源

About

Analyze trade from coinbase using mastra framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors