class CoinSync::Importers::EtherDelta::HistoryEntry

Attributes

amount[RW]
date[RW]
fee[RW]
fee_token[RW]
price[RW]
token[RW]
total[RW]
trade[RW]
type[RW]

Public Class Methods

new(line) click to toggle source
# File lib/coinsync/importers/etherdelta.rb, line 22
def initialize(line)
  @type = line[0]

  if !['Maker', 'Taker'].include?(@type)
    raise "EtherDelta importer: incorrect csv format - unexpected '#{@type}' in the first column"
  end

  @trade = line[1]

  if !['Buy', 'Sell'].include?(@trade)
    raise "EtherDelta importer: incorrect csv format - unexpected '#{@trade}' in the second column"
  end

  @token = CryptoCurrency.new(line[2])

  @amount = BigDecimal.new(line[3])
  @price = BigDecimal.new(line[4])
  @total = BigDecimal.new(line[5])
  
  @date = Time.parse(line[6])

  @fee = BigDecimal.new(line[11])
  @fee_token = CryptoCurrency.new(line[12])
end