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:
commit
998bc32c27
@ -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()
|
|
@ -17,7 +17,6 @@ pytz
|
|||||||
requests
|
requests
|
||||||
six
|
six
|
||||||
thesmuggler
|
thesmuggler
|
||||||
yfinance
|
|
||||||
update_checker
|
update_checker
|
||||||
flask-socketio
|
flask-socketio
|
||||||
eventlet
|
eventlet
|
||||||
|
@ -63,20 +63,10 @@ jinja2==3.0.1
|
|||||||
# via
|
# via
|
||||||
# click-completion
|
# click-completion
|
||||||
# flask
|
# flask
|
||||||
lxml==4.6.3
|
|
||||||
# via yfinance
|
|
||||||
markupsafe==2.0.1
|
markupsafe==2.0.1
|
||||||
# via jinja2
|
# via jinja2
|
||||||
multitasking==0.0.9
|
|
||||||
# via yfinance
|
|
||||||
numpy==1.21.2
|
|
||||||
# via
|
|
||||||
# pandas
|
|
||||||
# yfinance
|
|
||||||
opencage==2.0.0
|
opencage==2.0.0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
pandas==1.3.2
|
|
||||||
# via yfinance
|
|
||||||
pbr==5.6.0
|
pbr==5.6.0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
pluggy==1.0.0
|
pluggy==1.0.0
|
||||||
@ -89,16 +79,12 @@ pyopenssl==20.0.1
|
|||||||
# via opencage
|
# via opencage
|
||||||
pyserial==3.5
|
pyserial==3.5
|
||||||
# via aioax25
|
# via aioax25
|
||||||
python-dateutil==2.8.1
|
|
||||||
# via pandas
|
|
||||||
python-engineio==4.2.1
|
python-engineio==4.2.1
|
||||||
# via python-socketio
|
# via python-socketio
|
||||||
python-socketio==5.4.0
|
python-socketio==5.4.0
|
||||||
# via flask-socketio
|
# via flask-socketio
|
||||||
pytz==2021.1
|
pytz==2021.1
|
||||||
# via
|
# via -r requirements.in
|
||||||
# -r requirements.in
|
|
||||||
# pandas
|
|
||||||
pyyaml==5.4.1
|
pyyaml==5.4.1
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
requests==2.26.0
|
requests==2.26.0
|
||||||
@ -106,7 +92,6 @@ requests==2.26.0
|
|||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# opencage
|
# opencage
|
||||||
# update-checker
|
# update-checker
|
||||||
# yfinance
|
|
||||||
shellingham==1.4.0
|
shellingham==1.4.0
|
||||||
# via click-completion
|
# via click-completion
|
||||||
signalslot==0.1.2
|
signalslot==0.1.2
|
||||||
@ -118,7 +103,6 @@ six==1.16.0
|
|||||||
# eventlet
|
# eventlet
|
||||||
# imapclient
|
# imapclient
|
||||||
# pyopenssl
|
# pyopenssl
|
||||||
# python-dateutil
|
|
||||||
# signalslot
|
# signalslot
|
||||||
thesmuggler==1.0.1
|
thesmuggler==1.0.1
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
@ -130,5 +114,3 @@ weakrefmethod==1.0.3
|
|||||||
# via signalslot
|
# via signalslot
|
||||||
werkzeug==2.0.0
|
werkzeug==2.0.0
|
||||||
# via flask
|
# via flask
|
||||||
yfinance==0.1.63
|
|
||||||
# via -r requirements.in
|
|
||||||
|
Loading…
Reference in New Issue
Block a user