I am trying to understand how a ticker price is determined for an asset, in this case I am specifically looking at BTC data from GDAX. The question stemmed when downloading historical BTC data from GDAX and seeing the following (truncated):
1516099829,11921.070000000000,0.008100000000 1516099829,11921.070000000000,0.037873260000 1516099829,11921.070000000000,0.031519050000 1516099829,11921.060000000000,0.037464080000 1516099829,11920.000000000000,0.001000000000 1516099829,11912.530000000000,0.001678900000 1516099829,11909.000000000000,0.000100990000 1516099829,11908.360000000000,0.001000000000 1516099829,11908.360000000000,0.001000000000 1516099829,11900.630000000000,0.001680580000 1516099829,11900.000000000000,1.293924550000 1516099829,11900.000000000000,0.132108480000 1516099829,11895.000000000000,0.000300000000 1516099829,11891.170000000000,0.000727720000 1516099829,11890.190000000000,1.400000000000 1516099829,11890.160000000000,0.000838510000 1516099829,11890.000000000000,0.058736000000 1516099829,11888.740000000000,0.001682260000 1516099829,11885.310000000000,0.252173310000 1516099829,11882.920000000000,0.841910000000 1516099829,11876.860000000000,0.001683950000 1516099829,11876.310000000000,0.000728620000 1516099829,11871.000000000000,0.000100990000 1516099829,11871.000000000000,0.000100990000 1516099829,11869.590000000000,0.010000000000 1516099829,11868.000000000000,0.000100990000 1516099829,11865.630000000000,0.010000000000 1516099829,11865.000000000000,0.001685630000 1516099829,11864.490000000000,0.900000000000 1516099829,11864.480000000000,1.113098000000
As you can see, the price fluctuates wildly in a single second. I understand that this data is accurate and shows all of the executed orders for the second, but I do not understand how the ticker value is determined for this second.
I am going off of the (possibly incorrect) assumptions that getting the ticker value from their REST API over and over would not show these wild fluctuations for a single second. I draw this conclusion because I have ran a loop that gets the ticker data over and over with just 300 ms delay and the price has never changed in the same second. As a matter of fact, it shows the same timestamp until the price changes, in which case it shows the new timestamp. This leads me to believe that there is something behind the scenes that is determining the ticker price per second based off all of the trades happening in that second.
If it helps, I am asking this because I want to back-test GDAX data for a program that I have written. In my program, I get the ticker data for the current point in time every two seconds, and receive one value back (the ticker price). Now, when back-testing and 1516099829 comes up, I do not know which price to use. My program will behave very differently depending on which data point I use because the prices vary so heavily.