Class: BitcointradeSDK::Market

Inherits:
Base
  • Object
show all
Defined in:
lib/bitcointrade_sdk/market.rb

Constant Summary

Constants inherited from Base

Base::BASE_URL

Instance Method Summary collapse

Methods inherited from Base

#send_request

Instance Method Details

#book_orders(currency:) ⇒ Object



5
6
7
# File 'lib/bitcointrade_sdk/market.rb', line 5

def book_orders(currency:)
  send_request(:get, '/market', { currency: currency })['data']
end

#cancel_order(order_id:) ⇒ Object



29
30
31
# File 'lib/bitcointrade_sdk/market.rb', line 29

def cancel_order(order_id:)
  send_request(:delete, '/market/user_orders', { id: order_id })['data']
end

#create_order!(currency:, type:, subtype:, amount:, unit_price:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bitcointrade_sdk/market.rb', line 13

def create_order!(currency:, type:, subtype:, amount:, unit_price:)
  params = {
    'currency'    => currency,
    'type'        => type,
    'subtype'     => subtype,
    'amount'      => amount,
    'unit_price'  => unit_price
  }

  send_request(:post, '/market/create_order', params)['data']
end

#estimated_price(opts: {}) ⇒ Object



33
34
35
# File 'lib/bitcointrade_sdk/market.rb', line 33

def estimated_price(opts: {})
  send_request(:get, '/market/estimated_price', {})['data']
end

#summary(currency:) ⇒ Object



9
10
11
# File 'lib/bitcointrade_sdk/market.rb', line 9

def summary(currency:)
  send_request(:get, '/market/summary', { currency: currency })['data']
end

#user_orders(opts: {}) ⇒ Object



25
26
27
# File 'lib/bitcointrade_sdk/market.rb', line 25

def user_orders(opts: {})
  send_request(:get, '/market/user_orders', opts)['data']
end