Hi all,
I need some help in how to structure the portfolio management database I am constructing.
Essentially, I have an Accounts table, an Equities table, a Transactions table, a Stock Events table and a Currency Exchange table.
The Accounts table holds information regarding an individual investment account.
The Equities table holds information regarding an individual stock. Name, exchange traded, stock symbol, etc.
The Transactions table handles information regarding a transaction that occurs in an individual account. Buy, sell or move a stock, number of shares, account number, stock symbol.
The Stock Events table holds information that happens to a stock in general, such as stock splits, dividend payouts, name changes, mergers, acquisitions, etc.
The currency exchange records the date, foreign currency and exchange rate relative to the CDN dollar.
What I need to do is create a query such that it works it's way through the individual tables and calculates the stock positions held on a specific date in each account.
For example, in Transactions say you have the following:
Acct. 1, Buy 500 shares Nextel on July 10, 03 at $5.00
Acct. 1, Sell 300 shares Nextel on July 20, 03 at $6.00
Acct. 1, Sell 100 shares Nextel on July 31, 03 at $3.25
In Stock Events you have the following:
Nextel 2 for 1 stock split on July 25, 2003.
So, if you were to request an update as of July 21, you would get the following:
Acct. 1, 200 shares Nextel at $5.00 cost, Cash $1800.
An update as of August 1 would produce the following:
Acct. 1, 300 shares Nextel at $2.50 cost, Cash $2125.
If someone could point me in the proper direction of solving this problem, it'd be of great help. I don't specifically need the code, I do know some SQL, but more of a general understanding of how to solve the problem would be much appreciated.
Thanks!
I need some help in how to structure the portfolio management database I am constructing.
Essentially, I have an Accounts table, an Equities table, a Transactions table, a Stock Events table and a Currency Exchange table.
The Accounts table holds information regarding an individual investment account.
The Equities table holds information regarding an individual stock. Name, exchange traded, stock symbol, etc.
The Transactions table handles information regarding a transaction that occurs in an individual account. Buy, sell or move a stock, number of shares, account number, stock symbol.
The Stock Events table holds information that happens to a stock in general, such as stock splits, dividend payouts, name changes, mergers, acquisitions, etc.
The currency exchange records the date, foreign currency and exchange rate relative to the CDN dollar.
What I need to do is create a query such that it works it's way through the individual tables and calculates the stock positions held on a specific date in each account.
For example, in Transactions say you have the following:
Acct. 1, Buy 500 shares Nextel on July 10, 03 at $5.00
Acct. 1, Sell 300 shares Nextel on July 20, 03 at $6.00
Acct. 1, Sell 100 shares Nextel on July 31, 03 at $3.25
In Stock Events you have the following:
Nextel 2 for 1 stock split on July 25, 2003.
So, if you were to request an update as of July 21, you would get the following:
Acct. 1, 200 shares Nextel at $5.00 cost, Cash $1800.
An update as of August 1 would produce the following:
Acct. 1, 300 shares Nextel at $2.50 cost, Cash $2125.
If someone could point me in the proper direction of solving this problem, it'd be of great help. I don't specifically need the code, I do know some SQL, but more of a general understanding of how to solve the problem would be much appreciated.
Thanks!