Giter Site home page Giter Site logo

pytickersymbols's Introduction

Release Build PyPI - Downloads Coverage Status Codacy Badge

pytickersymbols

pytickersymbols provides access to google and yahoo ticker symbols for all stocks of the following indices:

  • AEX
  • BEL 20
  • CAC 40
  • DAX
  • DOW JONES
  • FTSE 100
  • IBEX 35
  • MDAX
  • NASDAQ 100
  • OMX Helsinki 15
  • OMX Helsinki 25
  • OMX Stockholm 30
  • S&P 100
  • S&P 500
  • SDAX
  • SMI
  • TECDAX
  • MOEX

install

pip3 install pytickersymbols

quick start

Get all countries, indices and industries as follows:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()
countries = stock_data.get_all_countries()
indices = stock_data.get_all_indices()
industries = stock_data.get_all_industries()

You can select all stocks of an index as follows:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()
german_stocks = stock_data.get_stocks_by_index('DAX')
uk_stocks = stock_data.get_stocks_by_index('FTSE 100')

print(list(uk_stocks))

If you are only interested in ticker symbols, then you should have a look at the following lines:

from pytickersymbols import PyTickerSymbols

stock_data = PyTickerSymbols()
# the naming conversation is get_{index_name}_{exchange_city}_{yahoo or google}_tickers
dax_google = stock_data.get_dax_frankfurt_google_tickers()
dax_yahoo = stock_data.get_dax_frankfurt_yahoo_tickers()
sp100_yahoo = stock_data.get_sp_100_nyc_yahoo_tickers()
sp500_google = stock_data.get_sp_500_nyc_google_tickers()
dow_yahoo = stock_data.get_dow_jones_nyc_yahoo_tickers()
# there are too many combination. Here is a complete list of all getters
all_ticker_getter_names = list(filter(
   lambda x: (
         x.endswith('_google_tickers') or x.endswith('_yahoo_tickers')
   ),
   dir(stock_data),
))
print(all_ticker_getter_names)

issue tracker

https://github.com/portfolioplus/pytickersymbols/issues

pytickersymbols's People

Contributors

actions-user avatar dependabot-preview[bot] avatar dependabot[bot] avatar fossabot avatar linux4life531 avatar slashgordon avatar yairmz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pytickersymbols's Issues

Great Work. Problems with DOW

Hi, looking for something like this for long, thanks for it.

Works for DAX, NASDAQ and SP500

Trying to get stocks for DOW JONES, seems to have problems.
I only get 2 outputs for it. Am i doing anything wrong?

dow_stocks = stock_data.get_stocks_by_index('DOW JONES')

[{'name': 'Nasdaq Inc.', 'symbol': 'NDAQ', 'country': 'United States', 'indices': ['DOW JONES', 'S&P 500'], 'industries': ['Banking & Investment Services', 'Investment Banking & Investment Services', 'Financials', 'Financial & Commodity Market Operators'], 'symbols': [{'yahoo': 'NAQ.F', 'google': 'FRA:NAQ', 'currency': 'EUR'}, {'yahoo': 'NDAQ', 'google': 'NASDAQ:NDAQ', 'currency': 'USD'}, {'yahoo': '0K4T.L', 'google': 'LON:0K4T', 'currency': 'GBP'}], 'metadata': {'founded': 1971, 'employees': 4830}, 'isins': []}, {'name': 'New York Stock Exchange', 'wiki_name': 'New York Stock Exchange', 'symbol': 'MMM', 'country': 'United States', 'indices': ['DOW JONES'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 1792, 'employees': ''}}, {'name': 'Nasdaq', 'wiki_name': 'Nasdaq', 'symbol': 'AMGN', 'country': 'United States', 'indices': ['DOW JONES'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 1971, 'employees': ''}}]

strange symbols sometimes provided (also Frankfurt vs. xetra)

In general, even though the correct symbols are in the list, some other symbols are returned as index members.
For example. yahoo finance provides the data for symbol "Mar", but 0p0000kql0 is given as the corresponding symbol here.

Are there any solutions on how to tell this to provide the usual tickers?
I also fond that often in https://github.com/portfolioplus/pytickersymbols/blob/master/stocks.yaml
there are multiple alternative symbols listed. Often the correct one is one of them.

Kindly refresh indices ...

T h a n k you for pytickersymbol - it helps :-)

