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]
7e13110f89
|
6 months ago | |
---|---|---|
.. | ||
.dockerignore | 1 year ago | |
.gitignore | 1 year ago | |
.gitignore.old | 1 year ago | |
Dockerfile | 1 year ago | |
Makefile | 1 year ago | |
README.md | 1 year ago | |
app.py | 1 year ago | |
requirements.txt | 6 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}
$