Find Jobs
Hire Freelancers

Code to Update Values in MYSQL table

$30-5000 USD

Completed
Posted almost 14 years ago

$30-5000 USD

Paid on delivery
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 = 10038.19/1.0 = 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 = 9999.66/1.0. 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.
Project ID: 3478257

About the project

16 proposals
Remote project
Active 14 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$15 USD in 3 days
4.9 (137 reviews)
5.4
5.4
16 freelancers are bidding on average $71 USD for this job
User Avatar
See private message.
$170 USD in 3 days
5.0 (381 reviews)
8.6
8.6
User Avatar
See private message.
$339.15 USD in 3 days
4.9 (131 reviews)
7.0
7.0
User Avatar
See private message.
$42.50 USD in 3 days
4.9 (300 reviews)
6.9
6.9
User Avatar
See private message.
$85 USD in 3 days
4.7 (244 reviews)
6.3
6.3
User Avatar
See private message.
$25.50 USD in 3 days
4.8 (79 reviews)
5.8
5.8
User Avatar
See private message.
$8.50 USD in 3 days
5.0 (55 reviews)
5.7
5.7
User Avatar
See private message.
$85 USD in 3 days
4.9 (84 reviews)
5.3
5.3
User Avatar
See private message.
$17.84 USD in 3 days
5.0 (92 reviews)
5.1
5.1
User Avatar
See private message.
$102 USD in 3 days
5.0 (44 reviews)
5.1
5.1
User Avatar
See private message.
$42.50 USD in 3 days
4.9 (23 reviews)
4.4
4.4
User Avatar
See private message.
$51 USD in 3 days
4.5 (9 reviews)
3.2
3.2
User Avatar
See private message.
$42.50 USD in 3 days
5.0 (8 reviews)
2.8
2.8
User Avatar
See private message.
$4.25 USD in 3 days
5.0 (4 reviews)
1.3
1.3
User Avatar
See private message.
$21.25 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$85 USD in 3 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
United States
5.0
55
Payment method verified
Member since Feb 13, 2007

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.