# TODO more specific
const CashQuantity = Unitful.Quantity 
const CashType = Unitful.FreeUnits


####
#### Brokerage
####

abstract type Brokerage end


####
#### Asset
####

abstract type Asset end

fullsymbol(c::Asset) = "$(string(nameof(typeof(c)))):$(_fullsymbol(c))"


struct Stock <: Asset
    symbol::String
    exchange::String
    currency::CashType
end

_fullsymbol(c::Stock) = "$(c.exchange):$(c.symbol)"
currency(c::Stock) = c.currency


####
#### Position
####

struct Position{C<:Asset}
    contract::C
    position::Float64
    market_price::CashQuantity
    market_value::CashQuantity
    average_cost::CashQuantity
end

function Position(contract, position, market_price, market_value, average_cost::Real)
    # TODO is avg_cost in units of contract or account currency?
    Position(contract, position, market_price, market_value, average_cost * currency(contract))
end


####
#### Account
####

abstract type Account end
