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.



99
100
101
# File 'lib/bitex/order.rb', line 99

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 91

#idInteger

Returns This Bid’s unique ID.

Returns:

  • (Integer)

    This Bid’s unique ID.



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

#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/order.rb', line 127

#priceBigDecimal

Returns Maximum price to pay per unit.

Returns:

  • (BigDecimal)

    Maximum price to pay per unit.



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

#produced_quantityBigDecimal

Returns Quantity of specie produced by this bid so far.

Returns:

  • (BigDecimal)

    Quantity of specie produced by this bid so far.



125
126
127
# File 'lib/bitex/order.rb', line 125

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/order.rb', line 116

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



103
104
105
# File 'lib/bitex/order.rb', line 103

def remaining_amount
  @remaining_amount
end

#specieSymbol

Returns :btc or :ltc.

Returns:

  • (Symbol)

    :btc or :ltc



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

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

Class Method Details

.create!(specie, amount, price, wait = false) ⇒ 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.

  • 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:



144
145
146
# File 'lib/bitex/order.rb', line 144

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