TradeInterface - Define and implement a method to place multiple orders sequentially

Issue #804 resolved
Desrever Nu created an issue

Define a method in TradeInterface that takes a list of orders as input and craft an ad hoc response .

This method is neccessary to hide the complexity of the orderbook and avoid placing orders one-by-one.

Follow javadoc below

 /**
     * Places multiple orders, sequentially one-by-one or
     * using a single API entry point when available.
     *
     * @param orders A list of orders to place
     * @param pair   The currency pair of the order.
     * @return an ApiResponse object with a MultipleOrdersResponse with individual responses, ApiError in case
     * of general error.
     */
    public ApiResponse placeOrders(ArrayList<OrderToPlace> orders, CurrencyPair pair);

In the first implementation of this method, place the orders sequentially one-by-one, unless the exchange itself exposes an API entrypoint that accepts lists of orders.

Since one or more orders can fail while others succeed, the MultipleOrdersResponse should wrap and manage the responses by implementing the following methods :

private ArrayList<OrderPlaced> ordersRequested;

    public MultipleOrdersResponse(ArrayList<OrderPlaced> individualResponses) ;

    public boolean areAllOrdersPlacedCorrectly() ;

    public int countOrdersRequested() ;

    public int countOrdersPlacedSuccessfully() ;

    public int countOrdersPlacedWithErrors() ;

    public ArrayList<OrderPlaced> getOrdersPlacedWithErrors() ;

    public ArrayList<OrderPlaced> getOrdersPlacedSuccessfully() ;

    public void printOrdersPlacedSuccessfully();

    public void printOrdersPlacedWithErrors() ;

    public ArrayList<OrderPlaced> getAllOrdersRequested() ;

see #805 for the v2 of this method

Comments (6)

  1. Desrever Nu reporter

    Objects ( OrderPlaced MultipleOrdersResponse ) created, Interface updated.

    Now need to implement the method for available exchanges and test it : bittrex, poloniex, bitcoinid, bter, allcoin, ccedk

  2. Desrever Nu reporter

    Done (not ccedk, very slow on allcoin)

    Edit: contacted Mark at allcoin, pending a reply then we can close this issue and merge

  3. Log in to comment