Python For Finance Investment Fundamentals Data Analytics

Learn Python Programming and Conduct Real-World Financial Analysis in Python - Complete Python Training

Last updated 2022-01-10 | 4.6

- Learn how to code in Python
- Take your career to the next level
- Work with Python’s conditional statements
- functions
- sequences
- and loops

What you'll learn

Learn how to code in Python
Take your career to the next level
Work with Python’s conditional statements
functions
sequences
and loops
Work with scientific packages
like NumPy
Understand how to use the data analysis toolkit
Pandas
Plot graphs with Matplotlib
Use Python to solve real-world tasks
Get a job as a data scientist with Python
Acquire solid financial acumen
Carry out in-depth investment analysis
Build investment portfolios
Calculate risk and return of individual securities
Calculate risk and return of investment portfolios
Apply best practices when working with financial data
Use univariate and multivariate regression analysis
Understand the Capital Asset Pricing Model
Compare securities in terms of their Sharpe ratio
Perform Monte Carlo simulations
Learn how to price options by applying the Black Scholes formula
Be comfortable applying for a developer job in a financial institution

* Requirements

* You’ll need to install Anaconda. We will show you how to do it in one of the first lectures of the course
* All software and data used in the course is free

Description

  • Learn how to code in Python
  • Take your career to the next level
  • Work with Python’s conditional statements, functions, sequences, and loops
  • Work with scientific packages, like NumPy
  • Understand how to use the data analysis toolkit, Pandas
  • Plot graphs with Matplotlib
  • Use Python to solve real-world tasks
  • Get a job as a data scientist with Python
  • Acquire solid financial acumen
  • Carry out in-depth investment analysis
  • Build investment portfolios
  • Calculate risk and return of individual securities
  • Calculate risk and return of investment portfolios
  • Apply best practices when working with financial data
  • Use univariate and multivariate regression analysis
  • Understand the Capital Asset Pricing Model
  • Compare securities in terms of their Sharpe ratio
  • Perform Monte Carlo simulations
  • Learn how to price options by applying the Black Scholes formula
  • Be comfortable applying for a developer job in a financial institution

Course content

20 sections • 185 lectures

What Does the Course Cover? Preview 05:10

In this video, we will discuss:

  • who are the instructors of the course
  • what the course is about
  • who it is for
  • the wide range of topics covered in this course 

Download Useful Resources - Exercises and Solutions Preview 02:54

Learn how to navigate in the Course Content section and find the resources available for all lectures.

Programming Explained in 5 Minutes Preview 05:04

In this lesson, we will explain what you must know about programming if you are just getting started.

Programming Explained in 5 Minutes

Why Python? Preview 05:11

Python is a programming language characterized as:

  • open-source
  • general-purpose
  • high-level

Why Python?

Why Jupyter? Preview 03:29

You must install Python and Jupyter on your computer. If you have them, you can still complete this lecture, because we will say a few interesting things about Jupyter.

Why Jupyter?

Installing Python and Jupyter Preview 07:12

There are various ways to install Python on your computer. But especially for new users, it is highly recommended to choose Anaconda. It will install, not only Python, but also the Jupyter Notebook App and many scientific computing and data science packages.

Jupyter’s Interface – the Dashboard Preview 03:15

In this lesson, we’ll do a quick tour of the Jupyter dashboard. You’ll see how to:

  • manipulate files and folders in the Jupyter dashboard
  • upload and open Python files in Jupyter
  • create new Python files in Jupyter

Jupyter’s Interface – Prerequisites for Coding Preview 06:15

Now that we know more about the dashboard, we are ready to examine the shell and see how to code in Jupyter.  

Jupyter’s Interface

Python 2 vs Python 3: What's the Difference? Preview 02:56

Variables Preview 04:51

In this lesson, we will start coding. We will also introduce you to one of the main concepts in programming – variables.

Variables

Numbers and Boolean Values Preview 03:05

Two distinct numeric types in Python are:

  • integers
  • floating points (floats)

Numbers and Boolean Values

Strings Preview 12:17

In this lesson, we’ll learn about another type of value that can be useful when working in Python – strings. Strings are text values composed of a sequence of characters.

Strings

Arithmetic Operators Preview 03:23

We’ll continue to build our Python syntax knowledge. The next topic on our agenda is arithmetic operators:

  • addition (+)
  • subtraction (-)
  • division (/)
  • multiplication (*)
  • remainder (%)
  • exponentiation (**)

Arithmetic Operators

The Double Equality Sign Preview 01:33

Here, we will explore another useful operator - the double equality sign.

The Double Equality Sign

