ccxt-rest

授权协议 MIT License
开发语言 Python
所属分类 应用工具、 IM/聊天/语音工具
软件类型 开源软件
地区 不详
投 递 者 伍嘉
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

CCXT-REST

Connect to 100+ Crypto Currency eXchange Trading platforms using the same REST API!

Table of Contents

Introduction

CCXT-REST provides a Unified REST APIs to allow clients access to retrieve data (ticker, order book, trades, your order, your trades, balances, etc) and to create and cancel orders from over 100 cryptocurrency exhange sites. And it is built on top of the popular open source project CCXT

Installation

You can install either through docker or as a global node package

Docker

$ docker run -p 3000:3000 ccxtrest/ccxt-rest

NPM Package

$ npm install -g ccxt-rest
$ ccxt-rest

Getting Started

CCXT-REST supports over 100 crytpocurrency exchange sites. If you want to access public data, for most exchanges, you can access them directly without any API Keys or Secret.

  • GET:/exchanges/{exchangeName}/markets
  • GET:/exchanges/{exchangeName}/ticker
  • GET:/exchanges/{exchangeName}/tickers
  • GET:/exchanges/{exchangeName}/orderBook
  • GET:/exchanges/{exchangeName}/trades

In binance, it would look something like this

  • GET:/exchanges/binance/markets
  • GET:/exchanges/binance/ticker?symbol=BTC/USDT
  • GET:/exchanges/binance/tickers
  • GET:/exchanges/binance/orderBook?symbol=BTC/USDT
  • GET:/exchanges/binance/trades?symbol=BTC/USDT

However, some exchanges though require you to have an API Key and Secret even when accessing public data. For example, for cointiger, you would need to get an API Key and Secret first from cointiger see cointiger's official documentation for more info, and then you would need to provide those to ccxt-rest

  • POST:/exchanges/cointiger -d {"id":"myCoinTiger","apiKey":"myApiKey","secret":"$hcreT"}
  • GET:/exchanges/cointiger/markets -H 'Authorization: Bearer xxx.yyy.zzz'(where xxx.yyy.zzz was part of the response of POST:/exchanges/cointiger)
  • GET:/exchanges/cointiger/ticker?symbol=BTC/LTC -H 'Authorization: Bearer xxx.yyy.zzz'
  • GET:/exchanges/cointiger/tickers -H 'Authorization: Bearer xxx.yyy.zzz'
  • GET:/exchanges/cointiger/orderBook?symbol=BTC/LTC -H 'Authorization: Bearer xxx.yyy.zzz'
  • GET:/exchanges/cointiger/trades?symbol=BTC/LTC -H 'Authorization: Bearer xxx.yyy.zzz'

Lastly, for private data like your user orders, trades, balances and for actions like placing and cancelling orders, you would definitely need to provide the API Key and Secret for your exchange to ccxt-rest.

CCXT-REST Overview


Note: The API listing below is now comprehensive. For a full list of APIs supported, see https://ccxt-rest.io


Providing API Keys and Secret

$ curl -X POST http://localhost:3000/exchange/binance \
  -H 'Accept: application/json'
  -d {
    "id" : "myBinance",
    "apiKey" : "myApiKey",
    "secret" : "s3cr3t"
  }

This would then return something like this

{
  "token":"xxx.yyy.zzz"
}

List All Supported Currency Pairs

$ curl -X GET http://localhost:3000/exchange/binance/markets \
  -H 'Accept: application/json'

Get Ticker for a Currency Pair

$ curl -X GET http://localhost:3000/exchange/binance/ticker?symbol=BTC/USDT \
  -H 'Accept: application/json'

Get Order Book for a Currency Pair

$ curl -X GET http://localhost:3000/exchange/binance/orderBook?symbol=BTC/USDT \
  -H 'Accept: application/json'

Placing an Order

$ curl -X POST http://localhost:3000/exchange/binance/order \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxx.yyy.zzz'
  -d {
  "symbol": "string",
  "type": "market",
  "side": "buy",
  "amount": 0,
  "price": 0
}

Cancelling an Order

Note: 12345 is the id of the order you want to cancel

$ curl -X DELETE http://localhost:3000/exchange/binance/order/12345 \
  -H 'Accept: application/json'
  -H 'Authorization: Bearer xxx.yyy.zzz'

