Use ISIN to retrieve stock data in PYTHON - python

In my quest of retrieving the stock prices, in daily, within a 10y period, of the 600 companies of the index EUROSTOXX 600, I'm facing some difficulties.
First question : Retrieving all of this with one part of code seems feasible according to you ?
(I'm considering adding also main financial indicators like ROI,ROE,EBIT,EPS, annual performance... and export all of this on one excel sheet)
I collected all the 600 ISIN. The question is, can I use it to retrieve the data from yahoo finance (or anything else) or should I find a way to find the 600 real tickers defined by Yahoo ?
If yes, does anyone have a tip for that ? I've been looking for lists but this index doesn't look very popular apparently.
Thank you for reading !

Related

Writtin a personal budget script on Python; how to work with categories/subcategories? How to link files?

My idea is to create a .csv file (e.g. data.csv) with all the elements that could potentially be present in my expenses detailing to which category and subcategory they belong, as well as its corresponding reference price (e.g. 'house insurance' would belong to 'house' category and 'services' subcategory.
Then have another .csv file (e.g. expenses.csv) where I daily introduce the expenses as they come up, but just writing the date and name of the expense and having Python (maybe through Pandas) read from the base .csv file to which category and subcategory it belongs, and writing the outcome to a dataframe where these daily expenses would be appended.
My question is; how do I tell Python to take each element in expenses.csv, look in data.csv to which category and subcategory they belong as well as their price, and include these values in a third file (e.g. expenses_total.csv)?
I'm sure this is nothing complicated for most of you, but I'm still a noob with Python and still struggle when it comes to interconnecting values from different files.
Thanks in advance.
Consider presenting some code, so that we could refer to the problem directly, or at least provide some divide-and-conquer attitude towards the problem you've described. Nonetheless you might want use pandas module to create pd.DataFrame()s with the data you have and then join datasets together with df.merge() method. The resulting data frame could be easily exported to csv file.

How to automate calculations in Pandas dataframe

I'm currently struggling to find good information on how to calculate differences, percentages etc. using several columns and rows in a Pandas dataframe - and how to show the output in a nice table using Python.
Short example of what I'm going for:
I'm working with NBA data and have gathered a bunch of match statistics for home and away teams during the 2019/20 season (the season finishes later this month). The first row shows the Free Throw percentage and "Regular" means regular matches with audience members and "Bubble" denotes the matches without audience members.
A short view of my Pandas dataframe:
How do I automate the calculations using Python code? Feel free to give me examples!

What Python data structures allow for easy access to values with multiple indices?

I work in Freight shipping, and I recently built a scraper that scraped market rates of shipments based on 3 features: origin city, destination city, and time period.
Currently, I have these results stored in a csv/xlsx file that has this data outlined as follows:
My current project involves comparing what we actually paid for shipments versus the going market rate. From my scraped data, I need a way to rapidly access the:
AVERAGE MARKET RATE
based on: MONTH, ORIGIN CITY, and DESTINATION CITY.
Since I know what we paid for shipping on a particular day, if I can access the average market rate from that month, I can perform a simple subtraction to tell us how much we over or underpaid.
I am relatively proficient with using Pandas dataframes, and my first instincts were to try to combine a dataframe with a dictionary to call values based on those features, but I am unsure of how I can do that exactly.
Do you have any ideas?
Using pandas, you could add your data as a new column in your csv. Then you could just subtract the two indexes, eg df['mean'] - df['paid']
You could do that in Excel too.
As a side note, you'll probably want to update your csv so that each row has the appropriate city - maybe it's harder to read, but it'll definitely be easier to work with in your code.

Python Pandas Word Frequency Analysis

I have been chipping away at a side project for a while, and am coming up against a wall (most likely made by my own mistakes). I am attempting to create a csv repository of words used in news articles and their frequency, when written as titles of the news stories and on which day they are used with this format:
Chart basic format, with words as columns and their frequencies charted by the date
I am attempting to have it work in this shape, with words as the recorded columns and the dates as the row/index with the frequency being recorded in a table. I have been attempting to do this with Python's Pandas library, but have had minimal success in updating a csv or a Dataframe with new information. It has either overwritten the csv with new information and ignored the date index, or has not adjoined them as I expected from information from here. I've also added screenshots of my code page1 page2 page3.
If there anyone has any advice on how to proceed, or if there is a better way to record this information, I would greatly appreciate the help. Thank you all in advance.
-Brad

matplotlib.finance 5 minute intervals

I have been using matplotlib.finance to pull stock information. quotes_historical_yahoo() is a really easy function to use but seems to only allow me to pull information on the day.
Is there a way using matplotlib to pull stock values in intervals of 5 minutes?
If not can I get a suggestion of some other python software that will do what I want.
There are several sources of historical data at varying resolutions here, but they dont go back very far. For example, you can only get ten days worth of data at the 1 minute interval from google finance.
I use pandas for historical data using DataReader(), and then read_csv() for the above sources (but that can get tricky and you will need to write your own code to format and make some of these useful)

Categories