Class: SQA::Portfolio::Trade

Inherits:
Struct
  • Object
show all
Defined in:
lib/sqa/portfolio.rb

Overview

Represents a single trade

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def action
  @action
end

#commissionObject

Returns the value of attribute commission

Returns:

  • (Object)

    the current value of commission



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def commission
  @commission
end

#dateObject

Returns the value of attribute date

Returns:

  • (Object)

    the current value of date



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def date
  @date
end

#priceObject

Returns the value of attribute price

Returns:

  • (Object)

    the current value of price



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def price
  @price
end

#sharesObject

Returns the value of attribute shares

Returns:

  • (Object)

    the current value of shares



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def shares
  @shares
end

#tickerObject

Returns the value of attribute ticker

Returns:

  • (Object)

    the current value of ticker



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def ticker
  @ticker
end

#totalObject

Returns the value of attribute total

Returns:

  • (Object)

    the current value of total



27
28
29
# File 'lib/sqa/portfolio.rb', line 27

def total
  @total
end

Instance Method Details

#to_hObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sqa/portfolio.rb', line 28

def to_h
  {
    ticker: ticker,
    action: action,
    shares: shares,
    price: price,
    date: date,
    total: total,
    commission: commission
  }
end