Reassign Values Preview 01:08

In this video, we will show you how to reassign variables in Python.

Reassign values

Add Comments Preview 01:34

Learn how to use the hash sign for writing comments in Python.

Add Comments

Line Continuation Preview 00:49

In this video, we will show you a neat trick that will be extremely valuable when you become an advanced Python programmer and work with large amounts of code – using the forward slash to finish your code on a new line.

Indexing Elements Preview 01:18

Let’s look at another important concept that will help us a great deal when working in Python - indexing. This is a technique we’ll use frequently, later in the course, especially when we focus on Python’s application in the world of finance.

Indexing Elements

Structure Your Code with Indentation Preview 01:44

The next concept for programming in Python that we will see is fundamental – it is called indentation. The way you apply it in practice is important, as this will be the only mechanism to communicate your ideas to the machine properly.

Structure Your Code with Indentation

Comparison Operators Preview 02:10

In this section, we will learn more about the operators that will help us in our work in Python. We will start with comparison operators.

Comparison Operators

Logical and Identity Operators Preview 05:35

Briefly, the logical operators in Python are the words “not”, “and”, and “or”. They compare a certain number of statements and return Boolean values – “True” or “False” – hence their second name, Boolean operators.

Logical and Identity Operators

Introduction to the IF statement Preview 03:01

Values act as the most basic (or primitive) data elements to form not only variables, but expressions. In this video, you will learn about a prominent example of conditional statements in Python – the IF statement.

Introduction to the IF statement

Add an ELSE statement Preview 02:45

Here, we will focus on adding an ELSE statement to a conditional in Python.

Else if, for Brief – ELIF Preview 05:34

We’ll show you an elegant way to add a second IF statement to one of our expressions. This is done with the help of the ELIF keyword.

A Note on Boolean Values Preview 02:13

You probably noticed we talked about Boolean values a few times. We would like to provide a short video that explains their application.

A Note on Boolean Values

Defining a Function in Python Preview 02:02

In this section, we’ll step it up a notch. Starting from this lesson, we’ll deal with Python’s functions - an invaluable tool for programmers.

Creating a Function with a Parameter Preview 03:49

Our next task will be to create a function with a parameter.

Another Way to Define a Function Preview 02:36

In this lesson, we will explore another way to organize the definition of a function.

Another Way to Define a Function

Using a Function in another Function Preview 01:49

This video provides an example of how to work with functions within functions.

Combining Conditional Statements and Functions Preview 03:06

Combining two of Python’s main tools:

  • IF statements
  • functions

Creating Functions Containing a Few Arguments Preview 01:17

We’ll learn how to work with more than one parameter in a function.

Notable Built-in Functions in Python Preview 03:56

When you install Python on your computer, you are also installing some of its built-in functions, such as:

  • type()
  • int()
  • float()
  • str()
  • max()
  • min()
  • len(), and more

Functions

Lists Preview 04:02

In this section, we’ll cover these types of Python objects:

  • lists
  • tuples
  • dictionaries

Lists

Using Methods Preview 03:19

We will introduce you to the programming term “method” and then see how to invoke a method in Python.

Using Methods

List Slicing Preview 04:30

In this lesson, we’ll introduce you to another important Python concept – slicing.

Tuples Preview 03:11

Let’s discover the tuple – another type of data sequence. Different from a list, the tuple is immutable.

Dictionaries Preview 04:04

Now that you know what lists and tuples are, you will more quickly understand what dictionaries are about. Dictionaries represent another way of storing data.

Dictionaries

For Loops Preview 02:56

In this section, we will be dealing with iteration – a fundamental building block of all programs. It allows us to execute a certain code repeatedly.

Here, we will show you how one could use a for- loop in Python. 

For Loops

While Loops and Incrementing Preview 02:26

The same output we obtained in the previous lesson could be achieved after using a while loop, instead of a for loop. That’s what we will do in this lecture.

Create Lists with the range() Function Preview 03:49

In this lesson, we will show you how to create a Python list with the range() function.

Create Lists with the range() Function

Use Conditional Statements and Loops Together Preview 03:11

Let’s see how one could apply the range() function in a for- loop in Python.

All In – Conditional Statements, Functions, and Loops Preview 02:27

We will count the number of items whose value is less than 20 in a list. To achieve this, we will use these tools:

  • Python conditional statements
  • Python functions
  • Python loops

Iterating over Dictionaries Preview 03:07

Time for a more challenging topic – iterating over a dictionary.

Object Oriented Programming Preview 05:00

The focus of this video is object-oriented programming, OOP. We will explain:

  • what it is
  • which programming languages support it

