Trade conditions to match during premarket and afterhours

Discussion in 'Data Sets and Feeds' started by Zuiquan, May 25, 2021.

  1. Zuiquan

    Zuiquan

    Hello,

    I am working on a kind of screener based on PolygonIO realtime feed, and I try to determine the conditions for eligibility of trades during premarket and afterhours.

    So far, I uses this list for the market hours
    https://polygon.io/glossary/us/stocks/conditions-indicators
    https://polygon.io/glossary/us/stocks/trade-conditions

    In a nutshell, a trade is eligible to update the last price if it has no conditions, or all its conditions are in this list:
    0,1,3,4,8,9,11,14,23,25,27,28,30,34,36,38

    However, the trade conditions are still too cryptic for me currently to determine which are the conditions to use during premarket and afterhours.

    I could see that condition 12 is mandatory because it actually specifies that the trade is not produced during market hours

    But, by chance, while I was checking ticker JMIA on tradingview during premarket I saw that a price has been displayed that was not on my homemade screener.
    I checked on polygonIO history and found only 1 trade matching that price around that time, and it had conditions 12 and 60.

    So now, I wonder if I do not miss other conditions outside of market hours.

    Does someone knows which conditions to take into account during premarket, afterhours ?

    Note: For now, I am interested in updating the last price. Soon, I will also need the conditions for the accumulated volume, and then the OHLC prices. Knowing the conditions are not exactly the same.

    Regards.
     
  2. qlai

    qlai

    I suggest you go to the source - CTS and NTDS specs. Each feed publishes up to 4 conditions per trade. These are combined to figure out which fields should be updated, although most are straight forward. The original feeds have flags to specify if last/high/low/volume should be updated, but distributors like Polygon may not be forwarding those or do poor job translating.
    Keep in mind that interpretation of trade conditions is up to the end user and may not exactly match across vendors (like Bloomberg vs Rueters) for corner cases. For example, some may decide that trade should update volume but should not be displayed on the chart. But I doubt you need to go this deep into it.
     
    cruisecontrol likes this.
  3. Zuiquan

    Zuiquan

    Thank you.

    I am quite new in this field, and if some of the conditions description are explicit enough for me to grasp, there are many that are way too cryptic today.
    They might be corner cases, but I wish I could be able to judge of that.

    I think and assume that Polygon is just taking the conditions from the various original sources and translating into a common set of conditions that reflect the various possibilities.

    I appreciate you made me discover that there is an interpretation aspect regarding those conditions.
    So, if I still try to match tradingview interpretation, I would be interested in knowing the set of conditions you guys use for a screener in premarket or afterhours.
    This should help me build my tradingview-matching set.

    Regards.
     
  4. qlai

    qlai

    It's been awhile since I've been involved with market data, but if you have any specific questions ask and I'll try to recollect :)
     
  5. Polygon.io

    Polygon.io Sponsor

    Hi! Jack from Polygon.io here.

    Condition code 60 indicates an SSR In Effect, which has no effect on the eligibility, so it is counted. I can see that it is not properly documented on our site, so I will make sure that we update that accordingly.

    Our code basically works like a blacklist. Trades update OHLC+Vol unless they have a condition that is specifically listed as not eligible to update one of those attributes. It may be more useful to scan for and exclude the following ineligible conditions; '2,5,7,10,15,16,20,21,29,37,52,53', than to look for eligible conditions.

    We do make an exception for codes 12 and 13 though. This is to ensure that some extended-hours aggregates are available.

    I hope this helps. Here's an article that should provide some additional detail into our Trade Eligibility process:
    https://polygon.io/blog/understanding-trade-eligibility/
     
  6. Here's my advice: save yourself the time, don't bother with the concept of eligibility. There is no edge in the official definition. For a screener - and most other use cases - it's totally irrelevant. Just including all trades works fine. If you want to go above and beyond then you can read up on the various conditions and understand what they mean (as qlai said, CTA and UTP specs) then just include/exclude as needed for your analysis.
     
    Ponmo and qlai like this.