Interface OrderAPI


  • @Path("/api/v1/orders")
    @Produces("application/json")
    public interface OrderAPI
    Based on code by chenshiwei on 2019/1/10.
    • Method Detail

      • createOrder

        @POST
        @Consumes("application/json")
        KucoinResponse<OrderCreateResponse> createOrder​(@HeaderParam("KC-API-KEY")
                                                        String apiKey,
                                                        @HeaderParam("KC-API-SIGN")
                                                        si.mazi.rescu.ParamsDigest signature,
                                                        @HeaderParam("KC-API-TIMESTAMP")
                                                        si.mazi.rescu.SynchronizedValueFactory<Long> nonce,
                                                        @HeaderParam("KC-API-PASSPHRASE")
                                                        String apiPassphrase,
                                                        OrderCreateApiRequest opsRequest)
                                                 throws IOException
        Place a new order.

        You can place two types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.

        The maximum matching orders for a single trading pair in one account is 50 (stop limit order included).

        Parameters:
        opsRequest - Order creation request.
        Returns:
        A response containing the order id.
        Throws:
        IOException
      • cancelOrder

        @DELETE
        @Path("/{orderId}")
        KucoinResponse<OrderCancelResponse> cancelOrder​(@HeaderParam("KC-API-KEY")
                                                        String apiKey,
                                                        @HeaderParam("KC-API-SIGN")
                                                        si.mazi.rescu.ParamsDigest signature,
                                                        @HeaderParam("KC-API-TIMESTAMP")
                                                        si.mazi.rescu.SynchronizedValueFactory<Long> nonce,
                                                        @HeaderParam("KC-API-PASSPHRASE")
                                                        String apiPassphrase,
                                                        @PathParam("orderId")
                                                        String orderId)
                                                 throws IOException
        Cancel an order

        Cancel a previously placed order.

        Parameters:
        orderId - The order id.
        Returns:
        A response containing the id of the cancelled order.
        Throws:
        IOException
      • cancelOrders

        @DELETE
        KucoinResponse<OrderCancelResponse> cancelOrders​(@HeaderParam("KC-API-KEY")
                                                         String apiKey,
                                                         @HeaderParam("KC-API-SIGN")
                                                         si.mazi.rescu.ParamsDigest signature,
                                                         @HeaderParam("KC-API-TIMESTAMP")
                                                         si.mazi.rescu.SynchronizedValueFactory<Long> nonce,
                                                         @HeaderParam("KC-API-PASSPHRASE")
                                                         String apiPassphrase,
                                                         @QueryParam("symbol")
                                                         String symbol)
                                                  throws IOException
        With best effort, cancel all open orders. The response is a list of ids of the canceled orders.
        Parameters:
        symbol - The symbol whose orders should be cancelled.
        Returns:
        A response containing the ids of all open orders.
        Throws:
        IOException
      • getOrder

        @GET
        @Path("/{orderId}")
        KucoinResponse<OrderResponse> getOrder​(@HeaderParam("KC-API-KEY")
                                               String apiKey,
                                               @HeaderParam("KC-API-SIGN")
                                               si.mazi.rescu.ParamsDigest signature,
                                               @HeaderParam("KC-API-TIMESTAMP")
                                               si.mazi.rescu.SynchronizedValueFactory<Long> nonce,
                                               @HeaderParam("KC-API-PASSPHRASE")
                                               String apiPassphrase,
                                               @PathParam("orderId")
                                               String orderId)
                                        throws IOException
        Get a single order by order id.
        Parameters:
        orderId - The order id.
        Returns:
        The requested order.
        Throws:
        IOException
      • queryOrders

        @GET
        KucoinResponse<Pagination<OrderResponse>> queryOrders​(@HeaderParam("KC-API-KEY")
                                                              String apiKey,
                                                              @HeaderParam("KC-API-SIGN")
                                                              si.mazi.rescu.ParamsDigest signature,
                                                              @HeaderParam("KC-API-TIMESTAMP")
                                                              si.mazi.rescu.SynchronizedValueFactory<Long> nonce,
                                                              @HeaderParam("KC-API-PASSPHRASE")
                                                              String apiPassphrase,
                                                              @QueryParam("symbol")
                                                              String symbol,
                                                              @QueryParam("side")
                                                              String side,
                                                              @QueryParam("type")
                                                              String type,
                                                              @QueryParam("status")
                                                              String status,
                                                              @QueryParam("startAt")
                                                              Long startAt,
                                                              @QueryParam("endAt")
                                                              Long endAt,
                                                              @QueryParam("pageSize")
                                                              Integer pageSize,
                                                              @QueryParam("currentPage")
                                                              Integer currentPage)
                                                       throws IOException
        List your current orders.
        Parameters:
        symbol - [optional] Only list orders for a specific symbol.
        side - [optional] buy or sell
        type - [optional] limit, market, limit_stop or market_stop
        status - [optional] active or done, done as default, Only list orders for a specific status .
        startAt - [optional] Start time. unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time.
        endAt - [optional] End time. unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time.
        pageSize - The page size.
        currentPage - The page to select.
        Returns:
        A page of orders.
        Throws:
        IOException