Class: CoinSync::Importers::EtherDelta::HistoryEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/coinsync/importers/etherdelta.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ HistoryEntry

Returns a new instance of HistoryEntry.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def amount
  @amount
end

#dateObject

Returns the value of attribute date.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def date
  @date
end

#feeObject

Returns the value of attribute fee.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def fee
  @fee
end

#fee_tokenObject

Returns the value of attribute fee_token.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def fee_token
  @fee_token
end

#priceObject

Returns the value of attribute price.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def price
  @price
end

#tokenObject

Returns the value of attribute token.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def token
  @token
end

#totalObject

Returns the value of attribute total.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def total
  @total
end

#tradeObject

Returns the value of attribute trade.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def trade
  @trade
end

#typeObject

Returns the value of attribute type.



20
21
22
# File 'lib/coinsync/importers/etherdelta.rb', line 20

def type
  @type
end