Module: HuobiApi::Orders

Included in:
Client
Defined in:
lib/huobi_api/orders.rb

Instance Method Summary collapse

Instance Method Details

#new_order(amount:, side:, symbol:, type:, price: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/huobi_api/orders.rb', line 3

def new_order(amount:, side:, symbol:, type:, price: nil)
  options ={
    amount: amount.to_s,
    symbol: symbol,
    type: "#{side}-#{type}",
    source: 'api',
    'account-id': HuobiApi.
  }
  options[:price] = price unless type.to_s == 'market'

  endpoint = '/v1/order/orders/place'
  post(endpoint, options)
end

#order_info(order_id:) ⇒ Object



17
18
19
20
# File 'lib/huobi_api/orders.rb', line 17

def order_info(order_id:)
  endpoint = "/v1/order/orders/#{order_id}"
  get(endpoint, {})
end

#order_match_results(order_id:) ⇒ Object



22
23
24
25
# File 'lib/huobi_api/orders.rb', line 22

def order_match_results(order_id:)
  endpoint = "/v1/order/orders/#{order_id}/matchresults"
  get(endpoint, {})
end