API

For a complete list of API, see https://ccxt-rest.io

CCXT-REST API Documentation

Exchange Summary

For a full list of supported exchanges and as to which of their APIs are public, private or even broken, checkout https://ccxt-rest.io/docs/exchange_api_status. The format there looks something like this

Note: The table below is just an example. This does NOT represent the current state of these API statuses

Exchange Connect Market Ticker Tickers Order Book Trades
... ... ... ... ... ... ...
(sample only) (sample only) (sample only) (sample only) (sample only) (sample only) (sample only)
binance
coinspot
gemini
kraken
poloniex
(sample only) (sample only) (sample only) (sample only) (sample only) (sample only) (sample only)
... ... ... ... ... ... ...

Note: The table above is just an example. This does NOT represent the current state of these API statuses

For full list of the current statuses, see https://ccxt-rest.io/docs/exchange_api_status

Feature / Support Request

Need a feature or need support? Reach out and let us know what you need.

  •   REST首次出现在 2000 年 Roy Fielding 的博士论文中的一种软件架构风格。可以降低开发的复杂性,提高系统的可伸缩性。 一、资源   REST中可以命名的任何信息都可以是资源,如user、order等,通常表示Web服务中要操作的一个实体。一个资源具有统一的URI,通过URI能够标识并访问资源。 二、REST约束   REST定义了6个约束,符合这些约束的web服务才能成为RE

 相关资料
  • CCXT – CryptoCurrency eXchange Trading Library CCXT 是一个用于加密货币交易和电子商务的JavaScript/Python/PHP库,支持许多比特币/以太/山寨币交易市场和商家API。 CCXT库用于连接和交易全球的加密货币交易和支付处理服务。 它可以快速访问市场数据,用于存储,分析,可视化,指标开发,算法交易,策略回溯测试,机器人编程和相关软件工

  • 问题内容: 我有3台机器: 文件所在的服务器 运行REST服务的服务器(泽西岛) 可以访问第二台服务器但不能访问第一台服务器的客户端(浏览器) 我如何直接(不将文件保存在第二台服务器上)将文件从第一台服务器下载到客户端计算机? 从第二台服务器可以获取 ByteArrayOutputStream 来从第一台服务器获取文件,我可以使用REST服务将此流进一步传递给客户端吗? 这样行吗? 因此,基本上我

  • 问题内容: 我正在开发一个项目,在该项目中,我需要对正在运行的服务器进行HTTP URL调用,该服务器将响应作为JSON字符串返回。 下面是我的主要代码,它使用和- 下面是我的类,它实现接口并使用… 现在我有下面的代码在另一大类它调用的方法类顺序- 所以我的问题是在这里应该是静态的,就像我正确看到的一样,我正在为每个请求重新创建整个连接池,而我猜这不是正确的方法。 注意: 如果我将RestTemp

  • 问题内容: 我正在使用URL类从中读取InputStream。有什么我可以使用RestTemplate的方法吗? 我怎样才能 用,而不是使用? 问题答案: 您不应该直接获得。旨在封装处理响应(和请求)内容。它的优势在于处理所有IO,并为您提供现成的Java对象。 的一位原始作者Brian Clozel 表示: 并不意味着流响应主体;它的合同不允许这样做,而且已经存在了很长时间,以至于在不中断许多应

  • 问题内容: 我正在寻找一本书或任何其他资源,它们将帮助我学习如何用Java创建RESTful API。在Amazon上,我看到了RESTful Java的几种解决方案 ,但我正在寻找适合新手的解决方案。 期待收到您的建议/意见,谢谢! 问题答案: 我认为我不能仅指向一种资源,而是要走一条路(您可以根据对REST的理解水平对其进行自定义)。我是一个想先弄清楚我的概念,然后再考虑实现这些概念的工具的人

  • 问题内容: 我将要构建一个将使用RESTful Web服务的Android应用程序。我不想自己编写REST客户端,因为我希望它尽可能有效和稳定(这是我第一次使用REST)。 我可以在项目中使用任何(免费)适用于Android / Java的框架或实用程序吗? 问题答案: Restlet是一个出色的REST框架,并且具有Android版本。