Skip to content

henrynsmbl/micro-investing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Card Caddie Logo

Micro-Investing Engine

License: MIT Python 3.8+ Contributions Welcome Powered by Alpaca Powered by The Card Caddie

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.


Getting Started

Simple Setup (Recommended):

./build.sh

This interactive script guides you through setup for either local or Lambda deployment.


Or choose your deployment method manually:

  1. For local deployment (run on your computer):

    cd deployments/local/
    python setup.py
  2. 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

Project Structure

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

Deployment Options

Local Deployment

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 simulate

Documentation: deployments/local/README.md


AWS Lambda Deployment

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 AWS

Documentation: deployments/lambda/README.md


Investment Strategies

Three built-in strategies (work in both deployments):

1. Scheduled Investment

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.40

2. Round Up

Round transactions to nearest dollar and invest the difference.

Example: $4.32 coffee = $0.68 invested

3. Credit Card Rewards

Invest based on credit card rewards percentages using The Card Caddie API.

Example: 3% back on dining = invest 3% of dining purchases


Creating Custom Strategies

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 True

Use in local deployment:

# config.yml
strategies:
  - name: "my_custom"
    type: my_strategy
    enabled: true

Use in Lambda deployment: Set as environment variable or pass via API Gateway.


Requirements

  • 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)

Documentation

Deployment Guides

Source Code

Community & Support

  • 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

Related Links


License

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!

About

Public repo to invest credit card rewards into the stock market.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published