Class: BaaChan::TradeConfirmation
- Inherits:
-
Object
- Object
- BaaChan::TradeConfirmation
- Defined in:
- lib/baa_chan/trade_confirmation.rb
Instance Attribute Summary collapse
-
#broker ⇒ Object
Returns the value of attribute broker.
-
#costs ⇒ Object
Returns the value of attribute costs.
-
#trade_confirmation_number ⇒ Object
Returns the value of attribute trade_confirmation_number.
-
#trade_date ⇒ Object
Returns the value of attribute trade_date.
-
#trades ⇒ Object
Returns the value of attribute trades.
Instance Method Summary collapse
-
#initialize(broker, trade_confirmation_number, trade_date, trades, costs) ⇒ TradeConfirmation
constructor
A new instance of TradeConfirmation.
- #to_builder ⇒ Object
- #total_cost ⇒ Object
Constructor Details
#initialize(broker, trade_confirmation_number, trade_date, trades, costs) ⇒ TradeConfirmation
Returns a new instance of TradeConfirmation.
9 10 11 12 13 14 15 |
# File 'lib/baa_chan/trade_confirmation.rb', line 9 def initialize(broker, trade_confirmation_number, trade_date, trades, costs) @broker = broker @trade_confirmation_number = trade_confirmation_number @trade_date = trade_date @trades = trades @costs = costs end |
Instance Attribute Details
#broker ⇒ Object
Returns the value of attribute broker.
7 8 9 |
# File 'lib/baa_chan/trade_confirmation.rb', line 7 def broker @broker end |
#costs ⇒ Object
Returns the value of attribute costs.
7 8 9 |
# File 'lib/baa_chan/trade_confirmation.rb', line 7 def costs @costs end |
#trade_confirmation_number ⇒ Object
Returns the value of attribute trade_confirmation_number.
7 8 9 |
# File 'lib/baa_chan/trade_confirmation.rb', line 7 def trade_confirmation_number @trade_confirmation_number end |
#trade_date ⇒ Object
Returns the value of attribute trade_date.
7 8 9 |
# File 'lib/baa_chan/trade_confirmation.rb', line 7 def trade_date @trade_date end |
#trades ⇒ Object
Returns the value of attribute trades.
7 8 9 |
# File 'lib/baa_chan/trade_confirmation.rb', line 7 def trades @trades end |
Instance Method Details
#to_builder ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/baa_chan/trade_confirmation.rb', line 25 def to_builder Jbuilder.encode do |json| json.call( self, :broker, :trade_confirmation_number, :trade_date ) json.trades @trades do |trade| json.operation trade.operation json.ticker trade.ticker json.quantity trade.quantity json.price trade.price end json.costs do json.brokerage @costs.brokerage json.clearing_fee @costs.clearing_fee json.registration_fee @costs.registration_fee json.emoluments @costs.emoluments json.iss @costs.iss if @costs.iss json.irrf @costs.irrf if @costs.irrf json.pis_cofins @costs.pis_cofins if @costs.pis_cofins end end end |
#total_cost ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/baa_chan/trade_confirmation.rb', line 17 def total_cost @costs.brokerage + @costs.registration_fee + @costs.emoluments + @costs.pis_cofins + @costs.clearing_fee end |