Giter Club home page Giter Club logo

bitfinex_algo's Introduction

An orderbook based trading algorithm for bitfinex

Orderbook based trading algorithm for Bitfinex, based on open source from jndok and dawsbot. Please use at own risk !

Best used in a jupyter notebook, the python requests.get is used with a proxyDict. You might need to modify that if you don't need to use a proxy. You will also need to enter your own api keys to use Bitfinex.

The api files are based on the interface from work by jndok and dawsbot. bitfinex/FinexAPI/FinexAPI.py

In order to take it further, a few other functions were added and a working trading algorithm was implemented.

trim_orderbook : This trims the orderbook to a % of the current price. So that bids and offers that are far away can be removed.

simple_strategy: This relies on the calculation of imbalance in the trimmed orderbook to decide if a trade needs to be entered into.

run_algo: This implements the trading algorithm. It works in the following way.

A loop runs every n+(computation time) times to check if the imbalance is beyond a certain threshold. For e.g, if the amount of bids - amount of offers > 60.0, then enter a buy order.

Once a buy order is triggered, the trade is monitored for a certain amount of time. lag (=2s sat) * 60 seconds. Every 2s, the pnl is calculated and if it exceeds the gain or the loss, it's closed out. If at the end of the period, pnl is within threshold, the position is still closed.

A better strategy would be based on monitoring the orderbook changes. In order to measure the change, as the price changes, the only meaningful measure is splitting the prices into ranges (bins). These functions are implemented in orderbook_monitor.

The code can be used to trade any cryptoccy pair by changing the symbol.

bitfinex_algo's People

Contributors

mchennupati avatar bgmeyr avatar

Watchers

James Cloos avatar Moon 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.