Mastering pandas for Finance
eBook - ePub

Mastering pandas for Finance

Michael Heydt

Share book
  1. 298 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering pandas for Finance

Michael Heydt

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering pandas for Finance an online PDF/ePUB?
Yes, you can access Mastering pandas for Finance by Michael Heydt in PDF and/or ePUB format, as well as other popular books in Business & Business Intelligence. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781783985104

Mastering pandas for Finance


Table of Contents

Mastering pandas for Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with pandas Using Wakari.io
What is Wakari?
Creating a Wakari cloud account
Updating existing packages
Installing new packages
Installing the samples in Wakari
Summary
2. Introducing the Series and DataFrame
Notebook setup
The main pandas data structures – Series and DataFrame
The Series
The DataFrame
The basics of the Series and DataFrame objects
Creating a Series and accessing elements
Size, shape, uniqueness, and counts of values
Alignment via index labels
Creating a DataFrame
Example data
Selecting columns of a DataFrame
Selecting rows of a DataFrame using the index
Slicing using the [] operator
Selecting rows by the index label and location – .loc[] and .iloc[]
Selecting rows by the index label and/or location – .ix[]
Scalar lookup by label or location using .at[] and .iat[]
Selecting rows using the Boolean selection
Arithmetic on a DataFrame
Reindexing the Series and DataFrame objects
Summary
3. Reshaping, Reorganizing, and Aggregating
Notebook setup
Loading historical stock data
Organizing the data for the examples
Reorganizing and reshaping data
Concatenating multiple DataFrame objects
Merging DataFrame objects
Pivoting
Stacking and unstacking
Melting
Grouping and aggregating
Splitting
Aggregating
Summary
4. Time-series
Notebook setup
Time-series data and the DatetimeIndex
Creating time-series with specific frequencies
Representing intervals of time using periods
Shifting and lagging time-series data
Frequency conversion of time-series data
Resampling of time-series
Summary
5. Time-series Stock Data
Notebook setup
Obtaining historical stock and index data
Fetching historical stock data from Yahoo!
Fetching index data from Yahoo!
Visualizing financial time-series data
Plotting closing prices
Plotting volume-series data
Combined price and volumes
Plotting candlesticks
Fundamental financial calculations
Calculating simple daily percentage change
Calculating simple daily cumulative returns
Analyzing the distribution of returns
Histograms
Q-Q plots
Box-and-whisker plots
Comparison of daily percentage change between stocks
Moving windows
Volatility calculation
Rolling correlation of returns
Least-squares regression of returns
Comparing stocks to the S&P 500
Summary
6. Trading Using Google Trends
Notebook setup
A brief on Quantifying Trading Behavior in Financial Markets Using Google Trends
Data collection
The data from the paper
Gathering our own DJIA data from Quandl
Google Trends data
Generating order signals
Computing returns
Cumulative returns and the result of the strategy
Summary
7. Algorithmic Trading
Notebook setup
The process of algorithmic trading
Momentum strategies
Mean-reversion strategies
Moving averages
Simple moving average
Exponentially weighted moving average
Technical analysis techniques
Crossovers
Pairs trading
Algo trading with Zipline
Algorithm – buy apple
Algorithm – dual moving average crossover
Algorithm – pairs trade
Summary
8. Working with Options
Introducing options
Notebook setup
Options data from Yahoo! Finance
Implied volatility
Volatility smirks
Calculating payoff on options
The call option payoff calculation
The put option payoff calculation
Profit and loss calculation
The call option profit and loss for a buyer
The call option profit and loss for the seller
Combined payoff charts
The put option profit and loss for a buyer
The put option profit and loss for the seller
The pricing of options
The pricing of options with Black-Scholes
Deriving the model
The value of the cash to buy
The value of the stock received
The formulas
d1 and d2
Black-Scholes using Mibian
Charting option price change over time
The Greeks
Calculation and visualization
Summary
9. Portfolios and Risk
Notebook setup
An overview of modern portfolio theory
Concept
Mathematical modeling of a portfolio
Risk...

Table of contents