Python for Finance

Python for Finance is a programming language course designed to teach individuals how to use Python for financial analysis and quantitative finance applications.

I Used $300 of Cloud Credits to Train an AI Stock Trading Bot

I demonstrate how to build an AI trading bot using $300 of cloud GPU credits. Learn to connect Interactive Brokers, code strategies in Python, and train Neural Networks/GRU models for stock prediction using NVIDIA GPUs. Complete tutorial from data preprocessing to backtesting and live testing on a paper trading account with performance results.

🧠 *Sign up for Datalore:*
https://jb.gg/check_datalore
Use promo code Analyze_Like_Ryan for 50% off Datalore Cloud (monthly or yearly)

✅ *Get The Code Created In This Video For Free:*
https://jb.gg/Datalore-notebook

📈 *Sign up for an Interactive Brokers Account:* (click “Open Account”)
https://ryano.finance/ibkr-overview

💾 *Download TWS & TWS API:*
https://ryano.finance/ibkr-tws-api

Chapters:
0:00 – Introduction: The Algorithmic Trading Challenge
0:55 – What You’ll Learn in This AI Trading Tutorial
1:25 – How to Connect Trading Bot to Interactive Brokers
4:47 – Setting Up Real-Time Market Data Connection
6:15 – Coding a Simple Trading Strategy in Python
10:23 – How to Develop Profitable Trading Strategies
12:18 – Connecting to NVIDIA GPU for AI Training
14:11 – Downloading Historical Stock Data (Minute Bars)
15:31 – My Expectations for This AI Trading Experiment
15:57 – Cloud GPU Pricing and Cost Analysis
16:37 – Data Preprocessing for Machine Learning
20:26 – Training Neural Network for Stock Prediction
28:48 – Optimizing AI Model with Lower Learning Rate
30:22 – Training GRU Model for Time Series Prediction
35:39 – Backtesting AI Trading Strategy on Multiple Stocks
43:13 – Live Trading with Our Best AI Algorithm
46:32 – Final Results: AI Trading Bot Performance

*Disclosure: This is not financial advice. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC. Some of the links above are affiliate links, meaning, at no additional cost to you, I will earn a commission if you click through and make a purchase.

This content is provided by a paid Influencer of Interactive Brokers. Influencer is not employed by, partnered with, or otherwise affiliated with Interactive Brokers in any additional fashion. This content represents the opinions of Influencer, which are not necessarily shared by Interactive Brokers. The experiences of the Influencer may not be representative of other customers, and nothing within this content is a guarantee of future performance or success.

None of the information contained herein constitutes a recommendation, promotion, offer, or solicitation of an offer by Interactive Brokers to buy, sell or hold any security, financial product or instrument or to engage in any specific investment strategy. Investment involves risks. Investors should obtain their own independent financial advice and understand the risks associated with investment products and services before making investment decisions. Risk disclosure statements can be found on the Interactive Brokers website.

Interactive Brokers is a FINRA registered broker and SIPC member, as well as a National Futures Association registered Futures Commission Merchant. Interactive Brokers provides execution and clearing services to its customers. For more information regarding Interactive Brokers or any Interactive Brokers products or services referred to in this video, please visit interactivebrokers.com.

This System is designed to automate trading decisions based on mathematical models, historical data analysis, and machine learning algorithms. The System operates continuously and may trade when you’re not monitoring it, algorithmic trading strategies may become less effective as more participants implement similar approaches, regulatory changes may impact the System’s ability to operate effectively, over-optimization risk – strategies may be too finely tuned to historical data and perform poorly in live markets, black swan events – extreme market movements can lead to substantial losses. Past performance is not indicative of future results, and there is no guarantee of profitability.

The projections or other information regarding the likelihood of various investment outcomes generated by the Tools mentioned in this video are hypothetical in nature, do not reflect actual investment results, and are not guarantees of future results. It is important to understand that these projections are based on certain assumptions and models, and actual outcomes may differ significantly. Please note that results may vary over time.

Any trading symbols, entities or investment products displayed or named in this podcast are for illustrative purposes only and are not intended to portray recommendations.

The examples discussed are purely for technical demonstration purposes, and do not constitute trading advice. Also, it is important to remember that placing trades in a paper account is recommended before any live trading.

AI for Business & Finance Certificate Program by Columbia Business School

