lib/tordist/generator.rb in tordist-0.1.1 vs lib/tordist/generator.rb in tordist-0.1.2

- old
+ new

@@ -1,7 +1,11 @@ class Tordist::Generator + def initialize(clearing_id) + @clearing_id = clearing_id + end + def generate(transactions) @transactions = transactions tordist_string = header tordist_string = tordist_string + body end @@ -9,11 +13,10 @@ def header return "H#{header_date}#{header_broker}TORDISTM\n" end def body - # BBEEF3 0783382000000000680000000000000V216044400001809257C1 +000000000000000 body_string = "" @transactions.each do |transaction| @transaction = transaction body_string = body_string + "#{type}#{symbol}#{@transaction.broker_alias_code}#{client_digit}#{quantity}#{price}#{@transaction.side}#{liquidation_portfolio}#{nil_user}#{liquidation_type}#{bvmf}#{nil_last_fields}#{@transaction.broker}\n" end @@ -25,10 +28,10 @@ def header_date @transactions.first.date.strftime("%d/%m/%Y") end def header_broker - @transactions.first.broker + @clearing_id end def symbol symbol_text = @transaction.symbol remaining_chars = "" \ No newline at end of file