Module: KucoinRuby::Trading

Defined in:
lib/kucoin_ruby/trading.rb

Class Method Summary collapse

Class Method Details

.active_orders(symbol = nil) ⇒ Object



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

def self.active_orders(symbol = nil)
  endpoint = '/v1/order/active'
  query_string = {symbol: symbol}
  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/cancel-order'
  payload = {symbol: symbol, type: type, orderOid: order_id}
  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/order'
  payload = {symbol: symbol, type: type, price: price, amount: amount}
  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
  }.keep_if{|_,y| y}
  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}.keep_if{|_,y| y}
  KucoinRuby::Net.signed_get(endpoint, query_string)
end