Files
OpenBB/bots/stocks/technical_analysis/view.py
teh_coderer 50cafd500e Discord bot massive improvement (#1481)
* allow logs feature flag

* Adding log collection md

* upload last log at startup

* additions/refractor

* refactor

* lint/black ++

* disc

* TimeRotating Logger and upload to s3

* corrected regex error

* makeup for config

* logging/disc/sia/etf/++

* append .log before uploading

* process to upload logs to s3

* candle ta/etfmcds

* fix

* ta candles

* implement presignedURL

* fixed regex

* ma's in 1 cmd, delete older files

* refactor ta candle

* updates

* black

* moon?

* Logger uploader

* rotate every hour

* only archive if successful

* chavis suggestions

* windows

* ta

* commands_dict update

* discord tacmds

* log_collection error fix

* fix

* fix

* pylint

* bb fix

* only log filesize

* fixes

* discord logs

* Delete log_collection.md

* fixes for other bots on images

* bots image upload fix

* updated helpers/load candle

* more ta cc/housekeeping/refactors/slashcmds

* update bots cmds_dict

* adjustments to font size/fixes

* test fixs/disc earnings

* missed a spot

* fixes had > revesred

* reversed the >< again oops

* remove logger branch code blocking tests

* black fix

* fix missing sources in docstr/daily candle dt tz

* load_candle refactor with docstring

* moved insiders to disc

* Lucas logging changes

* Fixing log_collection.md

* testing scenario

* more ta converted

* more ta

* Update config_terminal : remove print of verbosity

* table cfg/fix matplt/ screener +

* fix

* what's sleep? 1 more line.. or 2. scr df2img

* juan more. fix news 1m chart issue

* ticker.upper() fixes

* Update log collection

* Updating log collection - change tmp folder

Co-authored-by: LBolte29 <lbolte@gmx.net>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
Co-authored-by: LBolte29 <97528701+LBolte29@users.noreply.github.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
2022-03-16 10:21:27 +00:00

40 lines
1.0 KiB
Python

import io
import logging
from PIL import Image
import bots.config_discordbot as cfg
from bots.helpers import image_border
from gamestonk_terminal.decorators import log_start_end
from gamestonk_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)
return {
"title": f"Stocks: [Finviz] Trendlines & Data {ticker.upper()}",
"imagefile": imagefile,
}