class CoinSync::Importers::Circle

Public Instance Methods

read_transaction_list(source) click to toggle source
# File lib/coinsync/importers/circle.rb, line 32
def read_transaction_list(source)
  csv = CSV.new(source, col_sep: ',')

  transactions = []

  csv.each do |line|
    next if line[0] == 'Date'

    entry = HistoryEntry.new(line)

    next if entry.type != 'deposit'

    transactions << Transaction.new(
      exchange: 'Circle',
      bought_currency: entry.to_currency,
      sold_currency: entry.from_currency,
      time: entry.date,
      bought_amount: entry.to_amount,
      sold_amount: entry.from_amount
    )
  end

  transactions
end