Callery Pears is a web platform hosted at thecallerypear.com, and with the long-term goal of providing an easy way to simulate pair trading strategies.
Please note that this project is still very early on in its development and has a lot of quirks that will be fixed in future commits.
Just to name a few:
- Docker volumes instead of copying over the sqlite3 database
- Orchestration Service like Kubernetes or Docker Swarm
- Taking into consideration missing data points when performing tests
The Callery Pear backend consists of a dockerized microservice backend for portability and easy deployment. The microservices are connected via gRPC and connect to the frontend through a RESTful API.
flowchart LR
stockAggregatesStore["Stock Aggregates Store"]
stockAlgorithms["Stock Algorithms"]
loadBalancer["Load Balancer"]
frontend["Frontend"]
stockAggregatesStore --> loadBalancer
stockAlgorithms --> loadBalancer
loadBalancer --> frontend
git clone https://github.com/J3r0m3L/Callery.git
cd Callery Ensure you have Python 3 and Pip installed.
cd python
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtIn the populateDatabase folder there is a StoreStockData.py file. This file retrieves stocks information from polygon.io and stores it in a local sqlite3 database. Create a polygon.io account and store the API key in a .env file as such.
POLYGON_IO_API_KEY=<API KEY>
Modify the stocks and timestamps to personal needs.
python3 StoreStockData.py
mv StockData.db ../../c++/stockAggregatesStoreEnsure you have Docker installed. In the base directory, start the Stock Aggregates Store service.
./run-callery.sh sas-onlyIn a new terminal tab, start the Stock Algorithms service.
./run-callery.sh sa-onlyIn a new terminal tab, start the Load Balancer service.
./run-callery.sh lb-onlyIn a new terminal tab, start the Frontend service.
cd javascript
npm ci
npm startCongratulations! You should have an instance of Callery Pears running on your local machine.
This project is still very early on in its development. Here are some quirks that you may have encountered and some quick solutions.
The microservices can't find each other. This could result in a 404 error on the Load Balancer log. This is because the docker containers are connected via a docker network and the network values are hard-coded. The first solution is to remove all Callery Pear project containers and restart them with run-callery.sh in this order: Stock Aggregates Store, Stock Algorithms, Load Balancer. The second solution you can inspect the Callery-Pear network and modify the hard-coded addresses in Load Balancer.