New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Forex Price Spikes #668
Comments
Hey @jbonilla-tao. sorry for the delay here. I've pinged the backend team to check this out and I'll let you know. Thanks for the detailed write up and images too. This really helps. |
Hi @justinpolygon thanks for responding. I found that filtering quote data when the bid and ask are more than .5% apart filters these weird spikes |
Thanks @jbonilla-tao. I was able to confirm with the engineering and data teams that we are indeed building aggs for forex off of BBO (Quote) data. The aggs are generated using the bid side of these quotes. I'll get the documentation updated to make sure this is clear. There is also active research/engineering work happening on our end to look at this. Again, sorry this wasn't more clear and thank you for such a detailed report it really help to track things down. |
Thanks @justinpolygon I see the aggs are built from the quotes and do some kind of filtering.
Is built from these quotes What is the algorithm to filter out quotes? Some kind of statistical analysis? One of the three quotes is not reflect in the agg. |
Forex Websocket prices ("CAS.*") and Agg Data have occasional price spikes. These price spikes don't align with TradingView chart or Forex.com.
I found the reason why:
Polygon.io is using exchange bid price instead of trade price to populate websocket and agg data.
Here I am printing prices of CADJPY. The price 112.735 is an outlier that never happened. That price came from a stink bid on the exchange.
Print outs of Aggs and Quotes for the surrounding timestamps:
Attaching images of these crazy spikes when monitoring websocket data:
Possible solutions:
Get actual trade data from data providers and use this to populate websocket and agg data instead of faking it.
If trade data is not available, i recommend averaging the bid and ask price instead of just using the bid price. If the delta between bid and ask is too high, discard the price point. This seems to produce reasonable results.
Without a solution, there seems to be no point to having the ""CAS.*" and "Agg" data when it merely uses the bid price in the existing Quote data. I implemented solution #2 already in my branch if you want to reference it, Solution #1 is the proper and preferred fix tho
The text was updated successfully, but these errors were encountered: