Class: Bitex::Bid

Inherits:
OrderBase show all
Defined in:
lib/bitex/order.rb

Overview

A Bid is an order to buy a given specie.

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from OrderBase

active, all, #cancel!, find

Instance Attribute Details

#amountBigDecimal



65
66
67
# File 'lib/bitex/order.rb', line 65

def amount
  @amount
end

#created_atTime



# File 'lib/bitex/order.rb', line 57


#idInteger



# File 'lib/bitex/order.rb', line 54


#priceBigDecimal



# File 'lib/bitex/order.rb', line 71


#remaining_amountBigDecimal



69
70
71
# File 'lib/bitex/order.rb', line 69

def remaining_amount
  @remaining_amount
end

#specieSymbol



# File 'lib/bitex/order.rb', line 60


#statusObject

The status of this Bid in its lifecycle.

  • :received queued to check if you have enough funds.

  • :executing available in our ourderbook waiting to be matched.

  • :cancelling To be cancelled as soon as our trading engine unlocks it.

  • :cancelled no further executed. May have some Remaining Amount.

  • :completed Fully executed, Remaining Amount should be 0.



# File 'lib/bitex/order.rb', line 74


Class Method Details

.create!(specie, amount, price) ⇒ Object

Create a new Bid for spending Amount USD paying no more than price per unit.



91
92
93
94
95
96
97
98
# File 'lib/bitex/order.rb', line 91

def self.create!(specie, amount, price)
  params = {
    amount: amount,
    price: price,
    specie: {btc: 1, ltc: 2}[specie]
  }
  from_json(Api.private(:post, "/private#{base_path}", params))
end