So far I only compared the DAX symbol list with https://en.wikipedia.org/wiki/DAX:
Daimler, Delivery Hero and Siemens Energy are no longer in the DAX INDEX.
They got replaced by Daimler Truck, Mercedes-Benz Group and Hannover Rueck.

May I ask you to kindly refresh the Index lists ...?
I reckon your refresh procedure only runs on demand (or is broken because the layout of the source-pages may have changed).

Error in nasdaq100 stock tickers

Hi,

I tried to use the package and found out that calling the get_stocks_by_index with NASDAQ 100 as an argument returns faulty results.
First of all, it returns only 89 stocks when the index contains 103 companies.
Moreover some of the stocks aren't included in the index currently.

Basically, the json file used to pull data from is outdated.
Is there a way to update the json file?

get an object returned when I print (uk_stocks)

using the examples I can print stock_data, countries etc.

For the second example when
from pytickersymbols import PyTickerSymbols
uk_stocks = stock_data.get_stocks_by_index('FTSE 100')
print(uk_stocks)

I get <filter object at 0x7fbd543e8048>

I was expecting a list of tickers for the FTSE 100

Country Getter

There are a bunch of automatically generated PRs to increment the DB, is there any plan for merging them?

get_all_countries() is returning the cities [[Paris]] and [[Cleveland]]

I am new in programming, feel free to give feedback if his is not the most appropriate way to post this question.

get_all_countries() is returning the cities [[Paris]] and [[Cleveland]] and also 'en'
Is that the purpose?

FYI

=> get_all_countries():
['', 'Isle of Man', 'en', 'China', 'France', 'Luxembourg', 'Bermuda', 'Russia', '[[Paris]]', 'South Africa', 'Spain', 'United States', 'Mexico', 'Argentina', 'Sweden', 'Czechia', 'Australia', 'Italy', '[[Cleveland]]', 'Austria', 'Netherlands', 'Canada', 'United Kingdom', 'Switzerland', 'Belgium', 'Israel', 'Germany', 'Russian Federation', 'Ireland', 'Finland']

=> get_stocks_by_country('en'):
{'name': 'Dow Inc.', 'wiki_name': 'Dow Inc.', 'symbol': 'DOW', 'country': 'en', 'indices': ['DOW JONES', 'S&P 100', 'S&P 500'], 'industries': ['Chemicals'], 'symbols': [{'yahoo': 'DOW', 'google': 'NYSE:DOW', 'currency': 'USD'}], 'isins': [], 'metadata': {'founded': 2019, 'employees': 36500}, 'id': 1001}

=> get_stocks_by_country('[[Paris]]'):
{'name': 'Ipsos SA', 'wiki_name': 'Ipsos SA', 'symbol': 'IPZ', 'country': '[[Paris]]', 'indices': ['CAC Mid 60'], 'industries': ['Public opinion research'], 'symbols': [{'yahoo': 'IPZ.F', 'google': 'FRA:IPZ', 'currency': 'EUR'}], 'isins': ['FR0000073298'], 'metadata': {'founded': 1975, 'employees': 16664}, 'id': 1082}

=> get_stocks_by_country('[[Cleveland]]'):
{'name': 'KeyBank', 'wiki_name': 'KeyBank', 'symbol': 'KEY', 'country': '[[Cleveland]]', 'indices': ['S&P 500'], 'industries': ['Financial services'], 'symbols': [{'yahoo': 'KEY', 'google': 'NYSE:KEY', 'currency': 'USD'}], 'isins': [], 'metadata': {'founded': 1825, 'employees': 17999}, 'id': 1008}

=> get_stocks_by_country(''):
These countries seem to have no country? just check if that is correct?

