
Build a python-based dydx pairs trading bot running in the cloud with AWS hosting and Telegram alerts, and apply co-integrated crypto spread and z-score signals.
Plan a three-phase approach to building a dydx pairs trading bot in Python, covering the strategy, co-integration, risk management, Telegram alerts, and cloud deployment.
Explore manual trading on dydx exchange, using market orders to enter and exit positions on testnet. Learn about layer two, zero knowledge rollup, and risk management while protecting capital.
Read Content Here (free links to help with course content) and Code Resources are attached here too
Explore trading the spread in co-integrated pairs using hedge ratio to form the spread, time trades with the z score, and review backtested vanilla strategies.
Homework: Please watch video on the "Kelly Criterion Crypto Wizards" via YouTube. This video is not available for uploading to Udemy.
Update the DyDx pairs trading bot with Python for version four, detailing new API key flows, the Nevermind library, and end-to-end cloud deployment.
Connect MetaMask to the Cipolla testnet, fund with faucet testnet ether, and securely export your secret phrase and Ethereum address to configure the dy dx trading library.
Learn to set up and test a dy dx pairs trading bot in python on testnet, using environment variables, indexer data, cointegration, and automated trade management.
Install Metamask on Chrome, enable test networks, switch to Gurley test network, and obtain test ether; export the private key to sign transactions programmatically for cloud bot operation.
Set up an http provider via alchemy to access blockchain data, create testnet and mainnet apps, and manage api keys for secure https connections.
Create a constants.py to centralize dydx bot configuration, pulling values from environment variables with python decouple, including mode, abort positions, co-integrated checks, place trades, thresholds, and mainnet/testnet keys.
Identify co integrated pairs and construct market prices for a Python-based trading bot running in the cloud. Schedule hourly or daily market price updates to avoid unnecessary data fetches.
Develop a cointegration function to identify co integrated pairs for pairs trading, calculate the half life and z score, estimate hedge ratios with statsmodels OLS, and save the results.
Stage three builds a bot agent class to open multiple trades using recent candlestick and close price data, evaluate with z-scores, prevent duplicate positions, and save trades.
Initialize a bot agent class to manage opening and monitoring pair trades between two cryptos, including defining a check order status function and storing order details for both markets.
Develop the bot to fetch recent price data, identify trading opportunities, and place and save open trades, as a foundation before exit strategies.
Pass recent price data and z-scores into the bot agent to place trades on the DYDX test net, then track live trades in a json file and manage positions.
Learn to manage exits for open trades in a DYDX pairs trading bot, including loading active positions and implementing manage_trade_exits to close positions on a z-score cross.
Set up an AWS EC2 instance by creating a security group, adding an SSH rule on port 22 for any source IP, and launching the instance.
Learn how to interact with the DYDX Layer 2 Ethereum trading exchange using Python by running a trading bot on AWS Elastic Cloud Compute (EC2). Your bot will be highly advanced in trading in being able to take advantage of statistical arbitrage opportunities in Pairs Trading. This is a great strategy to know given how closely linked many cryptocurrencies are in price behaviour.
Your bot will be able to message you via Telegram so that you can receive live notifications on how well the script is performing (or not performing). It will enable you to:
- Automatically close all existing open positions
- Find cointegrated (linked Crypto pairs) for trading and ascertain whether statistically it makes sense to open a trade
- Manage any open positions and look for exits
- Find and place new trading opportunities
- Alert you if something goes wrong
- Run your bot without your laptop whilst you sleep
Our Python code will interact heavily with the DYDX API and to ensure you understand how to use the API, a cheatsheet has been provided to fast-track you onto being able to use DYDX.
To do this course, you should have used Python in the past, having created and installed packages in a virtual environment and be familiar with basic programming concepts.
That said, you do NOT need to be an advanced Python programmer or advanced trader to do this course. Our strategy uses statistical arbitrage for Pairs Trading, of which you will be walked through the strategy and theory in the beginning in reasonable detail so you understand the nature of what is going on.
See you in Class!
About Your Instructor: Shaun McDonogh has been developing tools for traders for over 5 years at Crypto Wizards and is very close to where the action is in regards to trading Crypto. Shaun's passion is developing applications and teaching others and is delighted to bring this information to the retail market.