Implement the getOrderBook method wrapper

Issue #167 resolved
Desrever Nu created an issue

For all the supported exchanges, implement the getOrderBooks .

The method is already defined in the TradingInterface file.

  1. Define fields and methods of the nubot.models.OrderBook.java class
  2. Implement the getOrderBook(pair) wrapper in Peatio wrapper
  3. Review with other devs and suggest approaches
  4. Create one issue in bitbucket for each exchange supported
  5. resolve this issue

Comments (16)

  1. Benjamin Cordes

    started some work on this in (167 branch), but leaving it open for now. didn't get it quite to work.

  2. Sam Griffiths

    picking this up.

    Have made some tentative starts at defining a class skeleton for the OrderBook model but need to discuss what methods an order book requires and what uses are intended for it.

  3. Desrever Nu reporter

    need to discuss what methods an order book requires and what uses are intended for it.

    True. Beside the basic getters and setters here are some possible useful methods

    getPair : returns the currency pair associated with the book

    getBids : returns a list of all open bids (sorted by price)

    getAsks : returns a list of all open asks (sorted by price)

    getBids : (double fromPrice, double toPrice) : get a list of all bids in the defined price range

    getAsks : (double fromPrice, double toPrice) : get a list of all asks in the defined price range

    getAsks : (double upToPrice) : get a list of all asks in the defined price range

    getBids : (double upToPrice) : get a list of all bids in the defined price range

    getAsks : (int minVolume , int maxVolume) : get a list of all asks in the defined volume range

    getBids : (int maxVolume, maxVolume) : get a list of all bids in the defined volume range

    getBestBid : return the best bid(price and volume)

    getBestAsk : return the best ask (price and volume)

    getTotalLiquidity(String type) : return the total volume of the order book - type switches between bids and asks

    getTotalLiquidity(double upToPrice, String type) : return the total volume of the order book up to upToPrice .

    getTotalLiquidity(double fromPrice, double toPrice, String type) : return the total volume of the order book with a fromPrice < pricerange < toPrice

    sortByPrice(ascending|descending) : sort the list by price - default

    sortByVolume(ascending|descending)

    sortByDate(newestFirst|oldestFirst) ...

    That could be a very useful and flexible start

  4. Sam Griffiths

    Thanks. I was on the right lines, just good to have a definitve list to work to.

    I had started off with getTopBid and getTopAsk methods. I'll carry on in the vein and add the methods listed above. If any more occur to you, add them here and I'll implememtn them

  5. Sam Griffiths

    All mentioned methods have been implemented as well as the getOrderBook method in the Peatio wrapper for testing. I've done preliminary tests on peatio but waiting for test funds to clear in order to test orderbook filtering and ordering properly with more than 1 order.

  6. Desrever Nu reporter

    Excellent! Are you working on a branch? Ping me when I can test the orderBook and write an automated Test

  7. Log in to comment