Invest your credit card rewards into the stock market, automatically. Supports other micro-investing strategies using Alpaca and fractional trading. This also serves as an introductory repo for programatic investing.
Project by thecardcaddie.com.
Simple Setup (Recommended):
./build.shThis interactive script guides you through setup for either local or Lambda deployment.
Or choose your deployment method manually:
-
For local deployment (run on your computer):
cd deployments/local/ python setup.py -
For serverless deployment (AWS Lambda):
cd deployments/lambda/ ./build.sh # Then follow lambda/README.md for AWS setup
Not sure which to choose?
- Local = Full control, runs on your machine, use cron for automation
- Lambda = Serverless, pay-per-execution, minimal setup, AWS handles everything
micro-investing/
├── build.sh # Main build script (START HERE!)
├── core/ # Shared code, strategies and API clients
│ ├── strategies/ # Investment strategies (add new ones here)
│ │ ├── base.py # Abstract base class
│ │ ├── scheduled.py # Example: scheduled investing
│ │ ├── round_up.py # Example: round-up investing
│ │ └── credit_card_rewards.py # Example: credit card rewards investing
│ └── clients/ # API clients
│ ├── alpaca.py # Alpaca trading (uses REST API directly)
│ └── thecardcaddie.py # The Card Caddie rewards calculator
│
├── deployments/
│ ├── local/ # Local deployment
│ │ ├── main.py # Entry point for local execution
│ │ ├── setup.py # Interactive setup wizard
│ │ ├── requirements.txt # Python dependencies
│ │ └── src/utils/ # Local-specific utilities
│ └── lambda/ # AWS Lambda deployment
│ ├── lambda_function.py # Lambda handler
│ ├── build.sh # Lambda build script
│ ├── requirements.txt # Lambda dependencies
│ └── utils/ # Lambda-specific utilities
│
├── assets/ # Images and static assets
│ └── images/ # Logo and graphics
├── README.md # Main documentation
├── CONTRIBUTING.md # Contributing guide
└── FAQ.md # Troubleshooting guide
Best for: Full control, cron jobs, local automation
- Runs on your computer or server
- Complete customization via config.yml
- Email notifications
- Multiple strategies simultaneously
- Transaction CSV processing
Quick start:
cd deployments/local/
python setup.py
python main.py simulateDocumentation: deployments/local/README.md
Best for: Serverless, pay-per-execution, zero maintenance
- Automated cloud investing
- Approximately $0.00/month (depending on usage)
- No server management
- EventBridge scheduling or API Gateway triggers
- S3 ledger storage (optional)
Quick start:
cd deployments/lambda/
./build.sh
# Upload lambda-deployment.zip to AWSDocumentation: deployments/lambda/README.md
Three built-in strategies (work in both deployments):
Invest a fixed amount at regular intervals (daily, weekly, biweekly, monthly).
Example:
strategies:
- name: "daily_investment"
type: scheduled
amount: 5.00
interval: daily
allocation:
VOO: 0.60
QQQ: 0.40Round transactions to nearest dollar and invest the difference.
Example: $4.32 coffee = $0.68 invested
Invest based on credit card rewards percentages using The Card Caddie API.
Example: 3% back on dining = invest 3% of dining purchases
Create your own strategy by extending the base class in core/strategies/:
# core/strategies/my_strategy.py
from .base import BaseStrategy
class MyStrategy(BaseStrategy):
def __init__(self):
super().__init__("my_strategy")
def supports_transactions(self):
# True if strategy processes transaction data, False if config-based
return False
def calculate_investable_amount(self, config):
# Your logic here
amount = 10.0
details = [{"info": "example"}]
return (amount, details)
def calculate_allocation(self, amount, config):
# Split investment across stocks
return {'VOO': amount * 0.6, 'QQQ': amount * 0.4}
def validate_config(self, config):
# Validate configuration
return TrueUse in local deployment:
# config.yml
strategies:
- name: "my_custom"
type: my_strategy
enabled: trueUse in Lambda deployment: Set as environment variable or pass via API Gateway.
- Python 3.8+
- Alpaca account (free paper trading or paid live trading)
- Optional: The Card Caddie API key (for credit card rewards strategy)
- Optional: Gmail account (for email notifications, local only)
- Local Deployment Guide: deployments/local/README.md
- Lambda Deployment Guide: deployments/lambda/README.md
- Strategy Source Code: core/strategies/
- API Clients Source Code: core/clients/
- FAQ & Troubleshooting: FAQ.md - Common issues and solutions
- Contributing Guide: CONTRIBUTING.md - How to contribute to this project
- Security Policy: SECURITY.md - Report vulnerabilities and security best practices
- The Card Caddie: thecardcaddie.com - Credit card rewards optimizer
- Alpaca Markets: alpaca.markets - Commission-free stock trading API
This project is licensed under the MIT License - see the LICENSE file for details
Ready to start? Choose your deployment and follow the setup guide!