module Kucoin::Rest::Public::Orders

Public Instance Methods

buy_orders(symbol, limit: 100, group: nil, options: {}) click to toggle source
# File lib/kucoin/rest/public/orders.rb, line 10
def buy_orders(symbol, limit: 100, group: nil, options: {})
  get_orders(symbol: symbol, endpoint: "/open/orders-buy", params: order_params(symbol, group, limit), type: "BUY", options: options)
end
orders(symbol, limit: 100, group: nil, options: {}) click to toggle source
# File lib/kucoin/rest/public/orders.rb, line 6
def orders(symbol, limit: 100, group: nil, options: {})
  get_orders(symbol: symbol, endpoint: "/open/orders", params: order_params(symbol, group, limit), type: nil, options: options)
end
sell_orders(symbol, limit: 100, group: nil, options: {}) click to toggle source
# File lib/kucoin/rest/public/orders.rb, line 14
def sell_orders(symbol, limit: 100, group: nil, options: {})
  get_orders(symbol: symbol, endpoint: "/open/orders-sell", params: order_params(symbol, group, limit), type: "SELL", options: options)
end

Private Instance Methods

get_orders(symbol:, endpoint:, params: {}, type: nil, options: {}) click to toggle source
# File lib/kucoin/rest/public/orders.rb, line 19
def get_orders(symbol:, endpoint:, params: {}, type: nil, options: {})
  response = get(endpoint, params: params, options: options)&.merge("symbol" => symbol)
  ::Kucoin::Models::OrderBook.new(response, type: type) if response
end
order_params(symbol, group = nil, limit = nil) click to toggle source
# File lib/kucoin/rest/public/orders.rb, line 24
def order_params(symbol, group = nil, limit = nil)
  params          =   {
    symbol: symbol,
    group:  group,
    limit:  limit
  }
  
  params.delete_if { |key, value| value.nil? }

  return params
end