Giter Site home page Giter Site logo

mcgizzle / haxchange Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 3.0 142 KB

A uniform collection of API bindings for various cryptocurrency exchanges

License: BSD 3-Clause "New" or "Revised" License

Haskell 99.37% Shell 0.63%
cryptocurrency cryptocurrency-exchanges trading arbitrage haskell binance kraken

haxchange's Introduction

haxchange ๐Ÿค‘

About

The goal of this project is to create a uniform E-DSL for various cryptocurrency exchanges. This could have many uses from arbitraging to algorithmic trading. I will initially only be implementing a select set of functions, but the hope is to extend it in the future.

Progress

Exchange getMarkets getTicker getBalance buyLimit sellLimit
Kraken โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
Binance โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ โœ”๏ธ
Bittrex โœ–๏ธ โœ”๏ธ โœ–๏ธ* โœ–๏ธ* โœ–๏ธ*

*New accounts are currently blocked

Templates

There is a template folder which contains the modules and tests necessary for adding a new exchange, along with most of the bolier plate.

There is a script for creating the files needed to add a new exchange.

Adding a new exchange

run the following

cd templates
sh make.sh <name of new exchange>

This will copy the template files replacing all <newmodule> tags with the name of the new exchange.

Contributions are welcomed with open arms :)

Implementation

There are shared ADT's that are uniform accross all exchanges. Each exchange implements custom FromJSON instances as appropriate.

In order to improve effeciency, the data types are mostly Text.

There are ToText and FromText type classes which each have one method

  toText :: a -> Text
  fromText :: Text -> a

Each exchange then implements overrides the ToText class with its own implementation

This helps with wrangling data into the unified model and vice-versa. The toText function is used to override the general version for special cases.

import qualified Types as T
instance ToText Currency where
  toText (COIN BTC) = "XBT"
  toText a          = T.toText a
  

*Kraken refers to Bitcoin as XBT whereas most exchanges refer to it as BTC

For more information please see the source

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.