Path: blob/master/Documentation/Python/Stock-Picking-With-Fundamental-Data.ipynb
629 views
Stock Picking With Fundamental Data
An example of selecting stocks in a sector based on their relative PE ratios.
First we import the matplotlib library to assist with plotting.
We create our QuantBook object.
Next, we create a list of symbol objects for several large airline companies.
We get the PE ratios of the symbols throughout 2014.
Now we plot the PE ratios across time.
We want to select the symbols with the highest and lowest average PE ratios. First, we call mean()
on the DataFrame and then sort the values with sort_values()
.
We select the symbols with the highest and lowest average PE ratios by selecting the first and last element in the series index.
We now gather the historical closing prices for the securities we found to have the highest and lowest PE ratios.
Lastly, we plot the returns generated by investing in these securities from 2009 to 2015.