当前位置: 首页 > 软件库 > Web3 > 开源货币/比特币 >

xchange-stream

授权协议 Apache-2.0 License
开发语言 Python
所属分类 Web3、 开源货币/比特币
软件类型 开源软件
地区 不详
投 递 者 令狐高洁
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

ARCHIVED

This project has now been merged into the XChange library. There will be no further releases and pull requests will not be accepted. Please use XChange from 5.0.0-SNAPSHOT onwards, which is, for now, 100% compatible.

XChange-stream

XChange-stream is a Java library providing a simple and consistent streaming API for interacting with Bitcoin and other crypto currency exchanges via WebSocket protocol.

It is build on top of the XChange library providing new interfaces for the exchanges' streaming APIs. Users can subscribe for live updates via reactive streams of RxJava library.

Why use it?

  • Easy to use - no need to hack WebSocket and other backends.
  • Consistent & simple API across all implemented exchanges.
  • Extends well-known & active Java library XChange.
  • Reactive streams are fun to work with.
  • Modular extensibility.

Getting started

Include in your project

Xchange-stream is on Maven Central. You will need xchange-stream-core dependency and xchange-XYZ where XYZ is supported exchange (eg. xchange-bitstamp). Add the following into your pom.xml.

Maven

<dependency>
    <groupId>info.bitrich.xchange-stream</groupId>
    <artifactId>xchange-stream-core</artifactId>
    <version>x.y.z</version>
</dependency>

<dependency>
    <groupId>info.bitrich.xchange-stream</groupId>
    <artifactId>xchange-XYZ</artifactId>
    <version>x.y.z</version>
</dependency>

For snapshots version (built from develop branch), add the following repository to your pom.xml file.

<repository>
  <id>sonatype-oss-snapshot</id>
  <snapshots/>
  <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

Versioning

XChange-stream follows major and minor version from XChange library. So version 4.2.x is based on latest 4.2. release of XChange.

Example

Use the same library as XChange but instead of ExchangeFactory use StreamingExchangeFactory that creates StreamingExchange instead of Exchange. Then you can call getStreamingMarketDataService to subscribe to trade data.

StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(BitstampStreamingExchange.class.getName());

// Connect to the Exchange WebSocket API. Blocking wait for the connection.
exchange.connect().blockingAwait();

// Subscribe to live trades update.
exchange.getStreamingMarketDataService()
        .getTrades(CurrencyPair.BTC_USD)
        .subscribe(trade -> {
            LOG.info("Incoming trade: {}", trade);
        }, throwable -> {
            LOG.error("Error in subscribing trades.", throwable);
        });

// Subscribe order book data with the reference to the subscription.
Disposable subscription = exchange.getStreamingMarketDataService()
                                  .getOrderBook(CurrencyPair.BTC_USD)
                                  .subscribe(orderBook -> {
                                       // Do something
                                  });

// Unsubscribe from data order book.
subscription.dispose();

// Disconnect from exchange (non-blocking)
exchange.disconnect().subscribe(() -> LOG.info("Disconnected from the Exchange"));

More information about reactive streams can be found at RxJava wiki.

What is supported

Listening for live updates of:

Exchange order books trades (public) tickers balances trades (user) open orders notes
Bankera ✔️ ✔️ �� Ticker support could be implemented using the trades and order book streams, even though the exchange doesn't explicitly return a ticker stream.
Binance ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Bitfinex ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Bitflyer ✔️ ✔️ ✔️
BitMEX ✔️ ✔️ ✔️ �� �� �� We are short of maintainers able to review pull requests and provide support for Bitmex, so there is a backlog of pull requests and support is likely broken. Can you help? See #180 for reference if attempting to add private channel support.
Bitstamp ✔️ ✔️
CEX.IO ✔️ New support, not widely tested
Coinbase Pro ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Coinmate ✔️ ✔️ ✔️ ✔️ ✔️
Gemini ✔️ ✔️ �� �� ��
Kraken ✔️ ✔️ ✔️ ✔️ ✔️
LGO ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
OKCoin ✔️ ✔️ ✔️
OKEx ✔️ ✔️ ✔️ See #180 for reference if attempting to add private channel support.
Poloniex ✔️ ✔️ ✔️
  • ✔️ - implemented
  • �� - missing but can be implemented
  • - not supported by the exchange
  • - exchange support level not known (please fill in)

If you missing a specific exchange implementation, feel free to propose a pull request or open an issue with some sweet BTC bounty.

Open Source Projects Using XChange-Stream

This is an, not so complete, list of projects that use XChange-Stream, feel free to add your project below.

License

