I have two mysql tables containing daily mutual fund data. I need this data displayed on table on a php page. Nothing very complex.
## Deliverables
I have two mysql tables containing daily mutual fund data. I need this data displayed on table on a php page.
One table, prices_archive, lists the price of one of four mutual funds on five different days. The second table, positions_archive shows the number of shares of those funds held in a sample portfolio on those same five days.?
I've included samples of the prices_archive and positions_archive table and my desired output table in this google spreadsheet:
[login to view URL]
For example in the sample prices_archive table, XBI had a price of 54.5 on Jan 4th and 54.71 on Jan 5th.
In the sample positions_archive table the portfolio held 100 shares of XBI on Jan 5 and 95 shares on Jan 5th.
The output section of the google spreadsheet shows how I need this data echoed on my php page.
The output tables have six colums, and I need a seperate table for each day's worth of portolio holdings, as shown.
Ticker, Shares, Price, and Date are directly echoed from that day's price_archive and position_archive table.
The data in the Value and Percentage columns are derived with simple math:?
Value is the product of Shares and Price. For example XBI on Jan 4 had a price of 54.5, and there were 100 share of it in the portfolio on that date, so the Value figure is 100x54.5 or 5450.
Percentage is the percentage of that holding in the overall portfolio on that day. That number is derived by calculating the total value of the portolio, that dividing that number into the value of the individual security on that day. On Jan 4 the total value of the portfolio was 40599.27. The value of the XBI holding was 5450. 5450/40599.27 = .134238. Take that number and multiply by 100 to get 13.42%.
That's it. Please let me know if you have any questions. Thanks very much.