Explore how artificial intelligence is transforming careers in my review of the AI for Business & Finance Certificate Program by Columbia Business School. I share personal insights on AI, highlight the program’s comprehensive curriculum, and discuss why this certificate carries serious weight in today’s competitive job market. Discover how Columbia’s structured course keeps professionals ahead of rapid changes in large language models (LLMs). Find out if this AI-focused certificate from Columbia Business School matches your career ambitions.

🎓 *Columbia & Wall Street Prep AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for exclusive tuition savings:* https://ryano.finance/columbia-ai

Chapters
0:00 – My Views on AI
0:51 – Columbia AI for Business & Finance Certificate Program
2:21 – Why I Take This Program Seriously
3:43 – The Programs Structure & Curriculum
9:01 – Keeping Up With the Changes In the LLM Space
10:02 – Who This Program May Appeal To

*Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC. Some of the links above are affiliate links, meaning, at no additional cost to you, I will earn a commission if you click through and make a purchase.

Backtesting a Trading Strategy in Python With AI Generated Code

Join Ryan O’Connell, CFA, FRM, as he guides you through backtesting a trading strategy using Python, enhanced with AI-generated code, to achieve optimal investment results. Start by setting up Datalore and creating a new Jupyter Notebook, then move on to retrieving and analyzing historical stock data to calculate daily returns. Learn how to identify the biggest losers each day and simulate a mean reversion trading strategy to evaluate its effectiveness. This tutorial also covers how to calculate key portfolio performance metrics, including Sharpe Ratio and Standard Deviation, and compares these against a benchmark. Finish with visual insights as you plot the growth of your portfolio and the benchmark over time, and download the code to apply these powerful techniques to your trading strategies.

🤖 Sign Up For Datalore:
https://jb.gg/check-out-datalore

💾 Download Free Code & AI Prompts Automatically:
https://jb.gg/datalore-report

🖺 Link to Full Article:
https://jb.gg/blog-datalore

Chapters
0:00 – The Trading Strategy We Will Backtest
1:34 – Signing Up for the Development Environment: Datalore
2:11 – Creating a New Jupyter Notebook
3:38 – Download The Free Python File & AI Prompts
4:35 – Retrieve Historical Stock Data
12:58 – Calculate Daily Stock Returns
14:57 – Identify the 10 Biggest Losers Each Day
17:06 – Simulate the Mean Reversion Trading Strategy
22:28- Calculate Portfolio Performance Metrics
25:01 – Compare Performance Metrics of Portfolio vs Benchmark
29:22 – Plot the Growth of Portfolio & Benchmark Overtime
32:10 – Check Out the Full Article

*Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC.

Value at Risk (VaR) In Python: Parametric Method

Dive into our comprehensive guide on “Value at Risk (VaR) In Python: Parametric Method”. From installing essential libraries to interpreting the final VaR results, this video covers every step. Learn how to choose stock tickers, calculate daily log returns, set up confidence intervals, and more using Python. Master the art of financial risk management and enhance your portfolio analysis skills today.

📈 *See Why I Recommend This Broker:* https://ryano.finance/ibkr-overview

💻 *Find the Code Written In this Video Here:* https://ryanoconnellfinance.com/estimating-value-at-risk-with-python/

🎓 *Columbia AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for up to $500 Off:* https://ryano.finance/columbia-ai

Chapters:
0:00 – Intro to “Value at Risk (VaR) In Python: Parametric Method”
0:19 – Installing Necessary Libraries
0:48 – Set Time Range of Historical Returns
1:59 – Choose Your Stock Tickers
2:39 – Download Adjusted Close Prices from yFinance
4:19 – Calculate Individual Stock Daily Log Returns
6:11 – Create an Equally Weighted Portfolio
7:15 – Calculate Total Portfolio Daily Returns
8:10 – Find Portfolio Returns for a Range of Days
9:22 – Create the Covariance Matrix
10:05 – Calculate Portfolio Standard Deviation
11:10 – Set Confidence Intervals for VaR
11:39 – Calculate Value at Risk (VaR) In Python
13:00 – Print and Interpret the VaR Results

Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC. Some of the links above are affiliate links, meaning, at no additional cost to you, I will earn a commission if you click through and make a purchase.

Black-Scholes in Python: Option Pricing Made Easy

