mirror of https://github.com/01-edu/public.git
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.
dependabot[bot]
6d77b685a0
|
10 months ago | |
---|---|---|
.. | ||
.dockerignore | ||
.gitignore | 1 year ago | |
.gitignore.old | ||
Dockerfile | ||
Makefile | 1 year ago | |
README.md | 1 year ago | |
app.py | 1 year ago | |
requirements.txt | 10 months ago | |
sample-stocks.zip | 1 year ago | |
utils.py | 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:5001/stocks_list | jq | head
[
"BRID",
"WRB",
"GCO",
"ITW",
"USAU",
"AXR",
"UMBF",
"MTRN",
"UNT",
$ curl localhost:5001/exchange_rate/WRB
{"rate":0.12680993974208832,"symbol":"USD","timestamp":1691667858.912409}
$ curl localhost:5001/exchange_rate/BRID
{"rate":0.38091352581977844,"symbol":"USD","timestamp":1691667862.3328483}
$