Coder Social home page Coder Social logo

mehmetakyuz / algo-coin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asyncalgotrading/algo-coin

0.0 2.0 0.0 9.69 MB

Algorithmic trading cryptocurrencies across multiple exchanges

License: Other

Makefile 0.03% Python 1.92% C++ 0.01% CSS 0.22% JavaScript 97.61% HTML 0.01% Shell 0.02% TypeScript 0.20%

algo-coin's Introduction

AlgoCoin

Algorithmic Trading Bitcoin.

WARNING: Code refactoring still in progress

Build Status Coverage Gitter Waffle.io BCH compliance Beerpay License PyPI Docs Site

Overview

Lightweight, extensible program for algorithmically trading cryptocurrencies and derivatives across multiple exchanges.

System Architecture

AlgoCoin is an event based trading system written in python. It comes with support for live trading across (and between) multiple exchanges, fully integrated backtesting support, slippage and transaction cost modeling, and robust reporting and risk mitigation through manual and programatic algorithm controls.

Algorithm

Like Zipline, the inspriation for this system, AlgoCoin exposes a single algorithm class which is utilized for both live trading and backtesting. The algorithm class is simple enough to write and test algorithms quickly, but extensible enough to allow for complex slippage and transaction cost modeling, as well as mid- and post- trade analysis.

Markets

Eventual coverage:

  • GDAX (Coinbase Pro)
  • Gemini
  • Binance
  • Bitfinex
  • ItBit
  • Kraken
  • Poloniex
  • Bitstamp
  • CEX
  • HitBTC
  • LakeBTC
  • BitMEX (derivatives)
  • Deribit (derivatives)

Sandboxes

GEMINI GDAX

Market Data (Websocket)

GDAX GEMINI

Order Entry (REST)

GDAX GEMINI

Markets Coverage

Exchange Pairs
Gemini BTC-USD, ZEC-USD, ZEC-BTC, ZEC-ETH, ETH-BTC, ETH-USD
GDAX BTC-USD, BTC-ETH, BTC-LTC, BTC-BCH, ETH-USD, LTC-USD, BCH-USD, ETH-BTC, LTC-BTC, BCH-BTC

Getting Started

Installation

Install the library from pip:

pip install algocoin

Install the library from source:

python setup.py install

API Keys

You should creat API keys for exchanges you wish to trade on. For this example, we will assume a GDAX sandbox account with trading enabled. I usually put my keys in a set of shell scripts that are gitignored, so I don't post anything by accident. My scripts look something like:

export GEMINI_API_KEY=...
export GEMINI_API_SECRET=...
export GEMINI_API_PASS=...

Prior to running, I then source the keys I need.

Let's make sure everything worked out by running a sample strategy on the GDAX sandbox exchange:

python3 -m algocoin --sandbox

Writing a trading strategy

Trading strategies implement the TradingStrategy abstract class in algocoin.lib.strategy. This has a number of required methods for handling messages:

  • onBuy
  • onSell
  • onTrade
  • onChange
  • onDone
  • onError
  • onOpen
  • onReceived

There are also a variety of optional methods for more granular control over risk/execution/backtesting, such as slippage, transactionCost, onHalt, onContinue, etc.

Backtesting

An instance of TradingStrategy class is able to run live or against a set of historical trade/quote data. When instantiating a TradingEngine object with a TradingEngineConfig object, the TradingEngineConfig has a type which can be set to live, sandbox, or backtest. Some additional methods are then usable on the TradingStrategy, including the onAnalyze method which allows you to visualize algorithm performance.

Getting Data

Historical data is relatively sparse, but the provided fetchdata.sh script will help grab historical data from bitcoincharts.com.

Sandboxes

Currently only the Gemini sandbox is supported, the other exchanges have discontinued theirs. To run in sandbox, set TradingEngineConfig.type to Sandbox.

Live Trading

When you want to run live, set TradingEngineConfig.type to Live. You will want to become familiar with the risk and execution engines, as these control things like max drawdown, max risk accrual, execution eagerness, etc.


Contributing


algo-coin's People

Contributors

timkpaine avatar

Watchers

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