Class: CoinSync::Importers::BittrexCSV::HistoryEntry

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

Constant Summary collapse

TIME_FORMAT =
'%m/%d/%Y %H:%M:%S %p %z'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ HistoryEntry

Returns a new instance of HistoryEntry.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/coinsync/importers/bittrex_csv.rb', line 20

def initialize(line)
  @uuid = line[0]
  @currency, @asset = line[1].split('-').map { |c| CryptoCurrency.new(c) }
  @type = line[2]
  @quantity = BigDecimal.new(line[3])
  @limit = BigDecimal.new(line[4])
  @commission = BigDecimal.new(line[5])
  @price = BigDecimal.new(line[6])
  @time_opened = Time.strptime(line[7] + ' +0000', TIME_FORMAT)
  @time_closed = Time.strptime(line[8] + ' +0000', TIME_FORMAT)
end

Instance Attribute Details

#assetObject

Returns the value of attribute asset.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def asset
  @asset
end

#commissionObject

Returns the value of attribute commission.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def commission
  @commission
end

#currencyObject

Returns the value of attribute currency.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def currency
  @currency
end

#limitObject

Returns the value of attribute limit.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def limit
  @limit
end

#priceObject

Returns the value of attribute price.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def quantity
  @quantity
end

#time_closedObject

Returns the value of attribute time_closed.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def time_closed
  @time_closed
end

#time_openedObject

Returns the value of attribute time_opened.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def time_opened
  @time_opened
end

#typeObject

Returns the value of attribute type.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def type
  @type
end

#uuidObject

Returns the value of attribute uuid.



17
18
19
# File 'lib/coinsync/importers/bittrex_csv.rb', line 17

def uuid
  @uuid
end