A comprehensive web-based stock analysis and trading platform built with Streamlit. This application provides advanced financial tracking, paper trading capabilities, and interactive learning tools.
- Stock Analysis: Technical indicators, price charts, and financial metrics using Yahoo Finance data
- Algorithmic Trading: Build custom trading strategies with multiple technical indicators
- Day Trading: Specialized tools for day traders including session-based trading, scalping, and volatility breakout strategies
- Risk Management: Position sizing, daily loss limits, and performance tracking
-
Clone this repository:
git clone <repository-url> cd <repository-directory>
-
Create a
.env
file from the template:cp .env.example .env
-
(Optional) Edit the
.env
file to adjust database settings or Tiger Brokers credentials:nano .env
-
Run the initialization script to create a template Tiger Brokers key file (if needed):
./docker-init-keys.sh
-
Start the application with Docker Compose:
docker-compose up -d
-
Access the web interface at http://localhost:5000
-
To stop the application:
docker-compose down
-
To view logs:
docker-compose logs -f
The application can run in mock mode without real trading capabilities. To connect to a real Tiger Brokers account:
-
Edit your
.env
file and update the Tiger Brokers credentials:# Tiger Brokers API Configuration USE_MOCK_TIGER=false TIGER_ID=your_tiger_id_here TIGER_PRIVATE_KEY_PASSWORD=your_password_here
-
Make sure your
tiger_private_key.pem
file is present in the project root directory with the correct private key content:# Replace the template key with your actual Tiger Brokers private key nano tiger_private_key.pem
-
Restart the application:
docker-compose down docker-compose up -d
The PostgreSQL database is configured to store data persistently in a Docker volume. This means your trading history, strategies, and configuration will be preserved between restarts.
-
Database Connection Issues: If the application fails to connect to the database, check your PostgreSQL credentials in the
.env
file and make sure the database service is running.docker-compose ps db # Check if the database container is running docker-compose logs db # View database logs
-
Tiger Brokers API Connection: If you're having trouble connecting to the Tiger Brokers API:
- Verify your credentials in the
.env
file - Check that your private key file is correctly formatted and accessible
- Look at the application logs for specific error messages:
docker-compose logs app | grep "Tiger"
- Verify your credentials in the
-
Container Not Starting: If a container fails to start:
docker-compose ps # Check container status docker-compose logs # View all logs
If you want to develop or extend the application without Docker:
-
Install Python 3.11+ and PostgreSQL
-
Install dependencies:
pip install -e .
-
Set up environment variables:
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/stocktrading export USE_MOCK_TIGER=true # For development without a real Tiger account
-
Run the application:
streamlit run app.py
The default Docker Compose setup is designed for local development. It provides:
- A single-node PostgreSQL database
- Hot-reloading of the application (changes reflect immediately)
- Debug-level logging
- Mock Tiger Brokers client for development without real API credentials
For production deployment, consider:
- Adding TLS/SSL with a reverse proxy like Nginx or Traefik
- Setting up database backups
- Configuring more restrictive security settings
- Using real Tiger Brokers API credentials with proper security measures
- Implementing proper logging and monitoring solutions
This project is licensed under the MIT License - see the LICENSE file for details.