Table of Contents
This project combines my personal interest in stocks and trading with my goal of enhancing my skills in Rust. Each step of the development process is documented and shared on YouTube in an easy-to-follow series.
You can follow along with the entire journey here: YouTube Playlist.
This section provides instructions for setting up the project locally. Follow the steps below to get a local copy up and running.
Ensure you have the following installed on your system:
-
Rust (latest stable version)
-
Cargo (comes with Rust)
-
Git (for cloning the repository)
-
You must have a Finnhub and Alpha Vantage API key, In the format belwow in a .env file in root.
FINHUB_API_KEY=key ALPHA_API_KEY=key
- Get a free Finnhub API Key at https://finnhub.io
- Get a free Alpha Vantage API Key at https://www.alphavantage.co
- Clone the repo
git clone https://github.com/jacobcorbett/trading-bot.git
- Run the project
cargo run
Below are examples of how to use the trading bot, along with screenshots showcasing key features.
Start by opening a new trade using the bot's intuitive command-line interface.

Easily manage your trading balance by adding funds as needed.

Switch to algorithm mode to let the bot trade automatically based on pre-defined strategies.

View the status of all your trades in real time to stay on top of your portfolio.

Save your current trading state to resume later, or load a previously saved state.
Get a clear overview of the main program and its functionality.

These features make the bot flexible and user-friendly, whether you're trading manually or automating your strategies.
- Set up the ability to read in historical stock data.
- Learned how to calculate the moving average.
- Analyzed stock history data to implement the moving average algorithm.
- Saved all stock moving averages into a vector for easier data management.
- Set up the algorithm to run daily, checking for updates automatically.
- Optimize data fetching to only retrieve new stock data when needed.
- Calculate moving averages "back in time" to avoid starting fresh with new data.
- Finish implementing the logic to detect when the moving average crosses the 50-day average and trigger trades accordingly.
- Add support for cryptocurrency data.
- Update the algorithm to:
- Allow auto-save functionality in algorithm mode.
- Stop operations when the market closes.
- Enhance the interface with improved graphics and a user-friendly design.
- Update the save file to include historical moving averages or create a dedicated save file for this data.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the project_license. See LICENSE.txt for more information.
Your Name - dev@jacobcorbett.com
Project Link: https://github.com/jacobcorbett/trading-bot

