Giter Club home page Giter Club logo

exchange-api's Introduction

GoDoc

Node

Node is main executable Node needs exchange API key and secret in format: "key:secret" for initilaize client, client is interface that handles major methods of each exchange

-srv flag define rpc addres for bind
-db flag define redis address

Client functionality:

  • Place buy and sell orders
  • Getting order information and status
  • Getting all completed and executed orders, that was created using this client
  • Getting orderbook for given market
  • Cancel orders by orderid and market or cancel all orders
  • Getting balance

Node using jsonrpc 2.0 protocol for rpc calls:

RPC methods:

More details on the RPC interface are available in the RPC README file.

  • buy
  • sell
  • order_info
  • order_status
  • cancel_all
  • cancel_market
  • cancel_trade
  • completed
  • executed
  • orderbook

and you can add specific handlers for each exchange rpc package contains more documentation - methods, params structures for each call, return values and description for each method rpc endpoints for each exchange are different -
http://rpcaddr:rpcport/c2cx and http://rpcaddr:rpcport/cryptopia, respectively

Cli

Cli command structure:
cli <exchange> <command> [subcommand] [params]
Commands tree:

  • order
    • info <orderid>
    • status <orderid>
  • cancel
    • all
    • market <symbol>
    • trade <orderid>
  • buy <symbol> <price> <amount>
  • sell <symbol> <price> <amount>
  • orderbook <symbol>
  • executed
    • market <symbol>
    • all
  • completed
    • market <symbol>
    • all
  • balance <currency>

Exchange may contains additional functions, that does not handles client interface
c2cx commands:

  • submittrade <market> <price> <amount>
    this command allow to set additional order params
    required flags - pricetype limit/market and ordertype buy/sell
    additional flags - triggerprice, takeprofit and stoploss

cryptopia commands:

  • deposit <currency>
    gets deposit address for given currency
  • withdraw <address> <currency> <amount> [paymentid]
    creates withdrawal request, address should be added to list of allowed addresses
    paymentid needs only for CryptoNote based cryptocurrencies
  • transactions <type>
    type deposit/withdraw
  • tracking
    • add <symbol>
      add symbol to orderbook tracking list
    • rm <symbol>
      remove symbol from ordebook tracking list

Usage examples:

  • Getting order information by orderid
     ./cli c2cx order info 2832693
     {
       "amount": 100,
       "market": "CNY/SHL",
       "orderid": 2832693,
       "price": 0.01,
       "status": "submitted",
       "submitted_at": "2017-08-05T06:54:12.469+07:00",
       "type": "buy"
     }
    
  • Getting order status by orderid
     ./cli c2cx order status 2832693
     Order 2832693 status: "submitted"
    
  • Create new order
    first parameter is marketpair, second - price, third - amount
     ./cli c2cx buy cny/shl 0.01 100
     Order 2832694 created
    
  • Get open orders
     ./cli c2cx executed all
     {
       "amount": 100,
       "market": "BTC/BCC",
       "orderid": 2832693,
       "price": 0.000011,
       "status": "submitted",
       "submitted_at": "2017-08-05T06:54:12.469+07:00",
       "type": "buy"
     }
     {
       "amount": 100,
       "market": "CNY/SHL",
       "orderid": 2832694,
       "price": 0.01,
       "status": "submitted",
       "submitted_at": "2017-08-05T07:30:14.063+07:00",
       "type": "buy"
     }
    
  • Get open orders by market
     ./cli c2cx executed market cny/shl
     {
       "amount": 100,
       "market": "CNY/SHL",
       "orderid": 2832694,
       "price": 0.01,
       "status": "submitted",
       "submitted_at": "2017-08-05T07:30:14.063+07:00",
       "type": "buy"
     }
    
  • Cancel orders by market
     ./cli c2cx cancel market cny/shl
     {
       "amount": 10,
       "market": "CNY/SHL",
       "orderid": 2832707,
       "price": 0.01
     }
     {
       "amount": 100,
       "market": "CNY/SHL",
       "orderid": 2832708,
       "price": 0.01
     }
     Cancelled 2 orders     
    
  • Getting balance
     ./cli c2cx balance btc
     "Availible 0.00000000, frozen 0.00000000"
    

TODO:

  • Components interaction tests

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.