Coconote
AI notes
AI voice & video notes
Try for free
📈
Building an AWS Trading Bot Pipeline
Apr 8, 2025
Lecture Notes: AWS Trading Bot Data Pipeline Tutorial
Introduction
Overview of data pipeline for trading bot using AWS Cloud.
Tutorial will cover interaction with Yahoo Finance API and DynamoDB.
Steps include creating AWS user, setting up DynamoDB, configuring AWS client, running Python code, and testing.
AWS User Creation
AWS User Creation Steps
Access AWS console, go to IAM service.
Create a new user with necessary permissions, mainly DynamoDB full access.
Generate access and secret keys.
DynamoDB Setup
Table Creation
Create a new table, "Price History Table," with partition key (ticker) and sort key (timestamp).
Consider enabling deletion protection.
AWS Client Configuration
Package Installation
Ensure boto3 and related packages are installed.
Configuration
Configure AWS client with access key, secret key, default region, and JSON output format.
Python Code Overview
Warm-Up Asset Data Function
Populate DynamoDB with maximum data from Yahoo Finance API if initially empty.
Update Price Table Function
Update existing data in DynamoDB by comparing latest record date with current date.
Database Operations Class
Methods for querying last records, converting data types, and inserting data.
Requirements Clarification
List necessary operations like querying API, formatting data, and updating tables.
Code Implementation
Imports and Classes
Key imports: boto3, yFinance.
Define classes to handle API interaction and database operations.
Main Functions
Warm-up asset data and update price table functions handle data fetching and updating.
Testing and Debugging
Testing
Unit tests available on GitHub to ensure code stability and robustness.
Error Handling
Manage errors in database operations with conditional expressions.
Strategy Implementation (Part 2)
Market Neutral Strategy
Pairs trading strategy using ETFs and inverse ETFs for market neutrality.
Strategy Performance Analysis
Analysis of performance based on market conditions such as volatility and direction.
Backtesting and Improvements
Backtesting results show correlation with S&P 500, potential improvements involve better portfolio weighting schemes.
Conclusion
Overall framework is modular, allowing substitution of different APIs or databases.
Strategy implementation details and backtesting available on GitHub.
Suggestions for future improvements and further research avenues.
📄
Full transcript