{'name': 'Norfolk Southern Corp.', 'wiki_name': 'Norfolk Southern Corp.', 'symbol': 'NSC', 'country': '', 'indices': ['S&P 500'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1018}

{'name': 'Pool Corporation', 'wiki_name': 'Pool Corporation', 'symbol': 'POOL', 'country': '', 'indices': ['S&P 500'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1026}

{'name': 'IMCD', 'wiki_name': 'IMCD', 'symbol': 'IMCD', 'country': '', 'indices': ['AEX'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1049}

{'name': 'DBV Technologies', 'wiki_name': 'DBV Technologies', 'symbol': 'DBVT', 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [{'yahoo': 'DBVT', 'google': 'NASDAQ:DBVT', 'currency': 'USD'}, {'yahoo': 'DBVA.F', 'google': 'FRA:DBVA', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1065}

{'name': 'Elior Group', 'wiki_name': 'Elior Group', 'symbol': '21E', 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [{'yahoo': '21E.F', 'google': 'FRA:21E', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1066}

{'name': 'Genfit', 'wiki_name': 'Genfit', 'symbol': 'XUP', 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [{'yahoo': 'XUP.F', 'google': 'FRA:XUP', 'currency': 'EUR'}, {'yahoo': 'GNFTF', 'google': 'OTCMKTS:GNFTF', 'currency': 'USD'}, {'yahoo': 'GNFT', 'google': 'NASDAQ:GNFT', 'currency': 'USD'}, {'yahoo': 'XUPB.F', 'google': 'FRA:XUPB', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1076}

{'name': 'Gaztransport & Technigaz', 'wiki_name': 'Gaztransport & Technigaz', 'symbol': '9TG', 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [{'yahoo': '9TG.F', 'google': 'FRA:9TG', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1077}

{'name': 'Mercialys', 'wiki_name': 'Mercialys', 'symbol': 'MEIYF', 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [{'yahoo': 'MEIYF', 'google': 'OTCMKTS:MEIYF', 'currency': 'USD'}, {'yahoo': 'M8Y.F', 'google': 'FRA:M8Y', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1087}

{'name': 'TF1 Group', 'wiki_name': 'TF1 Group', 'symbol': None, 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1101}

{'name': 'Virbac', 'wiki_name': 'Virbac', 'symbol': 'VRBCF', 'country': '', 'indices': ['CAC Mid 60'], 'industries': [], 'symbols': [{'yahoo': 'VRBCF', 'google': 'OTCMKTS:VRBCF', 'currency': 'USD'}, {'yahoo': 'V16.F', 'google': 'FRA:V16', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1105}

{'name': 'Aedifica', 'wiki_name': 'Aedifica', 'symbol': None, 'country': '', 'indices': ['BEL 20'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1114}

{'name': 'WDP', 'wiki_name': 'WDP', 'symbol': None, 'country': '', 'indices': ['BEL 20'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1120}

{'name': 'Kojamo', 'wiki_name': 'Kojamo', 'symbol': 'KOJAMO', 'country': '', 'indices': ['OMX Helsinki 25'], 'industries': [], 'symbols': [{'yahoo': 'V4OC.F', 'google': 'FRA:V4OC', 'currency': 'EUR'}], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1127}

{'name': 'TCS Group', 'wiki_name': 'TCS Group', 'symbol': None, 'country': '', 'indices': ['MOEX'], 'industries': [], 'symbols': [], 'isins': [], 'metadata': {'founded': 0, 'employees': 0}, 'id': 1172}

Not working for me

from pytickersymbols import PyTickerSymbols
File "/usr/local/lib/python2.7/dist-packages/pytickersymbols/init.py", line 26
class PyTickerSymbols(metaclass=Singleton):
^
SyntaxError: invalid syntax

Meta?

Facebook changed to meta, yet here still shows as facebook. What's happening? :)

Exchange Type

Nice work! One question, though: How can I download the symbols for German stocks listed on XETRA instead of 'Frankfurt' (in this case the symbol output should be .DE instead of .F)?

Export as pandas dataframe and other formats

pytickersymbols is great but I'm struggling to get the results as pandas dataframes, is there a native way to export in that format? It would be really helpful.

Also, in the example below, how can I convert 'spx' into a dataframe or at least export as .csv? Because, in the current format, I have not been able to use it for any of my purposes.

stock_data = PyTickerSymbols()
spx = stock_data.get_stocks_by_index('S&P 500')

Thank you

Nice work, just some questions

Hi,
thanks for providing this ressource. It's nicely done.

Just some questions:

  • When will the stocks list be updated?
  • Some values are empty for example in the FTSE100 some are [] and the S&P500 does β€œonly” have 498 entries - what's up with those?
  • Is it possible to get the name based on the ticker symbol?

Take care

Update cycle of the `stocks.yaml`

Moin!

First of all, I love your work. It saves me tons of time, many thanks for putting this out!

My question is about the stocks.yaml file. As far as I understood your implementation, this is where all stock information is loaded from. But how often is it updated? Or how is it generally assured to query the most up-to-date stock info?

Thanks a bunch!
All the best from Berlin

Accessing other indices

How do I access other indices that aren't in the list, for example the UK AIM 100? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.