Class: Bitex::Bid

Inherits:
BaseOrder show all
Defined in:
lib/bitex/bid.rb

Overview

A Bid is an order to buy a given order book.

See Also:

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from BaseOrder

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.



16
17
18
# File 'lib/bitex/bid.rb', line 16

def amount
  @amount
end

#created_atTime

Returns Time when this Bid was created.

Returns:

  • (Time)

    Time when this Bid was created.



# File 'lib/bitex/bid.rb', line 8


#idInteger

Returns This Bid’s unique ID.

Returns:

  • (Integer)

    This Bid’s unique ID.



# File 'lib/bitex/bid.rb', line 5


#issuerString

Returns The issuer of this order, helps you tell apart orders created from the web UI and the API.

Returns:

  • (String)

    The issuer of this order, helps you tell apart orders created from the web UI and the API.



# File 'lib/bitex/bid.rb', line 45


#order_bookSymbol

Returns :btc_usd or :btc_ars.

Returns:

  • (Symbol)

    :btc_usd or :btc_ars



# File 'lib/bitex/bid.rb', line 11


#priceBigDecimal

Returns Maximum price to pay per unit.

Returns:

  • (BigDecimal)

    Maximum price to pay per unit.



# File 'lib/bitex/bid.rb', line 22


#produced_quantityBigDecimal

TODO: rever esta documentacion

Returns:

  • (BigDecimal)

    Quantity of specie produced by this bid so far.



43
44
45
# File 'lib/bitex/bid.rb', line 43

def produced_quantity
  @produced_quantity
end

#reasonObject

The cancellation reason for this Bid, if any.

  • :not_cancelled Has not been cancelled.

  • :not_enough_funds Not enough funds to place this order.

  • :user_cancelled Cancelled per user’s request

  • :system_cancelled Bitex cancelled this order, for a good reason.



# File 'lib/bitex/bid.rb', line 33


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



20
21
22
# File 'lib/bitex/bid.rb', line 20

def remaining_amount
  @remaining_amount
end

#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/bid.rb', line 25


Class Method Details

.create!(order_book, amount, price, wait = false) ⇒ Object

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

Parameters:

  • order_book (Symbol)

    :btc_usd or :btc_ars, whatever you’re buying.

  • amount (BigDecimal)

    Amount to spend buying.

  • price (BigDecimal)

    Maximum price to pay per unit.

  • wait (Boolean) (defaults to: false)

    Block the process and wait until this bid moves out of the :received state, defaults to false.

See Also:



59
60
61
# File 'lib/bitex/bid.rb', line 59

def self.create!(order_book, amount, price, wait = false)
  super
end