Skip to content
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

Quote price lag #199

Open
shaunmolloy opened this issue Oct 27, 2021 · 6 comments
Open

Quote price lag #199

shaunmolloy opened this issue Oct 27, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@shaunmolloy
Copy link

shaunmolloy commented Oct 27, 2021

I have ALPP in my watch list, and I've noticed that the price is off
but the tag on the stock remains as Real-Time.

I checked this against Yahoo finance, which has the quoteSourceName
value change in between refreshes to:

  • Nasdaq Real Time Price
  • Delayed Quote

But we may not be using that from the response, looking at a Github search.

Can the Real-Time tag be updated so it correctly shows if it's
a delayed quote or not? Or would there be a way to workaround a
delayed quote, by using a unique user agent from the request?

See latest #199 (comment).

@shaunmolloy shaunmolloy added the bug Something isn't working label Oct 27, 2021
@shaunmolloy
Copy link
Author

I can see that it actually remains as Real Time, when called with
their own corsDomain.

curl https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US\&region=US\&corsDomain=finance.yahoo.com\&fields=regularMarketPrice,currency\&symbols=ALPP | python -m json.tool

So it's likely that the data from Yahoo finance was just lagging behind.

@shaunmolloy shaunmolloy changed the title Delayed Quote shows as Real Time Quote price lag Oct 27, 2021
@shaunmolloy
Copy link
Author

Noticing the price jump from 3.05 to 3.56, which differs to the price
shown on Nasdaq.

Checked this from the full fields:

clear && curl https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US\&region=US\&corsDomain=finance.yahoo.com\&symbols=ALPP | python -m json.tool
{
    "quoteResponse": {
        "result": [
            {
                "language": "en-US",
                "region": "US",
                "quoteType": "EQUITY",
                "quoteSourceName": "Nasdaq Real Time Price",
                "triggerable": true,
                "ipoExpectedDate": "2021-10-20",
                "prevName": "Alpine 4 Technologies, Ltd.",
                "nameChangeDate": "2021-10-26",
                "tradeable": false,
                "currency": "USD",
                "exchange": "NCM",
                "longName": "Alpine 4 Holdings, Inc.",
                "messageBoardId": "finmb_268998872",
                "exchangeTimezoneName": "America/New_York",
                "exchangeTimezoneShortName": "EDT",
                "gmtOffSetMilliseconds": -14400000,
                "market": "us_market",
                "esgPopulated": false,
                "marketState": "REGULAR",
                "regularMarketDayRange": "3.06 - 3.84",
                "regularMarketDayLow": 3.06,
                "regularMarketVolume": 571197,
                "regularMarketPreviousClose": 3.23,
                "bid": 3.05,
                "ask": 3.06,
                "bidSize": 11,
                "askSize": 14,
                "fullExchangeName": "NasdaqCM",
                "financialCurrency": "USD",
                "regularMarketOpen": 3.21,
                "averageDailyVolume3Month": 1000816,
                "averageDailyVolume10Day": 3749985,
                "fiftyTwoWeekLowChange": 3.519,
                "fiftyTwoWeekLowChangePercent": 85.82927,
                "fiftyTwoWeekRange": "0.041 - 9.49",
                "fiftyTwoWeekHighChange": -5.93,
                "fiftyTwoWeekHighChangePercent": -0.6248683,
                "fiftyTwoWeekLow": 0.041,
                "fiftyTwoWeekHigh": 9.49,
                "earningsTimestamp": 1594053840,
                "earningsTimestampStart": 1594053840,
                "earningsTimestampEnd": 1594053840,
                "epsTrailingTwelveMonths": -0.102,
                "sharesOutstanding": 144880992,
                "bookValue": 0.283,
                "fiftyDayAverage": 3.0776112,
                "fiftyDayAverageChange": 0.48238873,
                "fiftyDayAverageChangePercent": 0.15674129,
                "twoHundredDayAverage": 3.1778417,
                "twoHundredDayAverageChange": 0.38215828,
                "twoHundredDayAverageChangePercent": 0.120257184,
                "priceToBook": 12.579505,
                "sourceInterval": 15,
                "exchangeDataDelayedBy": 0,
                "regularMarketChange": -0.0900002,
                "regularMarketChangePercent": -2.4657588,
                "regularMarketTime": 1634932803,
                "regularMarketPrice": 3.56,
                "regularMarketDayHigh": 3.84,
                "firstTradeDateMilliseconds": 1484317800000,
                "priceHint": 4,
                "shortName": "ALPINE 4 HOLDINGS INC",
                "marketCap": 591155840,
                "displayName": "Alpine 4",
                "symbol": "ALPP"
            }
        ],
        "error": null
    }
}

