diff --git a/.gitignore b/.gitignore index 1ce8652..b14d54c 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ nosetests.xml .project .pydevproject .ropeproject + +# IDE +.idea \ No newline at end of file diff --git a/how_rich.py b/how_rich.py new file mode 100644 index 0000000..092e676 --- /dev/null +++ b/how_rich.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import time, requests, alpha_vantage, json, urllib +import ZeroSeg.led as led +from datetime import datetime + +# cleanup before run +device = led.sevensegment(cascaded=2) +device.clear() + +# set brightness to minimal +level = 1 +device.brightness(level) + +# check Zendesk stock price +def stock(): + API_URL = "https://www.alphavantage.co/query" + symbols = ['ZEN'] + for symbol in symbols: + data = { "function": "GLOBAL_QUOTE", + "symbol": symbol, + "datatype": "json", + "apikey": "YOUR_API_KEY" } + response = requests.get(API_URL, data) + data = response.json() + output = data["Global Quote"]["05. price"] + how_rich = float(output) * NUMBER_OF_STOCKS_HERE + device.write_text(1, str(how_rich)) + +stock() \ No newline at end of file diff --git a/info.txt b/info.txt new file mode 100644 index 0000000..68eb475 --- /dev/null +++ b/info.txt @@ -0,0 +1 @@ +Try to create a new branch again diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..acd5374 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests +alpha_vantage \ No newline at end of file diff --git a/stock.py b/stock.py new file mode 100644 index 0000000..d13ef48 --- /dev/null +++ b/stock.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import time, requests, alpha_vantage, json, urllib +import ZeroSeg.led as led +from datetime import datetime + +# cleanup before run +device = led.sevensegment(cascaded=2) +device.clear() + +# set brightness to minimal +level = 1 +device.brightness(level) + +# check Zendesk stock price +def stock(): + API_URL = "https://www.alphavantage.co/query" + symbols = ['ZEN'] + for symbol in symbols: + data = { "function": "GLOBAL_QUOTE", + "symbol": symbol, + "datatype": "json", + "apikey": "YOUR_API_KEY" } + response = requests.get(API_URL, data) + data = response.json() + output = data["Global Quote"]["05. price"] + output_filtered = output[:6] + device.write_text(1, " " + output_filtered) + +stock() \ No newline at end of file