1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-18 06:11:49 -05:00

Merge pull request #72 from craigerl/remove_stock_plugin

Removed the stock plugin
This commit is contained in:
Walter A. Boring IV 2021-11-09 14:59:03 -05:00 committed by GitHub
commit 998bc32c27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 71 deletions

View File

@ -1,51 +0,0 @@
import logging
import re
import yfinance as yf
from aprsd import plugin, trace
LOG = logging.getLogger("APRSD")
class StockPlugin(plugin.APRSDRegexCommandPluginBase):
"""Stock market plugin for fetching stock quotes"""
version = "1.0"
command_regex = "^[sS]"
command_name = "stock"
@trace.trace
def process(self, packet):
LOG.info("StockPlugin")
# fromcall = packet.get("from")
message = packet.get("message_text", None)
# ack = packet.get("msgNo", "0")
a = re.search(r"^.*\s+(.*)", message)
if a is not None:
searchcall = a.group(1)
stock_symbol = searchcall.upper()
else:
reply = "No stock symbol"
return reply
LOG.info(f"Fetch stock quote for '{stock_symbol}'")
try:
stock = yf.Ticker(stock_symbol)
reply = "{} - ask: {} high: {} low: {}".format(
stock_symbol,
stock.info["ask"],
stock.info["dayHigh"],
stock.info["dayLow"],
)
except Exception as e:
LOG.error(
f"Failed to fetch stock '{stock_symbol}' from yahoo '{e}'",
)
reply = f"Failed to fetch stock '{stock_symbol}'"
return reply.rstrip()

View File

@ -17,7 +17,6 @@ pytz
requests
six
thesmuggler
yfinance
update_checker
flask-socketio
eventlet

View File

@ -63,20 +63,10 @@ jinja2==3.0.1
# via
# click-completion
# flask
lxml==4.6.3
# via yfinance
markupsafe==2.0.1
# via jinja2
multitasking==0.0.9
# via yfinance
numpy==1.21.2
# via
# pandas
# yfinance
opencage==2.0.0
# via -r requirements.in
pandas==1.3.2
# via yfinance
pbr==5.6.0
# via -r requirements.in
pluggy==1.0.0
@ -89,16 +79,12 @@ pyopenssl==20.0.1
# via opencage
pyserial==3.5
# via aioax25
python-dateutil==2.8.1
# via pandas
python-engineio==4.2.1
# via python-socketio
python-socketio==5.4.0
# via flask-socketio
pytz==2021.1
# via
# -r requirements.in
# pandas
# via -r requirements.in
pyyaml==5.4.1
# via -r requirements.in
requests==2.26.0
@ -106,7 +92,6 @@ requests==2.26.0
# -r requirements.in
# opencage
# update-checker
# yfinance
shellingham==1.4.0
# via click-completion
signalslot==0.1.2
@ -118,7 +103,6 @@ six==1.16.0
# eventlet
# imapclient
# pyopenssl
# python-dateutil
# signalslot
thesmuggler==1.0.1
# via -r requirements.in
@ -130,5 +114,3 @@ weakrefmethod==1.0.3
# via signalslot
werkzeug==2.0.0
# via flask
yfinance==0.1.63
# via -r requirements.in