polygon-io / feature-requests

Feature requests for the Polgon.io Platform. Any bug reports should be opened in polygon-io/issues/issuess
0 stars 0 forks source link

Websocket - Adding exchange and trf timestamps #22

Open RobinhoodFR opened 3 years ago

RobinhoodFR commented 3 years ago

Is your feature request related to a problem? Please describe. Yes. Using the rest API, you provide 3 timestamps: SIP, EXG, TRF. But on a realtime basis using websocket, you provide only SIP timestamp.

Describe the solution you'd like That the websocket provide the 3 timestamps. Ideally nanosec but most importantly 3 timestamps instead of 1 timestamp only.

Describe alternatives you've considered On a realtime basis no alternatives.

Additional context N/A.

Thanks a lot for your time and your answer++

mattsta commented 3 years ago

Just bumping this a bit (related to polygon-io/issues#41 too—would love a binary stream since it would decrease latency by streaming faster due to no need for your servers to buffer+chunk+format data for each subscription into JSON arrays then re-chunk the JSON arrays into WS frames)

Current websocket stream can't provide accurate last trade details because TRF trade reports can be delayed by 10+ minutes or longer sometimes.

Example: when consuming this trade stream, assuming every trade is the "last price", we get some ugly candles because the price jumps from 20.50 to 20.25 then back to 20.50, but the 20.25 trade was clearly a delayed trade (and the "delayed trade" can't be determined by the trade conditions either).

The only solution I currently have is just to exclude all TRF trades from live data since we can't see the actual trade time (without scanning for additional historical API lookups), but excluding all TRF throws out half the volume on some symbols.

Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622837441418, 'p': 20.4999, 's': 500, 'x': 4, 'c': {12}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622837441748, 'p': 20.475, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622837446443, 'p': 20.45, 's': 200, 'x': 11, 'c': {41, 12, 14}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839284597, 'p': 20.25, 's': 4, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839284597, 'p': 20.25, 's': 4, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839286499, 'p': 20.25, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839286499, 'p': 20.25, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839292509, 'p': 20.25, 's': 3, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839292509, 'p': 20.25, 's': 3, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839339021, 'p': 20.25, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839339021, 'p': 20.25, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839345804, 'p': 20.25, 's': 2, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839345804, 'p': 20.25, 's': 2, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839358743, 'p': 20.25, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839358743, 'p': 20.25, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839360759, 'p': 20.25, 's': 4, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622839360759, 'p': 20.25, 's': 4, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840575435, 'p': 20.25, 's': 8, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840575435, 'p': 20.25, 's': 8, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840578048, 'p': 20.25, 's': 1, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840578048, 'p': 20.25, 's': 1, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840580219, 'p': 20.25, 's': 2, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840580219, 'p': 20.25, 's': 2, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840581443, 'p': 20.25, 's': 101, 'x': 4, 'c': {13, 22}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840581443, 'p': 20.25, 's': 101, 'x': 4, 'c': {13, 22}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840582979, 'p': 20.25, 's': 4, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622840582979, 'p': 20.25, 's': 4, 'x': 4, 'c': {37, 13}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622841318859, 'p': 20.49, 's': 57, 'x': 11, 'c': {41, 12, 37, 14}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622841320630, 'p': 20.49, 's': 4, 'x': 11, 'c': {41, 12, 37, 14}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622841322687, 'p': 20.49, 's': 46, 'x': 11, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622841323924, 'p': 20.49, 's': 3, 'x': 11, 'c': {41, 12, 37, 14}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622841324018, 'p': 20.495, 's': 1, 'x': 4, 'c': {12, 37}}
Low trade:  {'ev': 'T', 'sym': 'MVIS', 't': 1622841324538, 'p': 20.495, 's': 1, 'x': 4, 'c': {12, 37}}
RobinhoodFR commented 2 years ago

Hello!

Coming back to this possible enhancement, di you planned to add the feature? Thanks for your reply++

RobinhoodFR commented 2 years ago

The fact that the rest api and the websocket are not on the same boat (given the timestamps issues) is clearly a huge bad point for polygon.io

matichenor commented 2 years ago

We don't yet have a scheduled date for this feature, however we are still considering it for a future roadmap. We are exploring the concept of making additional fields and granularity of timestamp optional and configurable on subscription. The challenge we are balancing is making these changes by fiat could drive up bandwidth needs and processing costs for users, resulting in some users struggling to keep up with the feed.

We'll keep you posted as we work toward a solution.