diff --git a/lib/rest/v2/orders.rb b/lib/rest/v2/orders.rb index 49595d1..e00c7bc 100644 --- a/lib/rest/v2/orders.rb +++ b/lib/rest/v2/orders.rb @@ -8,6 +8,31 @@ def orders authenticated_post("auth/r/orders").body end + # Returns historic closed or cancelled orders + # + # @param symbol [string] symbol used for the order + # @param params :start [int32] Millisecond start time + # @param params :end [int32] Millisecond end time + # @param params :limit [int32] Number of records + # @param params :id [Array] Allows you to retrieve specific orders by order ID (id: [ID1, ID2, ID3]) + # + # @return [Array] + # + # @example: + # client.orders_history + # client.orders_history(symbol: 'tBTCUSD') + # client.orders_history(symbol: 'tBTCUSD', params: { id: [123, 234] }) + def orders_history(symbol: nil, params: {}) + check_params(params, %i{start end limit id}) + if symbol + path = "auth/r/orders/#{symbol}/hist" + else + path = "auth/r/orders/hist" + end + + authenticated_post(path, params: params).body + end + # Get Trades generated by an Order # # @param order_id [int32] Id of the order