
Learn to plan, sketch, and code a Python automated trading bot, use GitHub for version control, and test the full pipeline with Alpaca's free API.
Learn to use tools for automated trading: Alpaca as a commission-free broker with a paper account, Atom.io as an editor, GitHub for version control, and TradingView for stock data.
Please refer to the next lecture to download the Visual Studio Code (VSC) editor, since Atom saw its sunset on December 2022.
Download the new free code editor from Microsoft (yes, even if you are a Mac user).
Explore practical error handling with try and except blocks in python, learn to catch exceptions, print informative messages, and keep programs running when data or code errors occur.
Set real stop losses and take profits using trend analysis, multiple timeframes, and moving averages, with practical examples on Tesla and Alphabet.
The review explains the trading bot’s entry and exit logic with parallel checks for take profit, stop loss, and stochastic crossings, and covers recovery from failed submissions and market orders.
Build the bot scheme by defining the acid, checking tradability, applying trend, rsi and stochastic analyses on 5-minute candles, and managing entries and exits with take-profit and stop-loss checks.
Scaffold a Python trading bot by configuring utf-8 encoding, importing libraries, and initializing a logger. Implement core functions and a main function to run the bot.
Check positions function verifies if a position exists by fetching the current price, retries on failure with a five-second delay, and tracks max attempts.
Open a position in enter position mode, define and monitor take profit and stop loss levels, and loop to exit when targets are reached.
Develop a Python automated trading loop that uses break and continue, checks positions, retrieves current prices for tickers, handles orders, and enters or exits positions based on a trend.
Learn to connect Python code to the alpaca trade API using the Python wrapper, access historic bars and live data, and manage accounts and orders via the GitHub documentation.
IMPORTANT: Alpaca updated the API and it now requires a new implementation, which is described on the videos below. Make sure you check them out.
Alpaca deprecated the V1, so we are now forced to pay for real time data if we stick to Alpaca. We will be introducing Yfinance on the following video, but for now, let's quickly update the code so we can work with the new version.
In this video we are integrating the Yfinance library, pulling data from yahoo in order to avoid the monthly $90 payment of alpaca. Please keep in mind that you will find inconsistencies throughout the rest of the course. I will be talking about a load_historical_function that will be deprecated, but the rest of the functions keep their structure. The rest works as it worked, nothing else changes. We apologize for the inconveniences. Thanks Daniel for your help.
Learn how to verify an order, confirm an open position, and handle pending orders in a Python trading bot, including cancellation when the position isn't found.
Cancel a pending limit order by locating the client order id from the order list and calling the cancel order function, retrying if the price moves unfavorably.
Learn debugging and bug fixing for an automated trading bot, including logging orders, diagnosing incorrect sells, and restructuring position checks to prevent repeated orders.
Trading Bot package files
Hi! Please reverse the two parameters on the call that appears on line 93, inside traderlib.
WRONG LINE:
data = ticker.history(interval,period)
FIXED LINE:
data = ticker.history(period,interval)
My apologies.
Hi there,
I've been in contact with the Alpaca Sales Team and they offered me a 50% discount on the first month $99 fee. I asked for a wider help, but for now they will be adjusting it depending on the demand –so they told me–. This is a little push for you to decide if the trading strategy you worked on suits you. Now, this course includes a 50% off voucher for the Alpaca Real Time Data feed – the premium account. Use the code UDEMY50 when subscribing to the service in order to get $50 off the $99 monthly fee during the first month, to try out the service :)
As they told me, this is the only course that offers this kind of partnership. Hope you enjoy it!
Hi there, thank you for buying this course.
I know it's early, but I wanted to give you a discount referring the other courses I have.
2022 Fastest path for building a web without code skills! I believe, though it's not having much success, an excellent course that gets your web for very little money, being independent of any web designer. Limited code redemptions, as well!
Click the following link: https://www.udemy.com/course/your-landing-page-online/?couponCode=WINTERWEB
NO PAID SUBSCRIPTION for real time data. Automated orders. Your Code. Your Rules.
Everything explained. Trading Bot included. The course has more than 130 lectures (~20h).
If you are a trader wanting to automate your activity, or if you are a programmer interested in stock trading, this is for you. Learn you way towards an automated trading bot that will be able to place orders following your strategy.
2023 UPDATE: the bot now pulls real-time data using the yfinance library, so we're back to free real time data. No test periods, no monthly fees. In case you wanted to integrate it with the paid alpaca service, this is the only course that includes an official 50% off voucher for the first Alpaca monthly fee. You don't have to pay anything if you don't want to.
Easy and Complete. We understand you may not be an expert on trading nor Python. Don't worry, we've got you covered. The package includes a brief crash course on Python3 and another one on Trading Basics.
Your rules. Secure. We teach you how to build a code, not where to put your money. Do it as you wish, being 100% sure about what our code will do. In this course you will get to know each line.
Take Control. Fully implemented in Python3, using the Alpaca API, public libraries and a community wrapper. Your computer. Your pace. Your rules. Your code.
Trading Bot Included. Although it's recommended to type it yourself following the course, we also include the Trading Bot package ready to use.
Call it freedom. Or not. Alpaca is commission free. The cheapest API ($9/mo) that offers real-time market data. Alpaca is a market disrupter. There is no key to being rich, but this program opens a door to having some passive income, if your strategy is good.
We heard you, community. Now it's better. With more than 2000 students on the other version, we decided to make a step up and build an incredibly boosted-up improved and extended version of the course that had its success.
Commission free intraday trading. With Alpaca it's never been that easy before. No trading fees, unlimited intraday orders. Real-time data under a little fee (not sponsored). The first real commission free broker designed for automatic trading.
Enroll now. It's your time to step in.
Join the course to finally enable yourself to go one step further in trading and programming.