Copyright 2017 Zdenek Dolezal, Michal Oprendek

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

  • 流是一个独立的,客户端和服务端在HTTP/2连接下交换帧的双向序列集。 http2在端点之间建立连接后,以Frame为基本单位交换数据。Stream为一组共享同一StreamID的Frame集合。 Connection,Stream,Frame 构成了这样的关系:Connection 和 Stream 是一对多的关系,Stream 和Frame也是一对多的关系。 这样,就可以允许来自多个Strea

  • MongoDB 从3.6版本开始支持了 Change Stream 能力(4.0、4.2 版本在能力上做了很多增强),用于订阅 MongoDB 内部的修改操作,change stream 可用于 MongoDB 之间的增量数据迁移、同步,也可以将 MongoDB 的增量订阅应用到其他的关联系统;比如电商场景里,MongoDB 里存储新的订单信息,业务需要根据新增的订单信息去通知库存管理系统发货。

  •   在看AudioTrack代码的时候,我们看到,要创建一个AudioTrack对象,需要指定一个StreamType。 今天我们只把stream type相关的代码抽取出来,详细看看stream type相关的东东。 java层的代码就不看了。 从函数android_media_AudioTrack_native_setup开始说起。 static int android_media_Audio

  • Oracle Stream功能是为提高数据库的高可用性而设计的,在Oracle 9i及之前的版本这个功能被称为Advance Replication。Oracle Stream利用高级队列技术,通过解析归档日志,将归档日志解析成DDL及DML语句,从而实现数据库之间的同步。这种技术可以将整个数据库、数据库中的对象复制到另一数据库中,通过使用Stream的技术,对归档日志的挖掘,可以在对主系统没有任

  • 前几天在看stream type的时候,调用函数AudioSystem::getOutput的地方并没有继续往下看。 今天深入看看。 *****************************************源码************************************************* status_t AudioTrack::set( int s

  • 一、简介 本文通过实例详细讲解各编译参数,方便读者快速掌握。stream是一套综合性能测试程序集,通过fortran和c两种高级且高效的语言编写完成,由于这两种语言在数学计算方面的高效率, 使得stream测试例程可以充分发挥出内存的能力。 二、使用简介 stream测试得到的是可持续运行的内存带宽最大值,而并不是一般的硬件厂商提供的理论最大值,具有如下特点: 1.主要有四种数组的运算,测试到内存

  • Introduction Android 10 introduces features allowing camera clients to choose optimal camera streams for specific use cases and to ensure that certain stream combinations are supported by the camera d

  • 安装依赖包 sudo yum install -y yum-utils 使用国内镜像源 sudo yum-config-manager \ --add-repo \ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo sudo sed -i 's/download.docker.com/mirrors.

  •  So we have a wcf restful web service configured with webHttpBinding and everything works fine with http get.  If change it to Post and post something like variable1=1&variable2=2 in message body do

  • Syntax: x265 [options] infile [-o] outfile     infile can be YUV or Y4M     outfile is raw HEVC bitstream Executable Options: -h/--help                        Show this help text and exit    --fullhel

  • 本文基于阿里巴巴高级开发工程师徐榜江 (雪尽) 7 月 10 日在北京站 Flink Meetup 分享的《详解 Flink-CDC》整理。 《详解 Flink-CDC》深入讲解了最新发布的 Flink CDC 2.0.0 版本带来的核心特性,包括:全量数据的并发读取、checkpoint、无锁读取等重大改进。 项目地址 文档地址 详解Flink-CDC PPT CDC 什么是CDC CDC 的全

 相关资料
  • XChange 是一个提供简单和一致的 API 用于和多样化的金融安全交换数据,包括对 Bitcoin 的支持。 示例代码: package com.xeiam.xchange.examples.mtgox.v1.polling; import com.xeiam.xchange.Exchange;import com.xeiam.xchange.ExchangeFactory;import co

  • Open-Xchange提供大部分的群件功能,包括行事历、联络人、待办事项、分享项目与文件、分享知识、讨论区、书签和电子邮件。并且提供WebDAV/XML 接口可以让其它软件与Open-Xchange 的联络人管理、行事历、待办事项与文件等功能相结合。

  • 问题内容: 我正在学习Java 8 lambda表达式,我想问一下以下与我遇到的函数接口中的方法有关的Java代码。 在IDE上执行程序时,它不输出。我期望它会给。 问题答案: 我假设您正在Java 9下运行它?您没有更改流的属性,因此不需要执行任何一个或全部执行。 换句话说,您关心的只是最终结果,但与此同时,您不以 任何 方式(例如通过或)更改的初始大小。这是在Streams中完成的优化。 顺便

  • 问题内容: 我刚刚使用了解了输入/输出。 我想知道究竟是什么术语的含义和? 这行代码还为我们提供了什么: 问题答案: Java有两种用于输入和输出(I / O)的类: 流 和 读取器/ 写入 器 。 流(,以及延伸这些一切)用于读取和文件,网络或任何其他设备写入二进制数据。 读者和作家用于阅读和书写文本(字符)。它们是流之上的一层,它使用字符编码将二进制数据(字节)转换为字符,再转换回字符。 从磁

  • 问题内容: 像几乎每个人一样,我仍在学习新的Java 8 Streams API的复杂性(并喜欢它们)。我对流的使用有疑问。我将提供一个简化的示例。 Java Streams允许我们采用,并在其上使用方法来接收其所有元素的流。在这,有许多有用的方法,比如,和,这让我们对内容的使用拉姆达操作。 我有看起来像这样的代码(简化): 这个想法是获取集合中与某个限定符匹配的所有项目的映射,然后对它们进行操作

  • 问题内容: 我喜欢Java 8的流API。有很多有用的中间方法和终端方法来转换和收集流。我说的是中间方法distinct()或终端方法collect()。我发现该CollectorAPI特别有用,可以将流减少为深度分组图。 Java流API的javascript等价物是什么?我知道好像有很基本的功能map,filter以及reduce,但没有发现由JavaScript原生的收集提供的查询或一组数据