Skip to content

A bitcoin price predictor built with python, fastapi and faunadb using Time-series for machine learning modelling

Notifications You must be signed in to change notification settings

E-wave112/bitfast_2.0

Repository files navigation

example workflow codecov

A bitcoin USD exchange rate predictor built with FastAPI and FaunaDB

Metrics

  • NB: these metrics improve over time as the model keeps learning from new data and hyperparameters are tweaked
MAPE=0.1580988278794064
MAE=4238.996757222961
RMSE=4585.15513690739

Getting Started

To get started with the project, ensure you have setup and activated a virtual environment, guides on that here

clone the repository via the command

git clone https://github.com/E-wave112/bitfast_2.0

install dependencies

python3 -m pip install -r requirements.txt

Running the development Server

start the server by running the bash script below:

bash start.sh

Alternatively, you can start the server using the command below:

uvicorn application:app --reload

the server will be running on http://localhost:8000/docs

Containerizing the API

Build the initial docker image

docker-compose up --build

Running the Dev Docker container

To run the application, use the following command:

docker-compose up
  • The app will be running on http://127.0.0.1:8000

  • Access the docker image for this project on the cloud here

  • It is not recommended to use alpine based images for this project(or most of any other python projects) and here's why

  • A useful resource on how to push your docker image to DockerHub can be found here

Running the Kubernetes cluster locally

  • Ensure you have minikube installed on your machine

  • Start the minikube cluster by running the command below:

minikube start
  • To check the status of the cluster, run the command below:
minikube status
  • Create a service discovery pattern for the application by running the command below:
kubectl apply -f k8s/services/service.yaml
  • To deploy the application to the cluster, run the command below:
kubectl apply -f k8s/deployments/deployment.yaml
  • To check the status of the pods, run the command below:
kubectl get pods
  • To check the status of the services, run the command below:
kubectl get services
  • To access the application, tunnel the service via the command below (we need to do this because our k8s service is of type LoadBalancer):
minikube tunnel
  • Check the external IP (because you are running the cluster locally, your external IP address will be 127.0.0.1). More guides on that here
kubectl get services bitfast-service
  • Open the url below in your browser (ensure the external IP is not pending )
http://<external-ip>:9500
  • To delete the application, run the command below:
kubectl delete -f k8s/deployments/deployment.yaml
  • To stop the minikube cluster, run the command below:
minikube stop
  • To deploy your cluster to the cloud, check out the guides from the official kubernetes docs

Wanna check out my other machine learning projects and implementations? see them all here.

About

A bitcoin price predictor built with python, fastapi and faunadb using Time-series for machine learning modelling

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published