Set Up
- Clone repo
- Create a virtual environment
python3 -m venv venv
- Activate venv
source venv/bin/activate
- Install libraries
pip install -r requirements.txt
- Create FLASK_APP env variable `export FLASK_APP=application.wsgi:app
- Export
USERNAME
,URL
, andPASSWORD
with Upside specific data. - Have MongoDB installed (ArcticDB uses MongoDB)
- Run the application:
flask run
- Visit
http://127.0.0.1:5000/api/v1/prices/PEACHS
(or any other song ID in the URL) for a JSON response with latest bid/ask.
How It Works
This is a very light API that is just utilizing one endpoint to retrieve some data so I utilized the Flask framework as it's a lightweight framework for quick application development. Not much else was needed to do this so I went with something that would allow for quick development that has a proven track record. Because of nature of the data we are using, I thought Python would be the ideal language as it has a lot of libraries for dealing with series of data. It's quite used in the financial world because of pandas and numpy and Upside songs are securities. ArcticDB is has very fast read/write and for the type of operations and how fast we'd be dealing with it, I thought it was better than a SQL approach. Here, we are just adding the latest entry really quickly to the DB and fetching the data. With how many write operations we could potentially be doing, we might not want to write to the DB for every entry but for the purposes of a demonstration this should suffice.