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

Returns Amount of USD to spend in this Bid.

Returns:

  • (BigDecimal)

    Amount of USD to spend in this Bid.



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

def amount
  @amount
end

#created_atTime

Returns Time when this Bid was created.

Returns:

  • (Time)

    Time when this Bid was created.



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

#idInteger

Returns This Bid’s unique ID.

Returns:

  • (Integer)

    This Bid’s unique ID.



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

#priceBigDecimal

Returns Maximum price to pay per unit.

Returns:

  • (BigDecimal)

    Maximum price to pay per unit.



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

#remaining_amountBigDecimal

Returns Amount of USD left to be spent in this Bid.

Returns:

  • (BigDecimal)

    Amount of USD left to be spent in this Bid.



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

def remaining_amount
  @remaining_amount
end

#specieSymbol

Returns :btc or :ltc.

Returns:

  • (Symbol)

    :btc or :ltc



# 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.

Parameters:

  • specie (Symbol)

    :btc or :ltc, whatever you’re buying.

See Also:



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