Class: OandaAPI::Resource::Order

Inherits:
OandaAPI::ResourceBase show all
Defined in:
lib/oanda_api/resource/order.rb

Overview

Order value object. See the Oanda Developer Guide for information about Orders.

Defined Under Namespace

Classes: OrderOpened, TradeOpened, TradeReduced

Instance Attribute Summary collapse

Attributes inherited from OandaAPI::ResourceBase

#location

Instance Method Summary collapse

Methods inherited from OandaAPI::ResourceBase

#to_json

Constructor Details

#initialize(attributes = {}) ⇒ Order


24
25
26
27
28
29
30
31
# File 'lib/oanda_api/resource/order.rb', line 24

def initialize(attributes = {})
  attribs = attributes.dup
  self.order_opened  = attribs.delete(order_opened)  || {}
  self.trade_opened  = attribs.delete(trade_opened)  || {}
  self.trade_reduced = attribs.delete(trade_reduced) || {}
  self.trades_closed = attribs.delete(trades_closed) || []
  super attribs
end

Instance Attribute Details

#expiryObject

Returns the value of attribute expiry


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def expiry
  @expiry
end

#idObject

Returns the value of attribute id


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def id
  @id
end

#instrumentObject

Returns the value of attribute instrument


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def instrument
  @instrument
end

#lower_boundObject

Returns the value of attribute lower_bound


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def lower_bound
  @lower_bound
end

#order_openedObject

Returns the value of attribute order_opened


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def order_opened
  @order_opened
end

#priceObject

Returns the value of attribute price


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def price
  @price
end

#sideObject

Returns the value of attribute side


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def side
  @side
end

#stop_lossObject

Returns the value of attribute stop_loss


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def stop_loss
  @stop_loss
end

#take_profitObject

Returns the value of attribute take_profit


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def take_profit
  @take_profit
end

#timeObject

Returns the value of attribute time


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def time
  @time
end

#trade_openedObject

Returns the value of attribute trade_opened


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def trade_opened
  @trade_opened
end

#trade_reducedObject

Returns the value of attribute trade_reduced


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def trade_reduced
  @trade_reduced
end

#trades_closedObject

Returns the value of attribute trades_closed


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def trades_closed
  @trades_closed
end

#trailing_stopObject

Returns the value of attribute trailing_stop


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def trailing_stop
  @trailing_stop
end

#typeObject

Returns the value of attribute type


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def type
  @type
end

#unitsObject

Returns the value of attribute units


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def units
  @units
end

#upper_boundObject

Returns the value of attribute upper_bound


6
7
8
# File 'lib/oanda_api/resource/order.rb', line 6

def upper_bound
  @upper_bound
end