Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Machine Learning Blueprints

You're reading from   Python Machine Learning Blueprints Put your machine learning concepts to the test by developing real-world smart projects

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781788994170
Length 378 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Michael Roman Michael Roman
Author Profile Icon Michael Roman
Michael Roman
Alexander Combs Alexander Combs
Author Profile Icon Alexander Combs
Alexander Combs
Saurabh Chhajed Saurabh Chhajed
Author Profile Icon Saurabh Chhajed
Saurabh Chhajed
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. The Python Machine Learning Ecosystem FREE CHAPTER 2. Build an App to Find Underpriced Apartments 3. Build an App to Find Cheap Airfares 4. Forecast the IPO Market Using Logistic Regression 5. Create a Custom Newsfeed 6. Predict whether Your Content Will Go Viral 7. Use Machine Learning to Forecast the Stock Market 8. Classifying Images with Convolutional Neural Networks 9. Building a Chatbot 10. Build a Recommendation Engine 11. What's Next? 12. Other Books You May Enjoy

How to develop a trading strategy

We'll begin our strategy development by focusing on the technical aspects. Let's take a look at the S&P 500 over the last few years. We'll use pandas to import our data. This will give us access to several sources of stock data, including Yahoo! And Google.

  1. First, you'll need to install the data reader:
!pip install pandas_datareader 
  1. Then, go ahead and incorporate your imports:
import pandas as pd 
from pandas_datareader import data, wb 
import matplotlib.pyplot as plt 
 
%matplotlib inline 
pd.set_option('display.max_colwidth', 200) 
  1. Now, we'll get our data for the SPY ETF, which represents the stocks of the S&P 500. We'll pull data from the start of 2010 through December 2018:
import pandas_datareader as pdr 
 
start_date = pd.to_datetime('2010-01-01') 
stop_date = pd.to_datetime...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image