Numbercrunching (using a single stock quote for Barclays) …
The variables available for a single stock quote are:
stock symbol
last trade
trade time
date
change (+ or -)
open
day's range: high
day's range: low
volume
The variables in bold are the useable numbers.
I started looking at volume to see how I could use it. I had assumed that this was a simple cumulative total volume of trades for the day, but on experimenting with it, I discovered that although most of the time it was acting as expected, occasionally the number actually falls. I have been unable to find out why this might be, or what this number specifically represents, so given the timescale of this project, I have decided not to use this number.
last trade price
Next, I tried comparing the last trade price with the 52 week range (available on the Yahoo website) …
52 week range = 117.2 - 578.5
difference of 461.3let 117.2 = the bottom of the scale, i.e. 0%
and let 578.5 = the top of the scale, i.e. 100%so the current price of 167 as a percentage on my scale = … …
((167-117.2)*100)/461.3 = 10.80% (to 2dp)
But looking at the graph, I am concerned that the scale is too wide and that the data will not change enough to make a noticeable difference in the resulting face.
Next, I tried the same thing using a 6 month range …
26 week range = 117.2 - 390.75
difference of 273.55let 117.2 = the bottom of the scale, i.e. 0%
and let 390.75 = the top of the scale, i.e. 100%so the current price of 167 as a percentage on my scale = … …
((167-117.2)*100)/273.55 = 18.21% (to 2dp)
then 3 months …
3 month range = 117.2 - 389
difference of 271.8let 117.2 = the bottom of the scale, i.e. 0%
and let 389 = the top of the scale, i.e. 100%so the current price of 167 as a percentage on my scale = … …
((167-117.2)*100)/271.8 = 18.32% (to 2dp)
one month …
1 month range = 117.2 - 205.25
difference of 88.05let 117.2 = the bottom of the scale, i.e. 0%
and let 205.25 = the top of the scale, i.e. 100%so the current price of 167 as a percentage on my scale = … …
((167-117.2)*100)/88.05 = 56.56% (to 2dp)
five days …
5 day range = 132.5 - 170
difference of 37.5let 132.5 = the bottom of the scale, i.e. 0%
and let 170 = the top of the scale, i.e. 100%so the current price of 167 as a percentage on my scale = … …
((167-132.5)*100)/37.5 = 92.00% (to 2dp)
and finally, one day …
1 day range = 162.5 - 170
difference of 7.5let 162.5 = the bottom of the scale, i.e. 0%
and let 170 = the top of the scale, i.e. 100%so the current price of 167 as a percentage on my scale = … …
((167-162.5)*100)/7.5 = 60.00% (to 2dp)
So the problem is that the same number could be represented as anything from 10% to 90% depending on the chosen scale. If I get time I will make buttons for people to choose the scale. For now though I will just choose one: the one day's range, because these numbers are present in the same .csv file.
here's the face numbers I need to map this stuff onto:
Facial variable | sad | happy | surprised | afraid |
eyeOffset | 10 | 30 | 30 | 10 |
eyeWidth | 40 | 90 | 90 | 40 |
eyeTopHeight | -10 | 40 | 60 | 60 |
eyeBottomHeight | 40 | -10 | 60 | 60 |
eyebrowSlant | 30 | 0 | 0 | 30 |
mouthWidth | 40 | 100 | 60 | 40 |
mouthTopHeight | 40 | -10 | 80 | 80 |
mouthBottomHeight | -10 | 40 | 80 | 80 |
stock symbol
last trade
trade time
date
change (+ or -)
open
day's range: high
day's range: low
volume