Unlock the power of the Black-Scholes model with this easy-to-follow Python tutorial. Starting with importing essential libraries, we’ll walk you through defining variables, calculating d1, d2, and deriving both call and put option prices. By 9:41, we deep dive into the intuition behind the Black-Scholes pricing formula. Perfect for finance enthusiasts looking to sharpen their Python skills and understand option pricing!

📈 *See Why I Recommend This Broker For Options:* https://ryano.finance/ibkr-overview

💻 *Find the Code Written In this Video Here:* https://ryanoconnellfinance.com/step-by-step-guide-implementing-the-black-scholes-model-in-python/

🎓 *Columbia AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for up to $500 Off:* https://ryano.finance/columbia-ai

Chapters:
0:00 – Import the Neccessary Libraries
1:07 – Define the Variables
3:11 – Calculate d1
4:36 – Calculate d2
4:50 – Calculate Call Option Price
7:29 – Calculate Put Option Price
9:41 – Making Sense of the Black Scholes Pricing Model

Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC. Some of the links above are affiliate links, meaning, at no additional cost to you, I will earn a commission if you click through and make a purchase.

Value at Risk (VaR) In Python: Historical Method

Join Ryan O’Connell, CFA, FRM, in “Value at Risk (VaR) In Python: Historical Method,” as he explores financial risk management. The tutorial covers setting up Python, selecting stock tickers, downloading Adjusted Close Prices from yFinance, and calculating daily log returns for individual stocks. You’ll also create an equally weighted portfolio and compute its total daily returns. Finally, O’Connell guides you through calculating VaR and plotting the results on a bell curve. This tutorial is perfect for financial analysts and Python enthusiasts.

📈 *See Why I Recommend This Broker:* https://ryano.finance/ibkr-overview

💻 *Find the Code Written In this Video Here:* https://ryanoconnellfinance.com/value-at-risk-analysis-using-python/

🎓 *Columbia AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for up to $500 Off:* https://ryano.finance/columbia-ai

Chapters:
0:00 – Intro to “Value at Risk (VaR) In Python”
0:19 – Installing Necessary Libraries
0:48 – Set Time Range of Historical Returns
1:59 – Choose Your Stock Tickers
2:39 – Download Adjusted Close Prices from yFinance
4:19 – Calculate Individual Stock Daily Log Returns
6:11 – Create an Equally Weighted Portfolio
7:15 – Calculate Total Portfolio Daily Returns
8:10 – Find Portfolio Returns for a Range of Days
9:23 – Calculate Value at Risk (VaR)
11:44 – Plot the Results on a Bell Curve

Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC. Some of the links above are affiliate links, meaning, at no additional cost to you, I will earn a commission if you click through and make a purchase.

Value at Risk (VaR) In Python: Monte Carlo Method

Discover the power of Python for risk analysis in our tutorial ‘Value at Risk (VaR) In Python: Monte Carlo Method.’ We delve deep into the world of financial risk, breaking down the complex Monte Carlo method and its application in calculating VaR. Whether you’re a financial analyst, data scientist, or Python enthusiast, this video will provide you with practical, actionable knowledge. Get ready to master the art of risk prediction using Monte Carlo simulations in Python!

📈 *See Why I Recommend This Broker:* https://ryano.finance/ibkr-overview

💻 *Find the Code Written In this Video Here:* https://ryanoconnellfinance.com/monte-carlo-value-at-risk-python/

🎓 *Columbia AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for up to $500 Off:* https://ryano.finance/columbia-ai

Chapters:
0:00 – Intro to “Value at Risk (VaR) In Python”
0:15 – Installing Necessary Libraries
0:43 – Set Time Range of Historical Returns
1:54 – Choose You’re Stock Tickers
2:34 – Download Adjusted Close Prices from yFinance
4:14 – Calculate Daily Log Returns
6:06 – Calculate Portfolio Expected Return
7:52 – Calculate Portfolio Standard Deviation
10:11 – Create an Equally Weighted Portfolio
11:35 – Determine Z-Scores Randomly
12:25 – Calculate Scenario Gains & Losses
14:20 – Run 10,000 Simulations (Monte Carlo Method)
15:35 – Specify Confidence Interval Level & Calculate VaR
17:49 – Plot the Results on a Bell Curve

*Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC

Free Stock Prices in Python & Excel Export | yFinance

