Closed donaldknoller closed 2 months ago
@donaldknoller For the Dockerfile code, We use CMD python predictionGenerate.py to run the script when the container launches, but it has the following warning after building the Docker image:
JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 15)
Should we change this?
@donaldknoller The current flow & logic works like this:
runDockerImage.py
with a timestamp for the current time and the ability to pass through a stock ticker, with the default value of SPY & a random number for the prediction (predictionGenerate.py
which runs in the Docker container on start)output.json
in the /tmp
directory in the Docker container, the contents are copied to a file in the working directory called output.txt
, and the container is stopped. fetchStockPrice.py
, which pulls the price for the stock ticker.results.txt
in the working directory which has the following data:Note, the yfinance
library only provides stock ticker prices for last day's close and cannot do shorter time intervals. There are 2 versions of fetchStockPrice.py
:
fetchStockPrice_yfinance.py
which uses yfinance
fetchStockPrice.py
which uses Alpha Vantage & a free API key, which gets 'live' price data in 1 minute intervals. This is limited to 5 API calls per minute and 500 calls per day
In the docker image, update the python script dictGenerate.py to read command line arguments. The first command line argument will be a timestamp in
ISO 8601
The second command line argument will be parsed as a string For the file written to /tmp/output.json, the value should be a random number instead of 0.78 (as mentioned in first issue)Given the python script run_docker_image.py update the following: a. The first argument to the docker image will be a timestamp in
ISO 8601
format five minutes from the current time b. The second argument will be a stock ticker (use SPY for now) c. After the docker container completes, compare the output of /tmp/output.json with the value of SPY after five minutes and calculate the accuracy. (you can use yahoo finance library to fetch the price data) d. If the SPY data is not active (aka when the market is closed, use a dummy value for the live SPY price data) e. Store the accuracy score in a new file called results.txt