Code Monkey home page Code Monkey logo

bitfinex-v2-wss-api-java's Introduction

An unofficial Java implementation of the Bitfinex Websocket (v2) API

Build Status Maven Central Version Coverity Scan Build Status Join the chat at https://gitter.im/bitfinex-v2-wss-api-java/Lobby

This project provides a Java client library for the Bitfinex WebSocket API (v2). Public and private channels (candles, ticks, executed trades, (raw) orderbooks, orders, and wallets) are implemented.

In contrast to other implementations, this project uses the WSS (web socket secure) streaming API of Bitfinex. Most other projects are poll the REST-API periodically, which leads to delays in data processing. In this implementation, you can register callback methods on ticks, candles or orders. The callbacks are executed, as soon as new data is received from Bitfinex (see the examples section for more details).

Warning: Trading carries significant financial risk; you could lose a lot of money. If you are planning to use this software to trade, you should perform many tests and simulations first. This software is provided 'as is' and released under the Apache 2.0 license.

Contact / Stay informed

  • You need help or do you have questions? Join our chat at gitter.
  • For reporting issues, visit our bug tracking system.
  • For contributing, see our contributing guide.
  • If you like the project please star it on GitHub.
  • You are interested in a crypto currency trading bot? See my crypto-bot project.

Examples

You will find some examples here.

Usage

Maven

Add these lines to your pom.xml file

<dependency>
	<groupId>com.github.jnidzwetzki</groupId>
	<artifactId>bitfinex-v2-wss-api</artifactId>
	<version>0.6.6</version>
</dependency>

Gradle

Add these lines to your build.gradle file

compile 'com.github.jnidzwetzki:bitfinex-v2-wss-api:0.6.6'

Changelog

You will find the changelog of the project here.

Recent API changes

Version 0.6.3

Starting with version 0.6.3 the value for uninitialized BigDecimal values was unified to null (in version 0.6.2 sometimes -1 and sometimes null was used).

The BitfinexTick.INVALID_VOLUME is removed and replaced by a Java 8 optional

# Old (version <= 0.6.2)
if (tick.getVolume() != BitfinexTick.INVALID_VOLUME) {
	tick.getVolume().doubleValue()
}

# New (version > 0.6.2)
if(tick.getVolume().isPresent()) {
	tick.getVolume().get().doubleValue()
}

Version 0.6.2

Since version 0.6.2, the double data type is replaced by the BigDecimal data type for increased precision.

Version 0.6.1

Since version 0.6.1, the Wallets are new managed by the Wallet manager. The WalletManager provides the same methods as the BitfinexAPIBroker in previous versions. Execute your wallet related calls on the new WalletManager.

# Old (version <= 0.6.0)
bitfinexClient.getWallets();

# New (version > 0.6.0)
bitfinexClient.getWalletManager().getWallets();

Version 0.6.0

With version 0.6.0 the ta4j dependency was removed. For quotes, the API implementation now returns instances of the class BitfinexTick. To convert a BitfinexTick into a ta4j Bar, you can use the following code:

final BitfinexTick tick = ....;

final Instant instant = Instant.ofEpochMilli(tick.getTimestamp());
final ZonedDateTime time = ZonedDateTime.ofInstant(instant, Const.BITFINEX_TIMEZONE);

final Bar bar = new BaseBar(time, tick.getOpen().doubleValue(), 
				tick.getHigh().doubleValue(), 
				tick.getLow().doubleValue(), 
				tick.getClose().doubleValue(), 
				tick.getVolume().orElse(BigDecimal.ZERO).doubleValue());

bitfinex-v2-wss-api-java's People

Contributors

bvolpato avatar flexz9 avatar hansblafoo avatar ilyagalahov avatar jnidzwetzki avatar leonemagevski avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.