Look at the difference between regularMarketPrice 3.56 and bid 3.05.

https://www.quora.com/How-accurate-are-the-stock-prices-on-Yahoo-finance

The bid and ask quotes are a better indicator of the prices at which you can actually trade, especially for the less-active stocks that may have a wide spread between the bid and ask prices.

@shaunmolloy
Copy link
Author

shaunmolloy commented Oct 28, 2021

In pre-market I've also noticed the tag remain as Real-Time, and I've
checked Yahoo finance API that shows quoteSourceName as Delayed Quote
and marketState as PRE.

The bid and ask prices are showing as 0.0 during pre-market, so those are
maybe only reliable when the market is open. Looks like we rely on preMarketPrice
during this time, which seems fair. Though it doesn't show the preMarketChange and
preMarketChangePercent.

market open - quote change and percent updates

2021-10-27_16-14-33_screenshot

pre market - no quote change and percent updates

2021-10-28_10-15-36_screenshot

As well as Real-Time being showed in the tag, rather than Delayed Quote.

To summarise the points:

  • Real-Time tag seems inaccurate. Worth looking at using another key from the response, such as quoteSourceName.
  • Show an extra tag for Pre-Market, Open, Post-Market - helpful for users that have stocks in more than one country. The dot icon only looks to indicate market open.
  • Open market price varies. Is it worth evaluating bid/ask when the market is open?
  • Show pre-market / post-market change and change percent values.

@achannarasappa
Copy link
Owner

Thanks for doing the research into the pricing delays/discrepancies and sharing them here.

Let me address your summary points below:

Real-Time tag seems inaccurate. Worth looking at using another key from the response, such as quoteSourceName.

Currently, ticker uses exchangeDataDelayedBy rather than quoteSourceName but if you're saying that in some cases these values are misaligned (i.e. exchangeDataDelayedBy == 0 and quoteSourceName contains "Delayed") then a fix seems appropriate. Would you be able to share some examples of securities that demonstrate this issue?

Show an extra tag for Pre-Market, Open, Post-Market - helpful for users that have stocks in more than one country. The dot icon only looks to indicate market open.

There is an indicator dot during non-regular trading sessions next to each security. The intent was to communicate that in a minimal way but I can understand this may not be clear. I would be okay with adding a tag to help clarify that since if a user is choosing to show tags, they're already indicating they want more details about their securities.

Open market price varies. Is it worth evaluating bid/ask when the market is open?

If prices are inaccurate then I'm in favor of making that change however I'd like to understand better how the values differ from order book prices and why (i.e. compare prices across a period of time for a sampling of several securities and compare price differences) before making that change. The reason I feel an in-depth analysis is warranted is that this will have a significant impact on what users see in the application and I'd like to be cautious about making that sort of change.

Show pre-market / post-market change and change percent values.

These are shown but some securities either are not trading in non-regular sessions or have no volume in non-regular sessions. See here for the source where they are included: https://github.com/achannarasappa/ticker/blob/master/internal/quote/yahoo/quote.go#L115

@shaunmolloy
Copy link
Author

Currently, ticker uses exchangeDataDelayedBy rather than quoteSourceName but if you're saying that in some cases these values are misaligned (i.e. exchangeDataDelayedBy == 0 and quoteSourceName contains "Delayed") then a fix seems appropriate. Would you be able to share some examples of securities that demonstrate this issue?

I logged data over the course of Thursday afternoon, to Friday evening,
to get a full picture of data from pre market, market open and post market,
to look at delays and price variations.

Here's a spreadsheet of the data:
https://docs.google.com/spreadsheets/d/12tZ7o_UcVndXhRk2DZYleuobd2HpNYWa0-LWfZq2Avs/edit?usp=sharing

Logged data for the following stock and crypto assets across a few different exchanges:

  • 9988.HK
  • ALPP
  • GOOD.L
  • DOGE-USD
  • HCMC
  • PROG
  • TSLA

I've not had chance to properly chart out the prices yet.

With the delays, I can see results where the quoteSourceName is Delayed Quote
and the exchangeDataDelayedBy is 0, so the exchangeDataDelayedBy doesn't
always seem to be reliable.

@achannarasappa
Copy link
Owner

That's really helpful - thanks for compiling that information! I'll add this one to be fixed a future release

@achannarasappa achannarasappa added this to the future-release milestone Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants