revolut-trading

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Revolut Trading Skill

Revolut交易技能指南

This skill provides tools and documentation for interacting with the Revolut X Crypto Exchange API.
本技能提供了与Revolut X加密货币交易所API交互的工具及文档。

Capabilities

功能特性

  • Authentication: Securely authenticate using Ed25519 key pairs.
  • Market Data: Fetch real-time market data including order books, trades, and candles.
  • Trading: Place, cancel, and manage orders.
  • Account Management: Retrieve account balances and transaction history.
  • 身份验证:使用Ed25519密钥对进行安全身份验证。
  • 市场数据:获取实时市场数据,包括订单簿、交易记录及K线数据。
  • 交易操作:下单、撤单及管理订单。
  • 账户管理:查询账户余额及交易历史。

Quick Start

快速开始

1. Authentication

1. 身份验证

To use the API, you need an API Key and a private key. See 00_api_overview_and_authentication.md for details on generating keys.
使用API前,你需要API密钥和私钥。有关密钥生成的详细信息,请参阅00_api_overview_and_authentication.md

2. Using the Python Client

2. 使用Python客户端

A Python client wrapper is provided in
scripts/revolut_client.py
. This script handles authentication and request signing for you.
Example Usage:
python
from scripts.revolut_client import RevolutClient
scripts/revolut_client.py
中提供了Python客户端封装工具,该脚本会自动处理身份验证和请求签名。
使用示例:
python
from scripts.revolut_client import RevolutClient

Initialize the client

初始化客户端

client = RevolutClient( private_key_path="path/to/private_key.pem", api_key="your_api_key" )
client = RevolutClient( private_key_path="path/to/private_key.pem", api_key="your_api_key" )

Get all currencies

获取所有币种

currencies = client.get_currencies() print(currencies)
currencies = client.get_currencies() print(currencies)

Get account balances

获取账户余额

balances = client.get_balances() print(balances)
balances = client.get_balances() print(balances)

Place a limit order

下限价单

order = client.place_order( client_order_id="unique_id_123", symbol="BTC-USD", side="buy", order_configuration={ "limit": { "price": "50000", "base_size": "0.001" } } ) print(order)
undefined
order = client.place_order( client_order_id="unique_id_123", symbol="BTC-USD", side="buy", order_configuration={ "limit": { "price": "50000", "base_size": "0.001" } } ) print(order)
undefined

API Reference

API参考文档

For detailed API documentation, refer to the following files:
有关详细的API文档,请参阅以下文件:

General

通用类

  • Overview & Authentication
  • 概述与身份验证

Market Data

市场数据类

  • Get All Currencies
  • Get All Currency Pairs
  • Get Order Book
  • Get Last Trades
  • Get Historical OHLCV Candles
  • Get All Tickers
  • Get All Public Trades
  • 获取所有币种
  • 获取所有交易对
  • 获取订单簿
  • 获取最新交易记录
  • 获取历史OHLCV K线数据
  • 获取所有行情报价
  • 获取所有公开交易记录

Account & Trading

账户与交易类

  • Get All Balances
  • Place Order
  • Get Active Orders
  • Get Historical Orders
  • Get Order By ID
  • Cancel Order By ID
  • Get Fills of Order By ID
  • Get Client Trades
  • 获取所有账户余额
  • 下单
  • 获取活跃订单
  • 获取历史订单
  • 按ID查询订单
  • 按ID撤单
  • 按ID查询订单成交明细
  • 获取客户交易记录

Common Workflows

常见工作流

Fetching Market Data

获取市场数据

To analyze the market before trading, use the Market Data endpoints.
  • Use
    Get All Tickers
    for a quick overview of prices.
  • Use
    Get Order Book
    to see depth and liquidity.
  • Use
    Get Historical OHLCV Candles
    for technical analysis.
交易前分析市场可使用市场数据相关端点:
  • 使用
    获取所有行情报价
    快速查看价格概况。
  • 使用
    获取订单簿
    查看市场深度及流动性。
  • 使用
    获取历史OHLCV K线数据
    进行技术分析。

Placing an Order

下单流程

  1. Check Balance: Ensure you have sufficient funds using
    Get All Balances
    .
  2. Determine Price: Use Market Data endpoints to decide on a price.
  3. Place Order: Use
    Place Order
    with a unique
    client_order_id
    .
  4. Monitor Order: Use
    Get Order By ID
    or
    Get Active Orders
    to track status.
  1. 检查余额:使用
    获取所有账户余额
    确保有足够资金。
  2. 确定价格:通过市场数据端点确定交易价格。
  3. 提交订单:使用
    下单
    接口并传入唯一的
    client_order_id
  4. 监控订单:使用
    按ID查询订单
    获取活跃订单
    跟踪订单状态。

Error Handling

错误处理

The API returns standard HTTP status codes.
  • 400 Bad Request
    : Check your parameters.
  • 401 Unauthorized
    : Check your API key and signature.
  • 429 Too Many Requests
    : You are being rate-limited. Back off and retry.
API返回标准HTTP状态码:
  • 400 Bad Request
    :检查请求参数是否正确。
  • 401 Unauthorized
    :检查API密钥和签名是否有效。
  • 429 Too Many Requests
    :请求过于频繁,需暂停并重试。