You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nprimo ec773eed1d feat(sample-stocks.zip): reduce size of available data 1 year ago
..
.dockerignore feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
.gitignore feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
.gitignore.old feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
Dockerfile feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
Makefile feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
README.md feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
app.py feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
requirements.txt feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago
sample-stocks.zip feat(sample-stocks.zip): reduce size of available data 1 year ago
utils.py feat(mock-stock-data-server): add mock-stock-data-server to resources 1 year ago

README.md

Mock stock data server

A simple API to provide fake real time exchange data. The used database is a sample of this Kaggle database.

How to run it locally

It is recommended to use the following command to run the server locally:

$ make run

And to stop the server:

$ make stop

Endpoints available

You can fetch the server with HTTP GET requests at the following endpoints:

  • /stocks_list: display a list of available stock symbol.
  • /exchange_rate/<symbol>: retrieve current data for the specified symbol.

Below an example on how to use it (remember that the server needs to be running locally).

$ curl -s localhost:5000/stocks_list | jq | head
[
  "BRID",
  "WRB",
  "GCO",
  "ITW",
  "USAU",
  "AXR",
  "UMBF",
  "MTRN",
  "UNT",
$ curl localhost:5000/exchange_rate/WRB
{"rate":0.12680993974208832,"symbol":"USD","timestamp":1691667858.912409}
$ curl localhost:5000/exchange_rate/BRID
{"rate":0.38091352581977844,"symbol":"USD","timestamp":1691667862.3328483}
$