Module: KucoinRuby::Trading

Defined in:
lib/kucoin_ruby/trading.rb

Class Method Summary collapse

Class Method Details

.active_orders(symbol, type = nil) ⇒ Object



9
10
11
12
13
# File 'lib/kucoin_ruby/trading.rb', line 9

def self.active_orders(symbol, type = nil)
  endpoint = '/v1/order/active'
  query_string = {symbol: symbol, type: type}
  KucoinRuby::Net.signed_get(endpoint, query_string)
end

.cancel_order(symbol, order_id, type) ⇒ Object



15
16
17
18
19
# File 'lib/kucoin_ruby/trading.rb', line 15

def self.cancel_order(symbol, order_id, type)
  endpoint = "/v1/#{symbol}/cancel-order"
  payload = {orderOid: order_id, type: type}
  KucoinRuby::Net.signed_post(endpoint, payload)
end

.create_order(symbol, type, price, amount) ⇒ Object



3
4
5
6
7
# File 'lib/kucoin_ruby/trading.rb', line 3

def self.create_order(symbol, type, price, amount)
  endpoint = "/v1/#{symbol}/order"
  payload = { amount: amount, price: price, type: type }
  KucoinRuby::Net.signed_post(endpoint, payload)
end

.dealt_orders(symbol = nil, type = nil, limit = nil, page = nil, since = nil, before = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/kucoin_ruby/trading.rb', line 21

def self.dealt_orders(symbol=nil, type=nil, limit=nil, page=nil, since=nil, before=nil)
  endpoint = '/v1/order/dealt'
  query_string = {
    before: before,
    limit: limit,
    page: page,
    since: since,
    symbol: symbol,
    type: type
  }
  KucoinRuby::Net.signed_get(endpoint, query_string)
end

.order_detail(symbol, type, order_id, limit = nil, page = nil) ⇒ Object



40
41
42
43
44
# File 'lib/kucoin_ruby/trading.rb', line 40

def self.order_detail(symbol, type, order_id, limit=nil, page=nil )
  endpoint = '/v1/order/detail'
  query_string = {limit: limit, orderOid: order_id, page: page, symbol: symbol, type: type}
  KucoinRuby::Net.signed_get(endpoint, query_string)
end

.symbol_dealt_order(symbol, type = nil, limit = nil, page = nil) ⇒ Object



34
35
36
37
38
# File 'lib/kucoin_ruby/trading.rb', line 34

def self.symbol_dealt_order(symbol, type=nil, limit=nil, page=nil )
  endpoint = '/v1/deal-orders'
  query_string = {limit: limit, page: page, symbol: symbol, type: type}
  KucoinRuby::Net.signed_get(endpoint, query_string)
end