Object Oriented Programming - Quiz

Modules and Packages Preview 01:05

It is time to learn about Python modules and packages. This will be necessary in the Python for Finance part of the course, too.

Modules - Quiz

The Standard Library Preview 02:47

Let’s talk about Python’s standard library. It is a collection of modules available as soon as you install Python.

The Standard Library - Quiz

Importing Modules Preview 04:10

There are four ways to import a module in Python. You can decide which one you will use when working on your own.

Importing Modules - Quiz

Must-have packages for Finance and Data Science Preview 04:53

Here, we will present the Python libraries and modules used in this course:

  • numpy
  • pandas
  • pandas-datareader
  • matplotlib
  • math
  • statsmodels, and more

Must-have packages - Quiz

Working with arrays Preview 06:02

Arrays are fundamental data structures in any programming language. We will introduce you to them in this lesson.

Generating Random Numbers Preview 02:52

When working with financial data, you won’t always base your calculations on existing data. Sometimes, it will be necessary to run simulations and examine hypothetical scenarios, because historical data will be insufficient. In these situations, you will need a whole set of randomly generated numbers.

A Note on Using Financial Data in Python Preview 02:42

Sources of Financial Data Preview 06:49

Accessing the Notebook Files Preview 02:35

Importing and Organizing Data in Python – part I Preview 03:44

This is an important lecture, as we will explain how we have organized the Python for Finance part of the course in terms of working with financial data downloaded from Yahoo Finance.

Importing and Organizing Data in Python – part II.A Preview 07:01

In this video, we will take the first steps to extract data from online sources.

Importing and Organizing Data in Python – part II.B Preview 04:37

Importing and Organizing Data in Python – part III Preview 04:19

Here, we will add a few tools and techniques to your skillset, allowing you to analyse the data in your DataFrame.  

Changing the Index of Your Time-Series Data Preview 03:17

Restarting the Jupyter Kernel Preview 02:17

Considering both risk and return Preview 02:33

This is where the Python for Finance part of the course starts.

When you think of an investment, you must always evaluate two things – its potential profit or loss. You must know how to measure the potential return and risk of the investment.

Risk and return - Quiz

What are we going to see next? Preview 02:34

In this part of the course, we will use a structured approach. Concepts will be explained in theory first, then we will teach you how to perform the actual calculations in practice using Python. After all, this is a Python for Finance course, right?

Calculating a security's rate of return Preview 05:31

Calculating a security's rate of return

Calculating a Security’s Rate of Return in Python – Simple Returns – Part I Preview 05:23

Here, we will apply the theory covered in the previous lecture in practice and will calculate a security’s rate of return using Python.

Calculating a Security’s Rate of Return in Python – Simple Returns – Part II Preview 03:28

In this lesson, we will see how the values obtained in the previous lecture can be plotted on a graph. 

Calculating a Security’s Return in Python – Logarithmic Returns Preview 03:39

This will be an analogical exercise where we will be dealing with logarithmic (or log) returns. 

What is a portfolio of securities and how to calculate its rate of return Preview 02:39

Most investors own several stocks. The set of stocks an investor holds is called an investment portfolio.

What is a portfolio of securities and how to calculate its rate of return - Quiz

Calculating a Portfolio of Securities' Rate of Return Preview 08:34

This lecture contains two parts:

  • A video about calculating the rate of a return of a portfolio in Python
  • A notebook file explaining how to use the .loc() and .iloc() methods.

Popular stock indices that can help us understand financial markets Preview 03:24

In this lecture, we will go through the most popular market indices globally.

Which of the following is not an index? - Quiz

Calculating the Indices' Rate of Return Preview 05:03

Now that we have learned more about stock returns and what stock indices are, it will be great to learn how to calculate their performance in Python. That’s what we will do in this video. Using Python for Finance is not a mirage anymore, is it?

How do we measure a security's risk? Preview 06:05

This will be a theoretical lesson explaining how we usually measure a security’s risk. 

Which of the following sentences is true? - Quiz

Calculating a Security’s Risk in Python Preview 05:55

The focus of this lecture will be the calculation of a security’s risk in Python. 

The benefits of portfolio diversification Preview 03:28

In this video, we will explore the relationship between the returns of financial securities.

Investing in stocks - Quiz

Calculating the covariance between securities Preview 03:34

Covariance - Quiz

Measuring the correlation between stocks Preview 03:59

This lesson will be an introduction to quantifying the relationship between the returns of financial securities. 

Correlation - Quiz

Calculating Covariance and Correlation Preview 05:00

Python for Finance: Calculate covariance and correlation.

