Code to Update Values in MYSQL table

Selesai Dipasang Jun 4, 2010 Dibayar saat pengiriman
Selesai Dibayar saat pengiriman

I have a mysql table that contains one month (18 buisiness days total) of daily prices and share amounts of a mutual fund portfolio that consists of five holdings.

I php code that will calculate the 'Value of $10,000 (val10k)' figures for each of these holdings for each day and add it to a column in the table. All the information required to do this is in the table, but I don't know how to do the caculation code in php.

## Deliverables

I have a mysql table that contains one month (18 buisiness days total) of daily prices and share amounts of a mutual fund portfolio that consists of five holdings. I've attached this table.

I php code that will calculate the 'Value of $10,000 (val10k)' figures for each of these holdings for each day and add it to a column in the table. All the information required to do this is in the table, but I don't know how to do the caculation code in php.

The val10k is what the value of $10,000 would be worth if it was invested in a holding. It is used in finance to easily compare performance of two or more investments.

You'll see the mutual fund portfolio tracked in the attached table contains four mutual funds and a cash resevere. The ticker symbols (column 'ticker') of the four mutual funds are XBI, NAESX, VFICX, MFCFX, and the cash reserve is represented by 'cash'.

To determine each day's val10k for a holding, the code will have to calculate the performance of the holding on a given day, then compare it to the performance of the holding on the previous day, then take the result and multiply it by the previous day's val10k figure. Then the code insert the new val10k number into the table and move on to the next day.

To calculate the performance of a holding, the code needs to calculate the holding's current normalized value and compare it to the previous value. To do this the code should multiply a holdings price (price column) by the number of shares held (amount column), then divide that number by the number in the divisor field on that day (the divisor is used to normalize values a holding if shares have been added to or removed from a holding and is usually, but not always, 1), then do the same for the previous day and compare the two.

Here's an example the steps the code needs to do in which we'll determine the val10k for XBI on 2010-01-05:

In the included table you'll see the val10k of each of these five holdings on the first day is $10,000 as this is the first day these funds appear in the portfolio.

1. Determine target day's value:

XBI on 2010-01-05 has a price of 54.71, a share amount of 183.48, and a divisor of 1.0.

54.71 x 183.48 = [url removed, login to view] = 10038.19. The value of our XBI holding on 2010-01-05 is $10038.19.

2. Determine previous day's value:

XBI on 2010-01-05 has a price of 54.50 and a share amount of 183.48 and a divisor of 1.0.

54.50 x 183.48 = [url removed, login to view] The value of our XBI holding on 2010-01-05 is $9999.66.

3. Calculate one day performance:

10038.19/9999.66=1.003853131 then subtract 1 = .003853131 or .3853131%.

4. Multiply one day's performance by previous day's val10k, then add result to previous day's val10k.

The val10k for XBI on 2010-01-04 is 10000.

10000 x .3853131 = 38.53131

10000 + 38.53131 = 10038.53131

val10k for 2010-01-04 is 10038.53.

So the code would then insert 10038.53 into the val10k field in the record with the pa-num of 7 and move on.

Teknik MySQL PHP Manajemen Proyek Perancangan Perangkat Lunak Pengujian Perangkat Lunak Hosting Web Manajemen Situs Web Pengujian Situs Web

ID Proyek: #3478257

Tentang proyek

16 proposal Proyek online Aktif Jun 4, 2010

Diberikan kepada:

DrAKkareS

See private message.

$15 USD dalam 3 hari
(137 Ulasan)
5.4

16 freelancer rata-rata menawar $71 untuk pekerjaan ini

NetzPro

See private message.

$170 USD dalam 3 hari
(381 Ulasan)
8.6
ngscoder

See private message.

$339.15 USD dalam 3 hari
(131 Ulasan)
7.0
hoangvandungbk

See private message.

$42.5 USD dalam 3 hari
(300 Ulasan)
6.9
gkalish

See private message.

$85 USD dalam 3 hari
(244 Ulasan)
6.3
rajamanickam1000

See private message.

$25.5 USD dalam 3 hari
(79 Ulasan)
5.8
spyrosb

See private message.

$8.5 USD dalam 3 hari
(55 Ulasan)
5.7
expertcvw

See private message.

$85 USD dalam 3 hari
(84 Ulasan)
5.3
Purplecoder

See private message.

$17.84 USD dalam 3 hari
(92 Ulasan)
5.1
khalidamin

See private message.

$102 USD dalam 3 hari
(44 Ulasan)
5.1
hassana19

See private message.

$42.5 USD dalam 3 hari
(23 Ulasan)
4.4
openprojdevel

See private message.

$51 USD dalam 3 hari
(9 Ulasan)
3.2
lamerko

See private message.

$42.5 USD dalam 3 hari
(8 Ulasan)
2.8
smplvw

See private message.

$4.25 USD dalam 3 hari
(4 Ulasan)
1.3
leelachhangani

See private message.

$21.25 USD dalam 3 hari
(0 Ulasan)
0.0
ukfreeshop

See private message.

$85 USD dalam 3 hari
(0 Ulasan)
0.0