This commit is contained in:
DJ
2021-04-25 09:56:07 -06:00
parent a4411c6725
commit 0c1b5c0557
3 changed files with 26 additions and 41 deletions

View File

@@ -32,14 +32,12 @@ This menu utilizes oanda to enable support for trading forex.
* Display the positionbook if Oanda provides one for the forex instrument
* [news](#news)
* Latest news of the currency provided by [News API]
* [bullbear](#bullbear)
* Estimate quick sentiment from last 30 messages on board
* [messages](#messages)
* Output up to the 30 last messages on the board
* [reddit](#reddit)
* Gets due diligence from another user's post [Reddit]
* [eda](#eda)
* This menu aims to perform exploratory data analysis on a pre-loaded forex instrument.
* [ba](#ba)
* This menu aims to extrapolate behavioural analysis regarding a pre-loaded forex instrument.
## summary <a name ="summary"></a>
```text
@@ -173,21 +171,6 @@ Prints latest news about currency, including date, title and web link. [Source:
* -n : Number of latest news being printed. Default 10.
## bullbear <a name="bullbear"></a>
```
usage: bullbear [-t S_TICKER]
```
Print bullbear sentiment based on last 30 messages on the board. Also prints the watchlist_count. [Source: Stocktwits]
* -t : ticker to gather sentiment from.
## messages <a name="messages"></a>
```
usage: messages [-t S_TICKER] [-l N_LIM]
```
Print up to 30 of the last messages on the board. [Source: Stocktwits]
* -t : get board messages from this ticker. Default pre-loaded.
* -l : limit messages shown. Default 30.
## reddit <a name="reddit"></a>
```text
@@ -206,3 +189,9 @@ usage: eda
```
Access the exploratory data analysis menu.
## ba <a name="ba"></a>
```text
usage: ba
```
Access the behavioural analysis menu.

View File

@@ -7,7 +7,7 @@ from gamestonk_terminal.menu import session
from gamestonk_terminal.forex import fx_view
from gamestonk_terminal import config_terminal as cfg
from gamestonk_terminal.due_diligence import news_view, reddit_view
from gamestonk_terminal.behavioural_analysis import stocktwits_view
from gamestonk_terminal.behavioural_analysis import stocktwits_view, ba_controller
from gamestonk_terminal.exploratory_data_analysis import eda_controller
import pandas as pd
@@ -37,10 +37,9 @@ class ForexController:
"pending",
"calendar",
"news",
"bullbear",
"messages",
"reddit",
"eda",
"ba",
]
def __init__(self):
@@ -80,17 +79,14 @@ class ForexController:
print(" orderbook print orderbook")
print(" positionbook print positionbook")
print(" news print news [News API]")
print(
" bullbear estimate quick sentiment from last 30 messages on stocktwits"
)
print(
" messages output up to the 30 last messages on the stocktwits board"
)
print(
" reddit search reddit for posts about the loaded instrument"
)
print(
" eda exploratory data analysis, e.g.: decompose, cusum, residuals analysis"
" eda > exploratory data analysis, e.g.: decompose, cusum, residuals analysis"
)
print(
" ba > behavioural analysis, from: reddit, stocktwits, twitter, google"
)
print("")
@@ -179,16 +175,6 @@ class ForexController:
"""Call news [News API]"""
news_view.news(other_args, self.instrument)
def call_bullbear(self, other_args: List[str]):
"""Call bullbear fom stocktwits"""
instrument = fx_view.format_instrument(self.instrument, " ")
stocktwits_view.bullbear(other_args, instrument)
def call_messages(self, other_args: List[str]):
"""Call messages from stocktwits"""
instrument = fx_view.format_instrument(self.instrument, " ")
stocktwits_view.messages(other_args, instrument)
def call_reddit(self, other_args: List[str]):
instrument = fx_view.format_instrument(self.instrument, " ")
reddit_view.due_diligence(other_args, instrument)
@@ -201,6 +187,11 @@ class ForexController:
s_interval = "1440min"
eda_controller.menu(df, instrument, s_start, s_interval)
def call_ba(self, other_args: List[str]):
instrument = fx_view.format_instrument(self.instrument, " ")
df = fx_view.get_candles_dataframe(account, self.instrument, None)
s_start = pd.to_datetime(df.index.values[0])
ba_controller.menu(instrument, s_start)
def menu():
"""Oanda Menu"""

View File

@@ -12,7 +12,7 @@ from oandapyV20.exceptions import V20Error
from gamestonk_terminal import config_terminal as cfg
from gamestonk_terminal import config_plot as cfgPlot
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import parse_known_args_and_warn, plot_autoscale
from gamestonk_terminal.helper_funcs import parse_known_args_and_warn, plot_autoscale, check_non_negative
import pandas as pd
import pandas_ta as ta
import mplfinance as mpf
@@ -229,7 +229,7 @@ def create_order(accountID, instrument, other_args: List[str]):
"--price",
dest="price",
action="store",
type=str,
type=float,
required=True,
help="The price to set for the limit order. ",
)
@@ -237,6 +237,11 @@ def create_order(accountID, instrument, other_args: List[str]):
ns_parser = parse_known_args_and_warn(parser, other_args)
if not ns_parser:
return
if "JPY" or "THB" or "HUF" in instrument:
ns_parser.price = round(ns_parser.price, 3)
else:
ns_parser.price = round(ns_parser.price, 5)
check_non_negative(ns_parser.price)
data = {
"order": {