Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds QA and Pred to forex #1652

Merged
merged 7 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions openbb_terminal/cryptocurrency/crypto_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def print_help(self):
> nft non-fungible tokens, e.g.: today drops{has_ticker_start}
> dd due-diligence for loaded coin, e.g.: coin information, social media, market stats
> ta technical analysis for loaded coin, e.g.: ema, macd, rsi, adx, bbands, obv
> pred prediction techniques e.g.: regression, arima, rnn, lstm, conv1d, monte carlo
> qa quantitative analysis, \t e.g.: decompose, cusum, residuals analysis[/menu]
> pred prediction techniques, e.g.: regression, arima, rnn, lstm, conv1d, monte carlo
> qa quantitative analysis e.g.: decompose, cusum, residuals analysis[/menu]
{has_ticker_end}
"""
console.print(text=help_text, menu="Cryptocurrency")
Expand Down Expand Up @@ -451,9 +451,7 @@ def call_ov(self, _):
@log_start_end(log=logger)
def call_defi(self, _):
"""Process defi command"""
from openbb_terminal.cryptocurrency.defi.defi_controller import (
DefiController,
)
from openbb_terminal.cryptocurrency.defi.defi_controller import DefiController

self.queue = self.load_class(DefiController, self.queue)

Expand Down
62 changes: 61 additions & 1 deletion openbb_terminal/forex/forex_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ForexController(BaseController):
"""Forex Controller class."""

CHOICES_COMMANDS = ["to", "from", "load", "quote", "candle", "resources"]
CHOICES_MENUS = ["ta", "oanda"]
CHOICES_MENUS = ["ta", "qa", "oanda", "pred"]
PATH = "/forex/"
FILE_PATH = os.path.join(os.path.dirname(__file__), "README.md")

Expand Down Expand Up @@ -66,6 +66,8 @@ def print_help(self):
candle show candle plot for loaded data[/cmds]
[menu]
> ta technical analysis for loaded coin, e.g.: ema, macd, rsi, adx, bbands, obv
> qa quantitative analysis, e.g.: decompose, cusum, residuals analysis
> pred prediction techniques e.g.: regression, arima, rnn, lstm, conv1d, monte carlo
[/menu]{has_symbols_end}
[info]Forex brokerages:[/info][menu]
> oanda Oanda menu[/menu][/cmds]
Expand Down Expand Up @@ -318,6 +320,64 @@ def call_ta(self, _):
else:
console.print("No currency pair data is loaded. Use 'load' to load data.\n")

@log_start_end(log=logger)
def call_pred(self, _):
"""Process pred command"""
if obbff.ENABLE_PREDICT:
if self.from_symbol and self.to_symbol:
if self.data.empty:
console.print(
"No currency pair data is loaded. Use 'load' to load data.\n"
)
else:
try:
from openbb_terminal.forex.prediction_techniques import (
pred_controller,
)

self.queue = self.load_class(
pred_controller.PredictionTechniquesController,
self.from_symbol,
self.to_symbol,
self.data.index[0],
"1440min",
self.data,
self.queue,
)
except ImportError:
logger.exception("Tensorflow not available")
console.print(
"[red]Run pip install tensorflow to continue[/red]\n"
)
else:
console.print("No pair selected.\n")
else:
console.print(
"Predict is disabled. Check ENABLE_PREDICT flag on feature_flags.py",
"\n",
)

@log_start_end(log=logger)
def call_qa(self, _):
"""Process qa command"""
if self.from_symbol and self.to_symbol:
if self.data.empty:
console.print(
"No currency pair data is loaded. Use 'load' to load data.\n"
)
else:
from openbb_terminal.forex.quantitative_analysis import qa_controller

self.queue = self.load_class(
qa_controller.QaController,
self.from_symbol,
self.to_symbol,
self.data,
self.queue,
)
else:
console.print("No pair selected.\n")

# HELP WANTED!
# TODO: Add news and reddit commands back
# behavioural analysis and exploratory data analysis would be useful in the
Expand Down
Empty file.
33 changes: 33 additions & 0 deletions openbb_terminal/forex/prediction_techniques/pred_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Pred context API."""

# flake8: noqa
# pylint: disable=unused-import

# Menu commands
from openbb_terminal.common.prediction_techniques.ets_view import (
display_exponential_smoothing as ets,
)
from openbb_terminal.common.prediction_techniques.knn_view import (
display_k_nearest_neighbors as knn,
)
from openbb_terminal.common.prediction_techniques.regression_view import (
display_regression as regression,
)
from openbb_terminal.common.prediction_techniques.arima_view import (
display_arima as arima,
)
from openbb_terminal.common.prediction_techniques.neural_networks_view import (
display_mlp as mlp,
)
from openbb_terminal.common.prediction_techniques.neural_networks_view import (
display_rnn as rnn,
)
from openbb_terminal.common.prediction_techniques.neural_networks_view import (
display_lstm as lstm,
)
from openbb_terminal.common.prediction_techniques.neural_networks_view import (
display_conv1d as conv1d,
)
from openbb_terminal.common.prediction_techniques.mc_view import (
display_mc_forecast as mc,
)
Loading