Algorithmic Trading with Python: Backtesting, Risk Management and Deployment

Episode 3 62 min

Ivan Brigida Business intelligence analyst

Episode 3 · Algorithmic Trading with Python: Backtesting, Risk Management and Deployment

62 min

What we talked about

Ivan Brigida is an analytics team lead at Google and writes the PythonInvest blog about investing with Python. He studied computer science and holds an economics master.s with a focus on finance and data analysis. He spent four years as a financial analyst at a commercial bank and has been at Google for nine and a half years. He tried people management for half a year and prefers to stay an individual contributor. Alexey opens with a disclaimer that the episode is not investment advice.

Ivan says his economics courses taught him that markets are efficient, so for a while he did not invest. He started the blog as a pet project, and after about a year of writing he began testing strategies in Python and then trading. His most popular article covers finance APIs. Yahoo Finance is enough to start, with Quandl, Pandas Data Reader or the paid Polygon.io as additions. The data is a time series of open, high, low, close and volume.

The simplest strategy he describes is mean reversion, which bets that a falling stock returns to its historical mean. Risk management means setting a loss threshold and selling once it is crossed. After losses from not having one, Ivan moved his own money to a passive strategy of a few exchange-traded funds. For testing, he never shuffles time series data and keeps the last one or two years out of training to avoid leakage. In his own setup he took the 100 largest US stocks, predicted growth one week ahead, picked the top three and traded 20 percent of his capital each day, selling each position after a week.

On metrics, Ivan cares about return on investment and, for binary models, precision over accuracy, since only the stocks predicted to grow matter. Trading fees can eat the profit, so the number of trades should be kept low. His target is growth above five percent in a week. He builds around 200 features from historical windows and favors simple models such as logistic regression, decision trees and XGBoost, because their feature importance helps him debug wrong predictions. For deployment he still clicks a button each day, but he plans to move to scheduled jobs with cron or Airflow and an API that places trades and stop losses.

Ivan took the DataTalks.Club MLOps course and now uses what he learned in ML Zoomcamp. His advice for students is to get Yahoo Finance data, start with a simple step, and stick to the tested strategy, not second-guess it.

Chapters

  1. 1:35 Guest Introduction: Ivan Brigida — Analytics Lead & PythonInvest 1 min
  2. 2:08 Disclaimer: Financial discussion, not investment advice 2 min
  3. 3:53 Background & career trajectory from finance to analytics 3 min
  4. 6:42 Google experience and role transitions 1 min
  5. 7:29 Choosing individual contributor work over people management 2 min
  6. 9:25 Investing interest: economics education to practical trading 2 min
  7. 11:47 Blogging & building a pet project to test strategies 1 min
  8. 13:15 Financial data sources and APIs for retail investors (Yahoo, Quandl, Polygon) 2 min
  9. 15:23 Market data format explained: OHLCV time series 3 min
  10. 18:39 Adjusted close and data quality considerations 1 min
  11. 19:47 Mean reversion strategy: concept and application 2 min
  12. 22:14 Risk management fundamentals and stop-loss thresholds 5 min
  13. 26:48 Backtesting methodology and avoiding time-series data leakage 3 min
  14. 29:44 Walk-forward simulation: weekly predictions and selection rules 6 min
  15. 35:15 Trade execution and position sizing for algorithmic strategies 3 min
  16. 38:24 Discipline: sticking to strategy vs emotional trading 2 min
  17. 40:51 Evaluation metrics: ROI, precision focus, and trading fees impact 3 min
  18. 43:39 Prediction target definition: binary growth thresholds (e.g., 5%) 2 min
  19. 45:55 Feature engineering: time-window stats and handcrafted indicators 2 min
  20. 48:02 Model choices: logistic regression, XGBoost, NN for stock prediction 2 min
  21. 49:58 Explainability: feature importance and model debugging 2 min
  22. 51:46 Deployment options: cron, Airflow, APIs and partial automation 3 min
  23. 55:05 Learning pathways: MLOps, ML Zoomcamp, and practical projects 2 min
  24. 57:29 PythonInvest content: API guides, models, portfolio allocation stories 4 min
  25. 1:01:06 Course plans, sign-up, and community building <1 min
  26. 1:01:36 Episode Wrap-up and final reminder (not financial advice) 1 min

About Ivan Brigida

Ivan Brigida Business intelligence analyst

Ivan Brigida is a business intelligence analyst with over 10 years of experience in digital marketing, statistical modeling, forecasting and visualization, database programming, data analysis, econometrics, machine learning, and finance. As the analytics lead behind PythonInvest, he teaches practical algorithmic trading with Python, covering data sourcing, backtesting, risk management, and model deployment end to end.

Topics in this episode

The wiki pages this conversation is filed under, the strongest first.

MLOps

Reference page for MLOps as the operating discipline for production machine learning systems.

Python Stock Analysis

How Python stock analysis connects market data, features, backtesting, validation, risk controls, and algorithmic trading deployment.

Data Science

Data science through decision-first analysis, modeling, experimentation, trust, production handoff, and neighboring domains.

Machine Learning

Machine learning as applied modeling, evaluation, production design, monitoring, roles, and business tradeoffs.

Tools

How data and ML teams choose and sustain tools across data engineering, MLOps, search, RAG, open source, and developer experience.

AI Finance Decision Support

Finance teams can use AI to turn ERP, CRM, expense, and spreadsheet context into reviewable insight while keeping judgment.

Data Analysis Guide

Practical data analysis guide covering SQL, metrics, dashboards, experiments, stakeholder communication, role boundaries, and portfolio evidence.

Evaluation

How teams judge whether ML, LLM, RAG, product, and production systems are good enough to trust.

ML Infrastructure

Training, feature/data/model pipelines, registries, batch and online serving, monitoring, and platform foundations for production machine learning systems.

Machine Learning System Design

ML system design as a production reference for requirements, labels, feature paths, evaluation, serving, monitoring, fallbacks, and ownership.

Machine Learning for Business

How businesses choose ML use cases, compare baselines, test small-budget options, define business models, and plan adoption and ownership.

Model Monitoring

How teams watch deployed models, diagnose drift, and assign ownership for production ML behavior.

Reproducibility

How data science, ML, research, and data pipeline work becomes rerunnable, reviewable, and explainable.

Related events

Related books

Engineering MLOps

15 questions answered

MLOps is a systematic approach to building, deploying, and monitoring machine learning (ML) solutions. It is an engineering discipline that can be applied to various industries and use cases. This book presents comprehensive insights into MLOps coupled with real-world examples to help you to write programs, train robust and scalable ML models, and build ML pipelines to train and deploy models securely in production.

Emmanuel Raj

Machine Learning for Algorithmic Trading

9 questions answered

The explosive growth of digital data has boosted the demand for expertise in trading strategies that use machine learning (ML). This thoroughly revised and expanded second edition enables you to build and evaluate sophisticated supervised, unsupervised, and reinforcement learning models.

Stefan Jansen

Optional analytics

Optional analytics are off unless you allow them. Your choice does not affect access to DataTalks.Club, Slack, events, or courses.

Current choice: not chosen.

Privacy Policy

If you allow analytics, self-hosted Umami counts anonymous public pageviews without analytics cookies. Private account and learning pages are excluded. Read the Privacy Policy for the complete data boundary.

Want to learn more about our community?

How it started, who's here, and everything that goes on here: courses, events, Slack, and more.

About DataTalks.Club