Giter Club home page Giter Club logo

finsymbols's People

Contributors

hahnicity avatar jwfu avatar olliefr avatar skillachie avatar wesseldr avatar woodsjc 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

finsymbols's Issues

'NoneType' object has no attribute 'find_all'

from finsymbols import symbols

sp500 = symbols.get_sp500_symbols()


AttributeError Traceback (most recent call last)
in ()
1 from finsymbols import symbols
----> 2 sp500 = symbols.get_sp500_symbols()

~\Anaconda3\lib\site-packages\finsymbols\symbols.py in get_sp500_symbols()
12 symbol_data_list = list()
13
---> 14 for symbol in symbol_table.find_all("tr"):
15 symbol_data_content = dict()
16 symbol_raw_data = symbol.find_all("td")

AttributeError: 'NoneType' object has no attribute 'find_all'

SP500 has 502 symbols. Tests validate that there are 500

If you go to: https://en.wikipedia.org/wiki/List_of_S%26P_500_companies and then look at the list of companies added you'll see that GOOGL was added April 3, 2014 and no stock was removed. You'll also note that DISCK was added August 6, 2014 and no symbol was removed. This is because both of these are class C shares of their corresponding company. I'm not sure that this is a bug in wikipedia, but for now we should ensure that finsymbols is able to tolerate this.

Also we should remove the hardcoded /exchanges/SP500.html file. This is giving us old data.

Better way to gather symbols

You can dynamically generate the CSV file from

ftp://ftp.nasdaqtrader.com/SymbolDirectory/nasdaqtraded.txt

which is a better solution than hardcoding the csv because the list will change

EDIT

Even better. It seems like nasdaq has an API that will give you the csv en masse

http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=<exchange>&render=download

so for example this will get you all the csv for NYSE

http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NYSE&render=download

http.client.RemoteDisconnected: Remote end closed connection without response - python3.5 and python3.7

I've installed the package with pip but when I try to run any of them I get the error

from finsymbols import symbols


# amex = symbols.get_amex_symbols()

nyse = symbols.get_nyse_symbols()
print(nyse)

sp500 = symbols.get_sp500_symbols()
print(sp500)

It generates this error, how can we debug or update the repo or can I repurpose, reuse, take over the repo if its depreciated by @skillachie?

Traceback (most recent call last):
  File "/Users/username/PycharmProjects/finsymbols/finsymbols/test1.py", line 10, in <module>
    nyse = symbols.get_nyse_symbols()
  File "/Users/username/PycharmProjects/finsymbols/finsymbols/symbols.py", line 43, in get_nyse_symbols
    return _get_exchange_data("NYSE")
  File "/Users/username/PycharmProjects/finsymbols/finsymbols/symbols.py", line 61, in _get_exchange_data
    symbol_data = fetch_file(url)
  File "/Users/username/PycharmProjects/finsymbols/finsymbols/symbol_helper.py", line 73, in fetch_file
    file_data = file_fetcher.open(url).read()
  File "/Users/username/opt/anaconda3/envs/Python37/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)

Error message when trying to get S&P500 symbols

I'm trying to download the symbols for the S&P500 in python using finsymbols. This is my code:

from finsymbols import symbols
sp500 = symbols.get_sp500_symbols()

I'm getting this error:

sp500 = symbols.get_sp500_symbols()
Traceback (most recent call last):

File "", line 1, in
sp500 = symbols.get_sp500_symbols()

File "C:\Anaconda3\lib\site-packages\finsymbols\symbols.py", line 8, in get_sp500_symbols
page_html = wiki_html('List_of_S%26P_500_companies', 'SP500.html')

File "C:\Anaconda3\lib\site-packages\finsymbols\symbol_helper.py", line 95, in wiki_html
save_file(file_path, wiki_html)

File "C:\Anaconda3\lib\site-packages\finsymbols\symbol_helper.py", line 39, in save_file
saved_file.write(file_data)

File "C:\Anaconda3\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]

UnicodeEncodeError: 'charmap' codec can't encode character '\u2010' in position 528521: character maps to

Is there anything I can do to fix this? I'm using Anaconda 5.0.0 with Python 3.6 on a Windows 8. Thanks for the help!

get_nasdaq_symbols error?

Sorry I am a novice to Python so the following may be a really green issue but...
I enter the following at python 3.5 prompt ๐Ÿ‘

