mcdallas / wallstreet

Real time stock and option data.
MIT License
1.24k stars 197 forks source link

Index Option Quotes #3

Closed HarryPublic closed 7 years ago

HarryPublic commented 7 years ago

Were you ever able to get this to return Index Option Quotes?

For example: g=Call('INDEXSP:.INX', d=20, m=10, y=2016, strike=2150)

Tried d=20 as well as 21 Tried INDEXSP, SPX, INDEXCBOE:SPX and a few other variations, but could not get index option data.

One issue is that it will return the same error message "No options listed for this stock." even if the date is incorrect - but I guess that you get a JSON object without a list of valid options and it does not tell you whether the expiry is valid or not - so can not fix that easily.

However, knowing the codes to get this API to show option data for SPX, RUT, NDX and other major indices will be very helpful.

baerrus commented 7 years ago

THis code fetches option quotes from GoogleFinance, right? I have noticed that GF website does not show options chains for indeces like VIX, SPX etc.

How difficult would it be to attach yahoo finance as a secondary quote provider?

HarryPublic commented 7 years ago

Not sure yahoo also provides greeks ... oh but looked at your code ... you have implemented black scholes so its just a question of getting the data and feeding the BS model. Maybe not today, but I might send out a pull request over the next couple of weeks. Definitely doable.

mcdallas commented 7 years ago

@baerrus quotes from Yahoo Finance are delayed though.

HarryPublic commented 7 years ago

Looks like YF will not work. The recently changed / broke their API and the whole pandas community is unable to fix it. I only need delayed data - I want to run my code on my portfolio and identify and email me the most outlier positions (most at risk, most safe) and it does not matter much if the data is a bit delayed. I find that much better than going through my position list manually (it is somewhat big).

On Wed, Sep 21, 2016 at 6:39 AM, Mike Dallas notifications@github.com wrote:

@baerrus https://github.com/baerrus quotes from Yahoo Finance are delayed though.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mcdallas/wallstreet/issues/3#issuecomment-248615219, or mute the thread https://github.com/notifications/unsubscribe-auth/AVRkf6OSsUZ3WY-gI2CF_tLxAQZbNS9yks5qsTOngaJpZM4KBFFA .

nicad commented 7 years ago

is it the same issue that ETF options are not available: `

import wallstreet

s = Stock('SPY') Traceback (most recent call last): File "", line 1, in NameError: name 'Stock' is not defined s = wallstreet.Stock('SPY') s.price 215.97 p = wallstreet.Put('SPY') Traceback (most recent call last): File "", line 1, in File "/Users/XXX/imports/wallstreet/wallstreet/wallstreet.py", line 143, in init super().init(quote, _kw) File "/Users/XXX/imports/wallstreet/wallstreet/wallstreet.py", line 107, in init raise LookupError('No options listed for this stock.') LookupError: No options listed for this stock. p = wallstreet.Put('GOOG') No options listed for given date, using 21-10-2016 instead p = wallstreet.Put('EFA') Traceback (most recent call last): File "", line 1, in File "/Users/XXX/imports/wallstreet/wallstreet/wallstreet.py", line 143, in init super().init(quote, _kw) File "/Users/XXX/imports/wallstreet/wallstreet/wallstreet.py", line 107, in init raise LookupError('No options listed for this stock.') LookupError: No options listed for this stock.

`

also don't need real-time

mcdallas commented 7 years ago

@nicad Yes. Apparently GF doesn't provide option chains for ETFs.

baerrus commented 7 years ago

GF also started skipping whole options series arbitrarily. For example take a look at SBUX. Today it shows only Oct21, Jan17 and Jan18 expirations. SBUX has weeklies as well as Nov and Dec series listed.

HarryPublic commented 7 years ago

I think most of the options data now is for fee, but even for fee there is no simple API to pull those out.

On Fri, Oct 7, 2016 at 10:28 AM, Baerrus Magnus notifications@github.com wrote:

GF also started skipping whole options series arbitrarily. For example take a look at SBUX. Today it shows only Oct21, Jan17 and Jan18 expirations. SBUX has weeklies as well as Nov and Dec series listed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mcdallas/wallstreet/issues/3#issuecomment-252312432, or mute the thread https://github.com/notifications/unsubscribe-auth/AVRkf6nvPVtSQao7VjYLocA0oodAlBiHks5qxoFYgaJpZM4KBFFA .

nicad commented 7 years ago

Would https://query2.finance.yahoo.com/v7/finance/options/SPY be a valid replacement ?

HarryPublic commented 7 years ago

this is fantastic, but my personal interest is exclusively in index options (SPX, RUT, NDX), so no. Not for me.

On Fri, Oct 7, 2016 at 11:06 AM, nicad notifications@github.com wrote:

Would https://query2.finance.yahoo.com/v7/finance/options/SPY be a valid replacement ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mcdallas/wallstreet/issues/3#issuecomment-252321265, or mute the thread https://github.com/notifications/unsubscribe-auth/AVRkfxcTtdwuIHsObNmnRyUScXkckUz1ks5qxoojgaJpZM4KBFFA .

mcdallas commented 7 years ago

I have added Yahoo Finance as a secondary source. You can use it by passing the source='yahoo' parameter but keep in mind that it might be delayed. It is not up on PyPI yet cause there might be some bugs. You can pip install by passing the url or clone the repo.