Module: Bitstamp::HTTP::Orders

Included in:
Client
Defined in:
lib/bitstamp/http/orders.rb

Instance Method Summary collapse

Instance Method Details

#buy_limit_order(nonce: nil, amount:, price:, limit_price: nil, currency_pair:) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bitstamp/http/orders.rb', line 31

def buy_limit_order(nonce: nil, amount:, price:, limit_price: nil, currency_pair:)
  params = {
    nonce:  nonce,
    amount: amount,
    price:  price
  }

  if limit_price != nil
    params[:limit_price] = limit_price
  end

  call(request_uri('v2', 'buy', currency_pair), 'POST', params)
end

#buy_market_order(nonce: nil, amount:, currency_pair:) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/bitstamp/http/orders.rb', line 45

def buy_market_order(nonce: nil, amount:, currency_pair:)
  params = {
    nonce:       nonce,
    amount:      amount,
  }

  call(request_uri('v2', 'buy', 'market', currency_pair), 'POST', params)
end

#cancel_all_orders(nonce: nil) ⇒ Object



25
26
27
28
29
# File 'lib/bitstamp/http/orders.rb', line 25

def cancel_all_orders(nonce: nil)
  params = { nonce: nonce }

  call(request_uri('cancel_all_orders'), 'POST', params)
end

#cancel_order(nonce: nil, id:) ⇒ Object



19
20
21
22
23
# File 'lib/bitstamp/http/orders.rb', line 19

def cancel_order(nonce: nil, id:)
  params = { nonce: nonce, id: id }

  call(request_uri('v2', 'cancel_order'), 'POST', params)
end

#open_orders(nonce: nil, currency_pair: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/bitstamp/http/orders.rb', line 3

def open_orders(nonce: nil, currency_pair: nil)
  params = { nonce: nonce }

  if currency_pair == nil
    call(request_uri('v2', 'open_orders', 'all'), 'POST', params)
  else
    call(request_uri('v2', 'open_orders', currency_pair), 'POST', params)
  end
end

#order_status(nonce: nil, id:) ⇒ Object



13
14
15
16
17
# File 'lib/bitstamp/http/orders.rb', line 13

def order_status(nonce: nil, id:)
  params = { nonce: nonce, id: id }

  call(request_uri('v2', 'order_status'), 'POST', params)
end

#sell_limit_order(nonce: nil, amount:, price:, limit_price: nil, currency_pair:) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/bitstamp/http/orders.rb', line 54

def sell_limit_order(nonce: nil, amount:, price:, limit_price: nil, currency_pair:)
  params = {
    nonce:       nonce,
    amount:      amount,
    price:       price
  }

  if limit_price != nil
    params[:limit_price] = limit_price
  end

  call(request_uri('v2', 'sell', currency_pair), 'POST', params)
end

#sell_market_order(nonce: nil, amount:, currency_pair:) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/bitstamp/http/orders.rb', line 68

def sell_market_order(nonce: nil, amount:, currency_pair:)
  params = {
    nonce:       nonce,
    amount:      amount,
  }

  call(request_uri('v2', 'sell', 'market', currency_pair), 'POST', params)
end