This project consists of three modules that work together to manage and execute trading strategies using market data from Yahoo Finance, process the data, and place orders through the Alpaca broker interface with a CLI control over portfolio selection and MongoDB database management.
Description:
- This engine handles fetching market data from Yahoo Finance and storing it in a MongoDB database. Features:
- CLI interface for portfolio management (manual or csv input)
- Automatically Fetches market data using Yahoo Finance API with market calender scheduler function.
- Stores fetched data in MongoDB and updates the database with incremental changes to minimize load on yFinance API. Usage:
- To start the Yahoo Finance MongoDB Interface, run the
YFinanceMongoDB.py
script. Make sure your MongoDB connection parameters are set in the environment variables and run in PyCharm with emulated terminal environment for best experince.
Description:
- This engine processes market data to generate trading signals using Bolingerbands and Moving averages with error checking functionality
Features:
- Uses stored market data from the MongoDB database.
- Applies proprietary trading strategy algorithms.
- Stores trading signals in the MongoDB Database
- Scheduler function integrated to work with Yahoo Finance MongoDB Interface Usage:
- To start the Data Processor, run the
DataProcessor.py
script. The script will fetch data from the MongoDB database, process it, and send signals based on the defined strategy. Make sure your MongoDB connection parameters are set in the environment variables and run in PyCharm with emulated terminal environment for best experince.
Description:
- This engine manages and executes trading orders using Alpaca's trading API with basic risk management.
Features:
- Connects to Alpaca broker interface.
- Places buy and sell orders based on signals received.
- Manages capital allocation and order verification.
- Integrated dynamic risk management on existing positions Usage:
- To start the Alpaca Order Management System, run the
AlpacaOMS.py
script. Ensure that your Alpaca API keys are configured properly in the environment variables. Run in PyCharm with emulated terminal environment for best experince.
- Python 3.x
- MongoDB atlas cluster instance ( Free 500mb Cluster available)
- Alpaca account and API keys (Free for API paper Trades)
- Required Python packages (see
requirements.txt
)
-
Clone the repository: git clone https://github.com/nashraj/ThreeEngines.git cd ThreeEngines
-
Install dependencies: pip install -r requirements.txt
-
Set up environment variables: Create a .env file as "mongodbconfig.env" in the root directory with the following variables: MONGODB_USERNAME=Your_MongoDB_Username MONGODB_PASSWORD=Your_MongoDB_Password MONGODB_CLUSTER=Your_MongoDB_Cluster
Create another .env file as "alpacaconfig.env" in the root directory with the following header and variables: [LOGIN]
API_KEY=your_alpaca_api_key SECRET_KEY=your_alpaca_secret_key
-
Yahoo Finance MongoDB Interface: python YFinance MongoDB 204 MVP.py
-
Data Processor: python data processor 204 MVP.py
-
Alpaca Order Management System: Alpaca OMS MK5 059 MVP.py (trading_stream_script.py will automatically initialize in a new window, only for windows systems currently)
- ThreeEngines/
- ├── AlpacaOMS.py
- ├── DataProcessor.py
- ├── YFinanceMongoDB.py
- ├── .env
- ├── LICENSE
- ├── README.md
- ├── requirements.txt
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
Contributions are welcomed! Please read the CONTRIBUTING.md for details on the code of conduct and the process for submitting pull requests.
-
Yahoo Finance for market data
-
Alpaca for the trading API
-
MongoDB for database management
-
Contact For any inquiries or issues, please contact nash@techsixglobal.com.