Considering the risk of multiple securities in a portfolio Preview 03:19

Now is the time to consider a portfolio of at least two stocks. More precisely, we will focus on how the variance of a portfolio can be calculated.

Calculating Portfolio Risk Preview 02:38

In this lesson, we will show you a wonderful NumPy technique that will facilitate all the matrix manipulations you must perform when using Python for Finance. We will apply this technique to estimate a portfolio’s risk.

Understanding Systematic vs. Idiosyncratic risk Preview 02:58

In this video, we will explain the difference between systematic and unsystematic risk.

Diversifiable Risk - Quiz

Calculating Diversifiable and Non-Diversifiable Risk of a Portfolio Preview 04:28

With this lesson, we’ll complete the section in which we studied financial risk calculation.  Our task will be to disaggregate a portfolio’s diversifiable and non-diversifiable risk using Python.

The fundamentals of simple regression analysis Preview 03:55

In this video, we will lay the theoretical foundations of simple regression analysis.

Regressions - Quiz

Running a Regression in Python Preview 06:35

Here, we will Introduce the fundamentals of regression analysis.

Are all regressions created equal? Learning how to distinguish good regressions Preview 04:55

In this lecture, we will introduce you to a few important regression indicators, such as:

  • Alpha
  • Beta
  • R squared

Regressions - Quiz

Computing Alpha, Beta, and R Squared in Python Preview 06:14

In this video, we will see how to carry out regression analysis in Python and will obtain in practice the same indicators we presented to you in our previous lesson:

  • Alpha
  • Beta
  • R squared

Markowitz Portfolio Theory - One of the main pillars of modern Finance Preview 06:34

In 1952, Harry Markowitz published a paper, which was one of the most powerful academic breakthroughs we’ve seen in the world of finance.

His work changed the way financiers look at their portfolios and formalized an intuition previously suggested by some practitioners. Investors shouldn’t put all their eggs in one basket.

Markowitz proved the existence of an efficient set of portfolios that optimize investors’ return for the amount of risk they are willing to accept.

Markowitz - Quiz

Obtaining the Efficient Frontier in Python – Part I Preview 05:35

In this lesson, we’ll carry out a great Python exercise. We will learn how to calculate the efficient frontier of a group of portfolios composed of two assets – Procter & Gamble’s stock and the S&P 500 index.

Obtaining the Efficient Frontier in Python – Part II Preview 05:18

In this video, we will write the formula for expected portfolio return. It is given by the sum of the weighted annualized average log returns. Here, we will apply Python tools, such as:

  • the np.sum() function
  • the .append() method
  • random number generation

Obtaining the Efficient Frontier in Python – Part III Preview 02:07

In the previous two lectures, we did most of the heavy lifting. Now, we’ll complete the exercise and see the output of our work.

The intuition behind the Capital Asset Pricing Model (CAPM) Preview 04:44

In this lesson, we will introduce you to the intuition behind one of the most widely used models in the world of finance – the Capital Asset Pricing Model (CAPM). Its application includes the study of financial indicators like:

  • the beta of a stock
  • the expected return of a stock
  • the Sharpe ratio

CAPM - Quiz

Understanding and calculating a security's Beta Preview 04:14

In this lecture, we will introduce you to the concept of Beta – one of the main pillars of the Capital Asset Pricing Model (CAPM).

Beta - Quiz

Calculating the Beta of a Stock Preview 03:38

Here, we will calculate the Beta of a stock in Python. Beta is a fraction:

  • its nominator equals the covariance between the stock and the market
  • its denominator is the variance of the market

The CAPM formula Preview 04:20

In this lesson, we will introduce you to the Capital Asset Pricing Model (CAPM). Its main equation, for calculating the expected return of a security, involves such measures as:

  • the return of a risk-free asset
  • the beta between the stock and the market
  • the market return

CAPM - Quiz

Calculating the Expected Return of a Stock (CAPM) Preview 02:16

In this lecture, we will show another real-world application of Python for Finance. We will calculate P&G ’s expected return.

Introducing the Sharpe ratio and how to put it into practice Preview 02:21

Rational investors want to compare stocks in terms of risk-return performance. The Sharpe ratio is used to measure the expected risk-return performance of a portfolio and compare it with the risk-return performance of other portfolios.

Sharpe ratios - Quiz

Obtaining the Sharpe ratio in Python Preview 01:22

Here, we will continue our analysis of the Procter & Gamble stock relative to S&P 500 (which is an approximation of the market). Then, we will calculate the Sharpe ratio.

Measuring alpha and verifying how good (or bad) a portfolio manager is doing Preview 04:13