Ryan O’Connell, CFA, FRM shows how to retrieve free stock prices in Python and export them to Excel using yFinance.

📈 *See Why I Recommend This Broker:* https://ryano.finance/ibkr-overview

💻 *Find the Code Written In this Video Here:* https://ryanoconnellfinance.com/downloading-historical-stock-prices-and-exporting-to-excel-using-yfinance-and-python/

🎓 *Columbia AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for up to $500 Off:* https://ryano.finance/columbia-ai

Chapters:
0:00 – Import the Required Libraries
1:25 – List the Stocks You Are Interested In
2:06 – Setup the Time Range
3:23 – Download Stock Prices in Python Using yFinance
5:21 – Display the Resulting Dataframe
5:37 – Export the Dataframe to Excel

*Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC

Alternative Titles:
“YFinance: Free Stock Prices in Python & Excel Integration”
“Python for Finance: Free Stock Prices with YFinance & Excel Export”
“Master YFinance: Free Stock Prices in Python and Excel Made Easy”
“Free Stock Data: YFinance Python to Excel Workflow Tutorial”
“YFinance Python: Free Stock Prices & Excel Export Simplified”
“Export Free Stock Prices to Excel with YFinance in Python”
“Python & YFinance: Unlock Free Stock Prices and Excel Compatibility”
“Free YFinance Stock Prices: Python to Excel Automation Guide”
“Zero-Cost Stock Prices: YFinance Python and Excel Integration”
“Effortlessly Transfer Free Stock Prices with YFinance from Python to Excel”

Portfolio Optimization in Python: Boost Your Financial Performance

Ryan O’Connell, CFA, FRM shows you how to perform portfolio optimization in Python. Have you ever wondered how to calculate the optimal portfolio from a group of risky stocks or securities? Find out here!

📈 *See My Free Portfolio Optimization Tool Here:* https://ryanoconnellfinance.com/portfolio-optimization/

💻 *Find the Code Written In this Video Here:* https://ryanoconnellfinance.com/portfolio-optimization-using-python-and-modern-portfolio-theory/

🎓 *Columbia AI for Business & Finance Certificate Program* 🎓
► *Use code RYAN for up to $500 Off:* https://ryano.finance/columbia-ai

Chapters:
0:00 – Intro to Portfolio Optimization in Python
0:36 – Import Required Libraries
1:52 – Define Securities and Time Range
3:57 – Import Adjusted Close Prices From yFinance
6:48 – Calculate Daily Returns (Lognormal)
8:36 – Calculate the Covariance Matrix
9:57 – Calculate Optimal Weights of the Portfolio
10:07 – Calculate Portfolio Expected Return and Standard Deviation
13:38 – Calculate the Sharpe Ratio
14:56 – Retrieve the Risk Free Rate from the FRED API
16:51 – Set the Initial Weights and Constraints
18:13 – Find the Weights in the Optimal Portfolio
20:44 – Display the Optimal Portfolio Results

*Get Free FRED API Key:* https://fred.stlouisfed.org/docs/api/api_key.html

*Disclosure: This is not financial advice and should not be taken as such. The information contained in this video is an opinion. Some of the information could be wrong. This channel is owned and operated by Portfolio Constructs LLC

Alternative Titles:
“Portfolio Optimization Mastery: Enhance Your Investments with Python”
“Python for Portfolio Optimization: Boost Your Financial Performance”
“Discover the Power of Python in Portfolio Optimization”
“Portfolio Optimization Techniques: Unleash Python’s Potential”
“Optimal Investment Strategies: Portfolio Optimization with Python”
“Achieve Financial Success through Portfolio Optimization in Python”
“Mastering Portfolio Optimization: Python’s Guide to Better Investments”
“Supercharge Your Investments: Portfolio Optimization using Python”
“The Python Advantage: Expert Portfolio Optimization Tips”
“Portfolio Optimization in the Digital Age: Python’s Winning Formula”

Explore Top Finance Certificates

Access official certificates from Wharton Online & Columbia Business School Executive Education, powered by Wall Street Prep. Save up to $500 with code RYAN.

Contact Me

Feel free to reach out to discuss your freelance project needs, and let’s collaborate on bringing your vision to life!

Contact Me

Have a question or want to work together? Fill out the form below and we’ll get back to you as soon as possible.

Contact Form Demo

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.