Tagged with architecture

Basic building blocks

So, I sat down tonight and sketched out the basic building blocks of everything. Here is what we have.

Conceptual Architecture

    • The basic building block of PART is the book.
    • A book
      • Contains zero or more portfolios.
      • Has a name, and a currency.
    • A portfolio
      • Must have the same currency as its container book.
      • Contains one or more positions
    • A position
      • Contains exactly one equity
      • The equity must have the same currency as the portfolio, and by extension, the book
      • Contains zero or more trades
      • Contains zero or more dividends
      • May belong to more than one portfolio (and by extension, may belong to only one book, since all portfolios are in the same book)
    • An equity
      • Has a ticker
      • Has an exchange it is listed on
      • Has a currency.  The currency must be the same as the position/portfolio/book that this equity belongs to
      • Can belong to one or more portfolios
        • Note that an equity can belong to multiple portfolios; this is because the actual trades and dividends related to the equity are abstracted away in the position.
      • Can belong to only one position
    • A trade
      • Is specific to a given position-equity 2-tuple
      • Has a date
      • Has a time
      • Has a number of shares
      • Has a commission
      • Has a share price
    • A dividend
      • Is a special type of trade
      • Has only a cash portion
      • I made the executive position of only taking the aggregate dollar amount of the dividend; you could list it as the dividend per share, but that gets complicated since my statements only list it as a dollar amount and I’m lazy — I don’t want to do the math
    • A currency
      • Is a pretty basic type, it only has the currency symbol (e.g. CAD, USD, etc.)

And there we have it. That is the basis of the entire system. Of course, there are some ancillary functions such as load/save of books, add/delete/modify trades, etc. But at a high level those are the basic building blocks of everything.  I’m going to have to buy a copy of Visio or something to sketch out the appropriate UML diagram for all of these building blocks.