mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* First commit * Renamed to bot * change from discordbot to bots imports * refractor cmds + autocomplete helpers + updated dps plots/candle + quote cmd * isort fix * Update helpers.py * Added first refactor * Added commands and refactor * Added description handler * Through grains * ta + image border helper * Added indices * merged * Finished econ * options refactor * dark_pool_shorts, candle, quote done * pagination/dropdown logic to helpers + fixes * dd/disc/insider done + add image logic to helpers * linting * removed plt style * Almost done with Gov * fixing conflicts * Finished gov (excpect ones mentioned) * screener done * Test bug refactor * Store changes to switch * Finished refactor * Fixed error * Delete ::40 * Fixed issue * Fixed black * finished * fixes Co-authored-by: teh_coderer <me@tehcoderer.com> Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
34 lines
879 B
Python
34 lines
879 B
Python
import io
|
|
|
|
from PIL import Image
|
|
import bots.config_discordbot as cfg
|
|
from bots.config_discordbot import logger
|
|
from bots.helpers import image_border
|
|
from gamestonk_terminal.stocks.technical_analysis import finviz_model
|
|
|
|
|
|
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(imagefile, "PNG", quality=100)
|
|
imagefile = image_border(imagefile)
|
|
|
|
return {
|
|
"title": f"Stocks: [Finviz] Trendlines & Data {ticker}",
|
|
"imagefile": imagefile,
|
|
}
|