import finsymbols
xx = finsymbols.get_nasdaq_symbols()
Traceback (most recent call last):
File "", line 1, in
File "C:\Anaconda3\lib\site-packages\finsymbols\symbols.py", line 48, in get_nasdaq_symbols
return _get_exchange_data("NASDAQ")
File "C:\Anaconda3\lib\site-packages\finsymbols\symbols.py", line 61, in _get_exchange_data
return get_symbol_list(symbol_data,exchange)
File "C:\Anaconda3\lib\site-packages\finsymbols\symbol_helper.py", line 29, in get_symbol_list
symbol_data_dict['company'] = row[1]
IndexError: list index out of range

I installed using:
pip install finsymbols

Please advise.
Best regards

get_nasdaq_symbols never returns

Hi there!

The only symbols I'm able to retrieve are S&P 500.

Everything else never returns (no error, just takes forever).
Example:

sp500 = finsymbols.get_sp500_symbols() ## This works
nasdaq = finsymbols.get_nasdaq_symbols() ## never returns
amex = finsymbols.get_amex_symbols() ## never returns

Amex not working

Hi there,

Thanks for the awesome little program. Everything is working fine except for AMEX.
I haven't investigated very far, probably Yahoo changed something.

File "/Users/shaun/Applications/ve/lib/python3.6/site-packages/finsymbols/symbols.py", line 47, in get_amex_symbols
return _get_exchange_data("AMEX")
File "/Users/shaun/Applications/ve/lib/python3.6/site-packages/finsymbols/symbols.py", line 64, in _get_exchange_data
return get_symbol_list(symbol_data, exchange)
File "/Users/shaun/Applications/ve/lib/python3.6/site-packages/finsymbols/symbol_helper.py", line 28, in get_symbol_list
symbol_data_dict['company'] = row[1]
IndexError: list index out of range

Permission denied error after pip install

After running the command:

sp500 = finsymbols.get_sp500_symbols()

I get the following error:


IOError Traceback (most recent call last)
in ()
----> 1 sp500 = finsymbols.get_sp500_symbols()

/Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/symbols.pyc in get_sp500_symbols()
8
9 def get_sp500_symbols():
---> 10 page_html = wiki_html('List_of_S%26P_500_companies','SP500.html')
11 wiki_soup = BeautifulSoup(page_html, "html.parser")
12 symbol_table = wiki_soup.find(attrs={'class': 'wikitable sortable'})

/Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/symbol_helper.pyc in wiki_html(url, file_name)
90 wiki_html = fetch_file('http://en.wikipedia.org/wiki/' + str(url))
91 #Save file to be used by cache
---> 92 save_file(file_path,wiki_html)
93 return wiki_html

/Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/symbol_helper.pyc in save_file(file_path, file_name)
36
37 def save_file(file_path,file_name):
---> 38 saved_file = open(file_path , "w")
39 saved_file.write(file_name)
40 saved_file.close()

IOError: [Errno 13]** Permission denied**: '/Library/Python/2.7/site-packages/finsymbols-0.5.0-py2.7.egg/finsymbols/SP500.html'

'module' object has no attribute 'get_sp500_symbols'

Hello,

I have conducted a pip install of finsymbols, then attempted the following code:
`import finsymbols

sp500 = finsymbols.get_sp500_symbols()

pprint.pprint(sp500)`

the terminal reports an attribute error: AttributeError: 'module' object has no attribute 'get_sp500_symbols'

please advise.

Thank you.

get_nasdaq_symbols error

I'm using Python 2.7 and I'm having an issue with get_nasdaq_symbols (see error below). I can get the sp500/amex/nyse symbols just fine with your code, but nasdaq seems to be a problem. The error is:

Traceback (most recent call last):
File "test.py", line 56, in
smbs=finsymbols.get_nasdaq_symbols()
File "C:\Python27\lib\site-packages\finsymbols\symbols.py", line 51, in get_nasdaq_symbols
return _get_exchange_data("NASDAQ")
File "C:\Python27\lib\site-packages\finsymbols\symbols.py", line 64, in _get_exchange_data
return get_symbol_list(symbol_data, exchange)
File "C:\Python27\lib\site-packages\finsymbols\symbol_helper.py", line 28, in get_symbol_list
symbol_data_dict['company'] = row[1]
IndexError: list index out of range
Press any key to continue . . .

My code is:

import finsymbols
smbs=finsymbols.get_nasdaq_symbols()

Wrong number of symbols returned

I installed this into an Anaconda python distribution in Linux.

I ran sp500 = finsymbols.get_sp500_symbols() in a terminal.

The list returned from the command had length of only 341. Same result after running this several times.

The last stock symbols in the list are NU, NRG, NUE, and NVDA.

Any ideas how to correct this?

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.