
Learn to build a Python trading bot by collecting stock data via an API, computing indicators, and backtesting strategies to trade equities automatically.
Connect your drive to Google Colab, open a new notebook, and learn to run python code in Jupiter notebooks, using code and text cells to view outputs.
Sign up for an Alpaca trading account to power your Python trading bot, generate and securely store your API key and secret key, and review your equity and portfolio data.
Define variables by name, assignment, and value in Python, using strings, integers, floats, and booleans, and learn type conversion with int, float, and str, plus inspecting types and common errors.
Learn how to slice and concatenate strings in Python, remove leading spaces with strip, normalize case with lower and upper, replace substrings, and format outputs with format and %s.
Master Python lists by declaring, indexing, and slicing, using range that returns a tuple to generate numbers, and applying key methods like append, extend, reverse, index, and count.
Explore Python dictionaries: create and access by key, modify and remove items, and add multiple entries with update, while noting dictionaries are not ordered in this version.
Explore Python conditional statements using if, elif, and else to compare variables, apply and or logic, and understand condition order and readability for clear decision making.
Explore for loops to iterate over lists, tuples, dictionaries, and strings, then master nested loops and while loops with break, continue, and pass to control flow, including practical examples.
Learn how to read keyboard input in Python with the input function, print results, and manage errors using try-except and finally, including raising exceptions and float conversion.
Learn to create, write, read, and manage files in Python using open, close, and modes like w, r, and x, while handling relative paths, dot slash references, and backslash escapes.
Learn to declare and use Python functions with def, including returning multiple values and handling lists, and explore recursion with factorial to optimize code.
Learn how to declare Python classes, add methods, and use init and self, while exploring attributes, examples with cars and people, and how built-in string and list methods differ.
Discover how the pandas package helps manage data in Python by creating series from lists or dictionaries, setting custom indexes, and performing filtering, arithmetic, and isna and notna checks.
Explore how to work with pandas dataframes, building them from dictionaries, selecting rows and columns with iloc and loc, and using head to preview data.
Import the needed function and download the Tepes dataset. Load into a Python data frame and select rows and columns with equals, not equals, and smoker or male conditions.
Group data by a single column or two attributes to form clusters, then summarize with mean or describe, while handling the data frame index and grouping results.
Load a data set, create a percentage of total bill column, and use groupby to compute mean and max by day, then sort by total to reveal patterns.
Explore numpy overview by creating arrays, inspecting shapes, and manipulating data types. Learn indexing, slicing, and reshaping to manage one- and two-dimensional numeric data for stock market applications.
Learn to serialize python data to json with the json package, using dumps and dump (with indent) and deserialize back with loads and load for dictionaries and lists.
Learn how to use the request package to fetch data with get and post requests, handle status codes, headers, and parameters, and process JSON and text responses.
Connect to the Alpaca API using Python by importing requests and JSON, configuring API keys and base URLs, and retrieve account details and past orders through defined functions.
Create buy and sell orders with a function that builds a data dictionary (symbol, quantity, side, type, time in force) and posts it to Alpaca, then interpret the order status.
Explore advanced order types, including price limit, stop loss, and bracket orders, and learn how to place, manage, and cancel them using the API.
Extract alpaca data by downloading 15-minute bars for symbols like Apple and Microsoft, including open, high, low, close, and volume. Convert the data to json and pandas dataframe for analysis.
Learn data processing with pandas by downloading bank data, extracting closing prices from a data frame, and converting timestamps to datetime formats for analysis.
Learn to calculate and visualize technical indicators to predict price movements and guide entry and exit decisions. Cover trend indicators (moving averages), oscillators (RSI, stochastic), volume, and Fibonacci retracement.
Learn to compute RSI and the simple moving average using an API, then plot both indicators together in Python for trading insights.
Calculate moving averages without an API by pulling Yahoo Finance data, converting to a pandas data frame, and using rolling means for 10, 30, and 40 periods with adjusted close.
Learn how bollinger bands measure volatility with a middle moving average and upper and lower bands driven by standard deviation. Apply crossing signals and stop-loss ideas for trading.
Learn the stochastic indicator to measure momentum, compute percentage k from high/low ranges, apply a moving average, and use crossovers to signal buys and sells.
Learn backtesting by applying a strategy to historical data to verify past performance across assets, accounting for broker fees and data quality.
Install and configure the trader package, set up a brain with a broker and cash, and run a backtest to see if the strategy is profitable.
Learn how to import data for a trading bot by downloading stock data from Yahoo! Finance, converting it to a pandas data frame, and preparing it for analysis.
Learn how to add a simple strategy in Python for backtesting, using closing prices to trigger buys and exploring simple moving averages and minimum data periods.
Learn how to monitor order life cycles with notify_order, handle broker execution delays, and respond to margin rejected or completed orders in a Python trading bot.
Add broker commissions and visualize trades to test strategies, using simple moving average, exponential moving average, and RSI, while plotting buy and sell points, cash and asset price, assessing profitability.
Develop and test multiple trading strategies through backtesting, select a winning approach, and connect it to your broker API, using simple moving averages to enable live trading.
Backtest and optimize simple moving average parameters for a Python trading bot, evaluating 5–30 day periods across 2016–2019 and selecting the best by mean income and standard deviation.
Explore backtesting of the relative strength index (RSI) trading strategy in Python, optimizing three RSI parameters with lower limits 20–40 and upper limits 60–80, and evaluating buy/sell signals and results.
Apply a fast 28-day and slow 36-day moving average crossover to generate buy and sell signals from the closing price, with backtested results showing about 7.4% return.
Experience how combining simple moving averages and RSI creates buy signals from MA crossovers or RSI below 30, and sells on crossovers, with tests optimizing fast and slow MA settings.
Compare four strategies across iRobot and Amazon, showing how best results vary by company, and emphasize backtesting, parameter tuning, and implementing the simple moving average and RSI.
Develop a python-based trading bot that uses simple moving averages and the RSI, including data import, indicator calculation, and two-day lookback buy/sell signals.
Use the API to fetch account data, manage orders and open positions, calculate buy quantities from cash, and run a daily bot placing limit orders on RSI and moving-average signals.
Would you like to learn how to develop bots to invest in the stock market? Or would you like to optimize your strategies?
In this course we will teach you how to fulfil these objectives and more! We are going to learn how to program in Python from scratch and build our knowledge until we are able to: 1) download data and transform it according to our wants and needs; 2) develop and backtest strategies; and 3) develop trading bots. This course is divided in 7 different modules:
Introduction to the course. In this first section we are going to explore the outline of the course, how to use google colab and other basic pieces of information needed to start the course.
Introduction to Python. Here we are going to learn the essential elements of programming like what are variables, classes and functions.
Pandas and other useful packages. We will learn how to use pandas and other packages that will allow us to download and manipulate data.
Use of Alpaca's API. Where we will learn to download financial data and place buy/sell orders.
Financial indicators. Here we will learn the theory behind some financial indicators and how to calculate them.
Backtesting. In this section we are going to use financial data to optimize the parameters of our strategies in order to earn as much money as we can.
Creating a trading bot. Finally we are going to learn how to create a trading bot that will invest on its own without our constant supervision.