Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
tq
Dockerfile
README.md
requirements.txt
zappa_settings.json

README.md

Intro

You can find a deployed copy of the oracle contract that receives AAPL stock prices every ~30 seconds here

Setup

To update requirements.txt:

pip3 freeze >| requirements.txt 

To run the Flask app:

FLASK_APP="tq/oracles/ticker.py" TEZOS_USER_KEY="$(base64 ~/Downloads/tz1R3vJ5TV8Y5pVj8dicBR23Zv8JArusDkYr.json | tr -d '\n')" ORACLE_ADDRESS="KT1EGbAxguaWQFkV3Egb2Z1r933MWuEYyrJS" ALPHA_VANTAGE_API_KEY=".." ALPHA_VANTAGE_TICKER_SYMBOL="AAPL" flask run

To build the Docker image:

docker build -t oracle-stock-ticker:latest .

To run:

docker run -d -p 5000:5000 --env TEZOS_USER_KEY="$(base64 ~/Downloads/tz1R3vJ5TV8Y5pVj8dicBR23Zv8JArusDkYr.json | tr -d '\n')" --env ORACLE_ADDRESS="KT1EGbAxguaWQFkV3Egb2Z1r933MWuEYyrJS" --env ALPHA_VANTAGE_API_KEY=".." --env ALPHA_VANTAGE_TICKER_SYMBOL="AAPL" oracle-stock-ticker

Build and run:

❯❯❯ docker build -t oracle-stock-ticker:latest . && docker run --rm -it -p 5000:5000 --env TEZOS_USER_KEY="$(base64 ~/Downloads/tz1R3vJ5TV8Y5pVj8dicBR23Zv8JArusDkYr.json | tr -d '\n')" --env ORACLE_ADDRESS="KT1EGbAxguaWQFkV3Egb2Z1r933MWuEYyrJS" --env ALPHA_VANTAGE_API_KEY=".." --env ALPHA_VANTAGE_TICKER_SYMBOL="AAPL" --env FLASK_APP="tq/oracles/ticker.py" oracle-stock-ticker

All environment variables:

  • To generate the TEZOS_USER_KEY parameter, run: echo "$(base64 MY_KEY_FILE.json | tr -d '\n')", where MY_KEY_FILE.json is your Tezos faucet file (see here to get a testnet faucet file).
  • Alpha Vantage provides free API keys for stock ticker prices: https://www.alphavantage.co
TEZOS_USER_KEY=".."
ORACLE_ADDRESS="KT1EGbAxguaWQFkV3Egb2Z1r933MWuEYyrJS"
ALPHA_VANTAGE_API_KEY=".."
ALPHA_VANTAGE_TICKER_SYMBOL="AAPL"
FLASK_APP="tq/oracles/ticker.py"
You can’t perform that action at this time.