Alpha - Quiz

Multivariate regression analysis - a valuable tool for finance practitioners Preview 05:42

In this lesson, we will elaborate on multivariate regressions. This topic extends the single-variable setting considered in the Python for Finance part of the course.

Multivariate Regressions - Quiz

Running a multivariate regression in Python Preview 06:20

We will run a multivariate regression in Python, applying it in a finance context.

The essence of Monte Carlo simulations Preview 02:31

This lesson includes:

  • a video that will introduce the concept of using Monte Carlo simulations in the world of finance
  • an IPython notebook file containing information about using a normal distribution in Python

Monte Carlo - Quiz

Monte Carlo applied in a Corporate Finance context Preview 02:30

In this lesson, we will discuss the application of Monte Carlo simulations in a Corporate Finance setting.

Monte Carlo in Corporate Finance - Quiz

Monte Carlo: Predicting Gross Profit – Part I Preview 06:03

In this video, we will see how we can use a Monte Carlo computer simulation to project a company’s future revenues and expenses in Python to perform a financial projection of future results.

Monte Carlo: Predicting Gross Profit – Part II Preview 02:56

The difference between Revenues and Cogs gives us Gross Profit. Computing the latter in Python is the objective of this lesson.

Forecasting Stock Prices with a Monte Carlo Simulation Preview 04:27

In this lesson, we’ll show you the mechanics of using Monte Carlo for asset pricing.

Monte Carlo Simulations - Quiz

Monte Carlo: Forecasting Stock Prices - Part I Preview 03:39

We’ll continue to explore how Monte Carlo simulations can be applied in practice. We will see how we can run a simulation when trying to predict the future stock price of a company.

Monte Carlo: Forecasting Stock Prices - Part II Preview 04:38

Here, we will continue from where we left off. While working in Python, we will be using these tools:

  • the .values method
  • norm.ppf()
  • np.exp()

Monte Carlo: Forecasting Stock Prices - Part III Preview 04:17

All we have to do in this lesson is create a price list. Each price must equal the product of the price observed the previous day and the simulated daily return.

An Introduction to Derivative Contracts Preview 06:32

In this video, we will introduce you to the most widely used financial derivatives:

  • forwards
  • futures
  • swaps
  • options

Derivatives - Quiz

The Black Scholes Formula for Option Pricing Preview 04:51

Here, we will show you what the Black Scholes Merton formula does and will introduce the variables constituting it:

  • S – stock’s market price
  • K – strike price
  • T – option’s time until expiration
  • R – risk-free rate
  • S – standard deviation

Monte Carlo: Black-Scholes-Merton Preview 06:00

Our goal in the next few lessons will be to calculate the price of a call option. In this video, we will apply the Black Scholes Merton formula we introduced earlier.

Using Monte Carlo with Black-Scholes-Merton - Quiz

Monte Carlo: Euler Discretization - Part I Preview 06:21

In this lecture, we will show you how we can calculate the price of a stock option in a more sophisticated way. This exercise will involve more advanced features of finance and mathematics.

We will start by importing all Python libraries and modules we have used so far:

  • NumPy
  • SciPy
  • Pandas
  • Pandas-DataReader
  • Matplotlib

Monte Carlo: Euler Discretization - Part II Preview 02:09

In the final lecture of our course, Python for Finance: Investment Fundamentals and Data Analytics, we will calculate the payoff of a call option in Python.

pandas Series - Introduction Preview 08:33

pandas - Working with Methods - Part I Preview 04:49

pandas - Working with Methods - Part II Preview 02:32

pandas - Using Parameters and Arguments Preview 04:09

pandas Series - .unique() and .nunique() Preview 03:49

pandas Series - .sort_values() Preview 03:58

pandas DataFrames - Introduction - Part I Preview 04:41

pandas DataFrames - Introduction - Part II Preview 05:05

pandas DataFrames - Common Attributes Preview 04:15

pandas DataFrames - Data Selection Preview 06:55

pandas DataFrames - Data Selection with .iloc[] Preview 05:56

pandas DataFrames - Data Selection with .loc[] Preview 03:52

Technical Analysis - Principles, Applications, Assumptions Preview 02:56

Charts Used in Technical Analysis Preview 05:32

Other Tools Used in Technical Analysis Preview 01:52

Trend, Support and Resistance Lines Preview 03:56

Common Chart Patterns Preview 04:25

Price Indicators Preview 03:46

Momentum Oscillators Preview 03:42

Non-price Based Indicators Preview 04:47

Technical Analysis - Cycles Preview 04:07

Intermarket Analysis Preview 01:09