Skip to content

Commit

Permalink
Discordbot Technical Analysis (OpenBB-finance#1089)
Browse files Browse the repository at this point in the history
* fix bug with window size on discordbot

* pylint and black fixes

* black linter
  • Loading branch information
DidierRLopes authored Dec 23, 2021
1 parent 2d14890 commit a0a22ee
Show file tree
Hide file tree
Showing 33 changed files with 143 additions and 158 deletions.
6 changes: 3 additions & 3 deletions discordbot/stocks/government/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from matplotlib import pyplot as plt
import pandas as pd

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def contracts_command(ctx, ticker="", past_transaction_days="", raw=""):
"""Displays contracts associated with tickers [quiverquant.com]"""
Expand Down
6 changes: 3 additions & 3 deletions discordbot/stocks/government/gtrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import matplotlib.dates as mdates
import pandas as pd

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def gtrades_command(
ctx, ticker="", gov_type="", past_transactions_months="", raw=""
Expand Down
6 changes: 3 additions & 3 deletions discordbot/stocks/government/histcont.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from matplotlib import pyplot as plt
import numpy as np

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def histcont_command(ctx, ticker=""):
"""Displays historical quarterly-contracts [quiverquant.com]"""
Expand Down
3 changes: 1 addition & 2 deletions discordbot/stocks/government/lastcontracts.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import discord
import pandas as pd

from gamestonk_terminal.stocks.government import quiverquant_model
import discordbot.config_discordbot as cfg
from discordbot.helpers import pagination

from gamestonk_terminal.stocks.government import quiverquant_model


async def lastcontracts_command(ctx, past_transactions_days="", num=""):
"""Displays last government contracts [quiverquant.com]"""
Expand Down
4 changes: 2 additions & 2 deletions discordbot/stocks/government/lasttrades.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import discord
import discordbot.config_discordbot as cfg
from discordbot.helpers import pagination

from gamestonk_terminal.stocks.government import quiverquant_model
import discordbot.config_discordbot as cfg
from discordbot.helpers import pagination


async def lasttrades_command(
Expand Down
4 changes: 2 additions & 2 deletions discordbot/stocks/government/lobbying.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import discord
import discordbot.config_discordbot as cfg
from discordbot.helpers import pagination

from gamestonk_terminal.stocks.government import quiverquant_model
import discordbot.config_discordbot as cfg
from discordbot.helpers import pagination


async def lobbying_command(ctx, ticker="", num=""):
Expand Down
6 changes: 3 additions & 3 deletions discordbot/stocks/government/qtrcontracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from matplotlib import pyplot as plt
import numpy as np

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def qtrcontracts_command(ctx, num="", analysis=""):
"""Displays a look at government contracts [quiverquant.com]"""
Expand Down
6 changes: 3 additions & 3 deletions discordbot/stocks/government/topbuys.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from matplotlib import pyplot as plt
import pandas as pd

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def topbuys_command(
ctx, gov_type="", past_transactions_months="", num="", raw=""
Expand Down
6 changes: 3 additions & 3 deletions discordbot/stocks/government/toplobbying.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from matplotlib import pyplot as plt
import pandas as pd

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def toplobbying_command(ctx, num="", raw=""):
"""Displays top lobbying firms [quiverquant.com]"""
Expand Down
6 changes: 3 additions & 3 deletions discordbot/stocks/government/topsells.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from matplotlib import pyplot as plt
import pandas as pd

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur

from gamestonk_terminal.config_plot import PLOT_DPI
from gamestonk_terminal.stocks.government import quiverquant_model
from gamestonk_terminal.helper_funcs import plot_autoscale

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur


async def topsells_command(
ctx, gov_type="", past_transactions_months="", num="", raw=""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import volume_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def ad_command(ctx, ticker="", is_open="False", start="", end=""):
"""Displays chart with accumulation/distribution line [Yahoo Finance]"""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/adosc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import volume_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def adosc_command(
ctx, ticker="", is_open="False", fast="3", slow="10", start="", end=""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/adx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import trend_indicators_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def adx_command(
ctx, ticker="", length="14", scalar="100", drift="1", start="", end=""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/aroon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import trend_indicators_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def aroon_command(ctx, ticker="", length="25", scalar="100", start="", end=""):
"""Displays chart with aroon indicator [Yahoo Finance]"""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/bbands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import volatility_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def bbands_command(
ctx, ticker="", length="5", n_std="2", mamode="sma", start="", end=""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/cci.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import momentum_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def cci_command(ctx, ticker="", length="14", scalar="0.015", start="", end=""):
"""Displays chart with commodity channel index [Yahoo Finance]"""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/cg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
from matplotlib import pyplot as plt
import numpy as np

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import momentum_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def cg_command(ctx, ticker="", length="14", start="", end=""):
"""Displays chart with centre of gravity [Yahoo Finance]"""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/donchian.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import volatility_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def donchian_command(
ctx, ticker="", upper_length="25", lower_length="100", start="", end=""
Expand Down
23 changes: 10 additions & 13 deletions discordbot/stocks/technical_analysis/ema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
from matplotlib import pyplot as plt
import pandas as pd

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import overlap_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def ema_command(ctx, ticker="", window="", offset="", start="", end=""):
"""Displays chart with exponential moving average [Yahoo Finance]"""
Expand Down Expand Up @@ -40,15 +40,12 @@ async def ema_command(ctx, ticker="", window="", offset="", start="", end=""):
if window == "":
window = [20, 50]
else:
window_temp = []
i = 0
b = 0
while i < len(window):
if window[i] == ",":
window_temp.append(float(window[b:i]))
l_legend.append(float(window[b:i]))
b = i
i += 1
window_temp = list()
for wind in window.split(","):
try:
window_temp.append(float(wind))
except Exception as e:
raise Exception("Window needs to be a float") from e
window = window_temp

if offset == "":
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/fib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import custom_indicators_model
from gamestonk_terminal import config_plot as cfp

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def fib_command(ctx, ticker="", start="", end=""):
"""Displays chart with fibonacci retracement [Yahoo Finance]"""
Expand Down
8 changes: 4 additions & 4 deletions discordbot/stocks/technical_analysis/fisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import discord
from matplotlib import pyplot as plt

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers

from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import momentum_model
from gamestonk_terminal.config_plot import PLOT_DPI

import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import gst_imgur
import discordbot.helpers


async def fisher_command(ctx, ticker="", length="14", start="", end=""):
"""Displays chart with fisher transformation [Yahoo Finance]"""
Expand Down
Loading

0 comments on commit a0a22ee

Please sign in to comment.