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

Pre-Market / After-Hours Data #190

Open
cannotthink opened this issue May 19, 2023 · 2 comments · May be fixed by #281
Open

Pre-Market / After-Hours Data #190

cannotthink opened this issue May 19, 2023 · 2 comments · May be fixed by #281

Comments

@cannotthink
Copy link

Is your feature request related to a problem? Please describe.
I cannot seem to find how to get premarket and after-hours data, only regular hours. This feature will be great and improve the usability of the library a lot.

Describe the solution you'd like
Add pre-market and after-market data for each stock. Just like yfinance has prepost = True.

Describe alternatives you've considered
Nothing else to consider.

Additional context

@ms82494
Copy link

ms82494 commented May 20, 2023

If you're looking for current pre-market or post-market quotes, they're available using price on a Ticker instance. I don't know about pre-market or post-market quotes in histories.

tickers = yahooquery.Ticker('AAPL')
tickers.price

returns something like this:

{'AAPL': {'maxAge': 1,
  'preMarketChangePercent': 0.00679807,
  'preMarketChange': 1.19,
  'preMarketTime': '2023-05-19 06:29:59',
  'preMarketPrice': 176.24,
  'preMarketSource': 'FREE_REALTIME',
  'postMarketChangePercent': -0.00017126501,
  'postMarketChange': -0.0299988,
  'postMarketTime': '2023-05-19 16:59:59',
  'postMarketPrice': 175.13,
  'postMarketSource': 'FREE_REALTIME',
  'regularMarketChangePercent': 0.00062839536,
  'regularMarketChange': 0.11000061,
  'regularMarketTime': '2023-05-19 13:00:04',
  'priceHint': 2,
  'regularMarketPrice': 175.16,
  'regularMarketDayHigh': 176.29,
  'regularMarketDayLow': 174.95,
  'regularMarketVolume': 50895166,
  'regularMarketPreviousClose': 175.05,
  'regularMarketSource': 'FREE_REALTIME',
  'regularMarketOpen': 176.39,
  'exchange': 'NMS',
  'exchangeName': 'NasdaqGS',
  'exchangeDataDelayedBy': 0,
  'marketState': 'POSTPOST',
  'quoteType': 'EQUITY',
  'symbol': 'AAPL',
  'underlyingSymbol': None,
  'shortName': 'Apple Inc.',
  'longName': 'Apple Inc.',
  'currency': 'USD',
  'quoteSourceName': 'Nasdaq Real Time Price',
  'currencySymbol': '$',
  'fromCurrency': None,
  'toCurrency': None,
  'lastMarket': None,
  'marketCap': 2755039330304}}

@cannotthink
Copy link
Author

cannotthink commented May 20, 2023

Thank you! I was thinking of something that works like yfinance prepost = True method. When i run it with that call in yfinance I get something like that, the stock data from the beginning of the premarket 4 am NYC time to 8 pm:
example:
2023-05-19 09:04:00 177.94 178.1000 177.94 178.07 0 0.0 0.0 TSLA
2023-05-19 09:05:00 178.08 178.1000 177.81 177.90 0 0.0 0.0 TSLA
2023-05-19 09:06:00 177.92 178.0500 177.90 178.01 0 0.0 0.0 TSLA
2023-05-19 09:07:00 178.04 178.0700 178.00 178.07 0 0.0 0.0 TSLA
2023-05-19 09:08:00 178.07 178.0885 178.00 178.04 0 0.0 0.0 TSLA

The history call with the yahoo query library does give only regular hours like such:
TSLA 2023-05-19 09:30:00-04:00 177.149994 177.179993 177.130005 177.141296 3478961.0
2023-05-19 09:31:00-04:00 177.139893 177.330002 176.699997 177.020004 630877.0
2023-05-19 09:32:00-04:00 177.050003 177.949997 177.009995 177.769897 809654.0
2023-05-19 09:33:00-04:00 177.764801 177.779999 177.130005 177.599197 481615.0
2023-05-19 09:34:00-04:00 177.580002 178.429993 177.500000 178.320801 800662.0

But with no option to add the premarket data like I can with yfinance by using the prepost argument. I think it will be awesome and really useful to have premarket and after market added to yahoo query library.

 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants