GithubHelp home page GithubHelp logo

cointrader's Introduction

Coin Trader

Coin Trader is a Java-based backend for trading cryptocurrencies, released under the Apache License. It features:

  • Connectivity to many exchanges
  • Control console (text)
  • Simulated trading
  • Schema and persistence
  • CSV output of market data
  • Ad-hoc table reports
  • Modular infrastructure

Coin Trader's future includes:

  • Live order execution
  • Basic order routing
  • Flexible data output
  • Basic indicators
  • Accounting and reconciliation
  • Backtesting
  • Web console & graphing

See the Wiki for more information, or jump to Setup.

Console Demo

The Coin Trader console gives you a peek into the engine.

$ ./cointrader.sh console

Coin Trader Console 0.3.0-SNAPSHOT

ct> help
Type "help {command}" for more detailed information.
Available commands:
    • attach
    • buy
    • csv
    • currencies
    • data
    • exchanges
    • exit
    • help
    • jpa
    • listings
    • markets
    • sell
    • set
    • unset
    • unwatch
    • watch
    • watches

ct> data summary
+------------------+------------+-----------+
|      Market      | Num Trades | Num Books |
+------------------+------------+-----------+
|     BTCE:BTC.USD |       8149 |      2671 |
| BITFINEX:BTC.USD |       3509 |      2551 |
| BITSTAMP:BTC.USD |       1344 |       901 |
| BITFINEX:DRK.USD |       1000 |        21 |
| BITFINEX:DRK.BTC |       1000 |        21 |
| BITFINEX:LTC.USD |       1000 |        22 |
| BITFINEX:LTC.BTC |       1000 |        22 |
| BTCCHINA:BTC.CNY |        134 |        31 |
| BTCCHINA:LTC.CNY |        110 |        31 |
| BTCCHINA:LTC.BTC |        102 |        31 |
|     BTER:BTC.CNY |         47 |         7 |
|     BTER:LTC.BTC |         38 |        84 |
|    BTER:DOGE.CNY |         26 |         7 |
|     BTER:NXT.CNY |         26 |         6 |
|     BTER:DRK.CNY |         23 |         6 |
|    BTER:DOGE.BTC |         23 |         6 |
|     BTER:LTC.CNY |         21 |         7 |
|     BTER:XCP.CNY |         20 |         6 |
|     BTER:DRK.BTC |         19 |         6 |
|     BTER:XCP.BTC |         18 |        12 |
|     BTER:NXT.USD |          2 |         6 |
+------------------+------------+-----------+

ct> watch btc.usd
now watching BTC.USD

ct> 
book: BITFINEX:BTC.USD    587.4 (0.317861) - 588.82 (-1.54641998)
book: BTCE:BTC.USD    583.92 (0.01499999) - 585.99 (-0.01819054)
book: BITSTAMP:BTC.USD    588.79 (0.99999999) - 590.33 (-0.19199999)
book: BITFINEX:BTC.USD    587.4 (0.317861) - 588.81 (-13.94196839)
book: BTCE:BTC.USD    583.92 (0.01499999) - 585.99 (-0.01819054)
trade: BITSTAMP:BTC.USD    590.33 (0.03489999)
book: BTCE:BTC.USD    583.92 (0.01499999) - 585.99 (-0.01819054)
book: BITFINEX:BTC.USD    587.4 (0.317861) - 588.8 (-31.37994228)
book: BTCE:BTC.USD    583.92 (0.01499999) - 585.99 (-0.01180944)

ct> unwatch btc.usd
no longer watching BTC.USD

ct> buy 10.0 bitfinex:btc.usd
Sending order SpecificOrder{id=d5a2ff79-0eca-445d-a3b3-75d1e80265a7, parentOrder=null, market=BITFINEX:BTC.USD, volumeCount=1000000000}
Order has been placed. SpecificOrder{id=d5a2ff79-0eca-445d-a3b3-75d1e80265a7, parentOrder=null, market=BITFINEX:BTC.USD, volumeCount=1000000000}

ct> 
Filled order d5a2ff79-0eca-445d-a3b3-75d1e80265a7: Fill{order=d5a2ff79-0eca-445d-a3b3-75d1e80265a7, market=BITFINEX:BTC.USD, price=585.57, volume=2.11486695}
Order is partially filled SpecificOrder{id=d5a2ff79-0eca-445d-a3b3-75d1e80265a7, parentOrder=null, market=BITFINEX:BTC.USD, volumeCount=1000000000, averageFillPrice=585.57}
Filled order d5a2ff79-0eca-445d-a3b3-75d1e80265a7: Fill{order=d5a2ff79-0eca-445d-a3b3-75d1e80265a7, market=BITFINEX:BTC.USD, price=585.58, volume=7.88513305}
Order has been completely filled.  SpecificOrder{id=d5a2ff79-0eca-445d-a3b3-75d1e80265a7, parentOrder=null, market=BITFINEX:BTC.USD, volumeCount=1000000000, averageFillPrice=585.57788513305}

ct> buy 1 btc.usd
Creating order GeneralOrder{id=a4664af4-a21d-4b77-a999-bc8a78a8d951, parentOrder=null, listing=BTC.USD, volume=1}
Order has been placed. SpecificOrder{id=3ff02408-8269-4bf9-929f-8d2ca060f6fc, parentOrder=a4664af4-a21d-4b77-a999-bc8a78a8d951, market=BITSTAMP:BTC.USD, volumeCount=100000000}

ct>
Filled order 3ff02408-8269-4bf9-929f-8d2ca060f6fc: Fill{order=3ff02408-8269-4bf9-929f-8d2ca060f6fc, market=BITSTAMP:BTC.USD, price=584.99, volume=1}
Order has been completely filled.  SpecificOrder{id=3ff02408-8269-4bf9-929f-8d2ca060f6fc, parentOrder=a4664af4-a21d-4b77-a999-bc8a78a8d951, market=BITSTAMP:BTC.USD, volumeCount=100000000, averageFillPrice=584.99}
Order has been completely filled.  GeneralOrder{id=a4664af4-a21d-4b77-a999-bc8a78a8d951, parentOrder=null, listing=BTC.USD, volume=1}

ct> exit

$

Coin Trader does not send live orders to exchanges yet. The above demo uses simulated order filling for testing.

Automated Trading

To implement signals and automated strategies, you connect Esper event queries to Java code like this:

@When( "select avg(priceAsDouble) from Trade.win:time(30 sec)" )
void checkMovingAverage( double avg )
{
  if( avg > trigger )
    esper.publish( new MyIndicator(5.31) );
}

@When( "select * from MyIndicator where myIndicatorValue > 5.0" )
void enterTrade( MyIndicator s )
{
  orders.create( Listings.BTC_USD, 1.0 )
        .withLimit( 650.25 )
        .place();
}

See the Wiki for more information, or jump to Setup.

cointrader's People

Contributors

ayaohsu avatar cmshop avatar navonpartners avatar timolson avatar yzernik avatar

Watchers

 avatar  avatar

Forkers

kuzeygh

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.