mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* quick econ fix * black * keys and feature flags * terminal name 👀 * some more replacements * some more replacements * edit pyproject * gst -> openbb * add example portfolios back to git * Update api from gst * sorry. skipping some tests * another round of names * another round of test edits * Missed some .gst refs and update timezone * water mark stuff * Fixing Names in terminal.spec and name of GTFF_DEFAULTS to OBBFF_DEFAULTS * fix more GST to OpenBB Terminal * Logging : merge conflicts with main * Revert wrong files Co-authored-by: Andrew <andrew.kenreich@gmail.com> Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt> Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
41 lines
1.0 KiB
Python
Executable File
41 lines
1.0 KiB
Python
Executable File
import io
|
|
import logging
|
|
|
|
from PIL import Image
|
|
|
|
from bots import config_discordbot as cfg
|
|
from bots.helpers import image_border
|
|
from openbb_terminal.decorators import log_start_end
|
|
from openbb_terminal.stocks.technical_analysis import finviz_model
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@log_start_end(log=logger)
|
|
def view_command(ticker=""):
|
|
"""Displays image from Finviz [Finviz]"""
|
|
|
|
# Debug
|
|
if cfg.DEBUG:
|
|
logger.debug("ta view %s", ticker)
|
|
|
|
# Check for argument
|
|
if ticker == "":
|
|
raise Exception("Stock ticker is required")
|
|
|
|
image_data = finviz_model.get_finviz_image(ticker)
|
|
dataBytesIO = io.BytesIO(image_data)
|
|
im = Image.open(dataBytesIO)
|
|
im = im.resize((800, 340), Image.ANTIALIAS)
|
|
imagefile = "ta_view.png"
|
|
|
|
im.save(dataBytesIO, "PNG", quality=100)
|
|
dataBytesIO.seek(0)
|
|
imagefile = image_border(imagefile, base64=dataBytesIO)
|
|
im.close()
|
|
|
|
return {
|
|
"title": f"Stocks: [Finviz] Trendlines & Data {ticker.upper()}",
|
|
"imagefile": imagefile,
|
|
}
|