Class: Fsxtrader::Trade
- Inherits:
-
Object
- Object
- Fsxtrader::Trade
- Defined in:
- lib/fsxtrader/trade.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#key ⇒ Object
Returns the value of attribute key.
-
#limit_price ⇒ Object
Returns the value of attribute limit_price.
-
#shares ⇒ Object
Returns the value of attribute shares.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
-
#trade_str ⇒ Object
Returns the value of attribute trade_str.
Instance Method Summary collapse
-
#initialize(key, trade_str) ⇒ Trade
constructor
A new instance of Trade.
- #to_s ⇒ Object
Constructor Details
#initialize(key, trade_str) ⇒ Trade
Returns a new instance of Trade.
5 6 7 8 9 10 11 12 |
# File 'lib/fsxtrader/trade.rb', line 5 def initialize(key, trade_str) # Expected params: "RDN >= 17.25 cover 110000" # or : "IBM <= 85 sell 50000" @key = key @trade_str = trade_str @symbol, @condition, @limit_price, @action, @shares = *trade_str.split @shares = @shares.gsub(',', '') # strip commas end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
3 4 5 |
# File 'lib/fsxtrader/trade.rb', line 3 def action @action end |
#condition ⇒ Object
Returns the value of attribute condition.
3 4 5 |
# File 'lib/fsxtrader/trade.rb', line 3 def condition @condition end |
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'lib/fsxtrader/trade.rb', line 3 def key @key end |
#limit_price ⇒ Object
Returns the value of attribute limit_price.
3 4 5 |
# File 'lib/fsxtrader/trade.rb', line 3 def limit_price @limit_price end |
#shares ⇒ Object
Returns the value of attribute shares.
3 4 5 |
# File 'lib/fsxtrader/trade.rb', line 3 def shares @shares end |
#symbol ⇒ Object
Returns the value of attribute symbol.
3 4 5 |
# File 'lib/fsxtrader/trade.rb', line 3 def symbol @symbol end |
#trade_str ⇒ Object
Returns the value of attribute trade_str.
4 5 6 |
# File 'lib/fsxtrader/trade.rb', line 4 def trade_str @trade_str end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/fsxtrader/trade.rb', line 13 def to_s "#{action} #{shares} of #{symbol} when it is #{condition} #{limit_price}" end |