From c66c74a26d051712bac4719fd35ae8d013e96a63 Mon Sep 17 00:00:00 2001 From: didier Date: Sun, 18 Apr 2021 21:52:29 +0100 Subject: [PATCH 01/11] fix bug for yahoo finance tickers from other markets (e.g. SBIN.NS) --- terminal.py | 63 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/terminal.py b/terminal.py index b4c9e2754f9..3db2b090158 100644 --- a/terminal.py +++ b/terminal.py @@ -196,26 +196,51 @@ def main(): b_quit = mill.papermill_menu() elif ns_known_args.opt == "ba": - b_quit = ba_controller.menu(s_ticker, s_start) + b_quit = ba_controller.menu( + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, s_start + ) elif ns_known_args.opt == "res": - b_quit = rm.res_menu(s_ticker, s_start, s_interval) + b_quit = rm.res_menu( + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) elif ns_known_args.opt == "ca": b_quit = ca_controller.menu(df_stock, s_ticker, s_start, s_interval) elif ns_known_args.opt == "fa": - b_quit = fam.fa_menu(s_ticker, s_start, s_interval) + b_quit = fam.fa_menu( + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) elif ns_known_args.opt == "ta": - b_quit = ta_controller.menu(df_stock, s_ticker, s_start, s_interval) + b_quit = ta_controller.menu( + df_stock, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) elif ns_known_args.opt == "dd": - b_quit = dd_controller.menu(df_stock, s_ticker, s_start, s_interval) + b_quit = dd_controller.menu( + df_stock, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) elif ns_known_args.opt == "eda": if s_interval == "1440min": - b_quit = eda_controller.menu(df_stock, s_ticker, s_start, s_interval) + b_quit = eda_controller.menu( + df_stock, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) else: df_stock = yf.download(s_ticker, start=s_start, progress=False) df_stock = df_stock.rename( @@ -231,7 +256,12 @@ def main(): df_stock.index.name = "date" s_interval = "1440min" - b_quit = eda_controller.menu(df_stock, s_ticker, s_start, s_interval) + b_quit = eda_controller.menu( + df_stock, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) elif ns_known_args.opt == "op": b_quit = op_controller.menu( @@ -273,7 +303,12 @@ def main(): continue if s_interval == "1440min": - b_quit = pred_controller.menu(df_stock, s_ticker, s_start, s_interval) + b_quit = pred_controller.menu( + df_stock, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) # If stock data is intradaily, we need to get data again as prediction # techniques work on daily adjusted data. By default we load data from # Alpha Vantage because the historical data loaded gives a larger @@ -291,7 +326,10 @@ def main(): df_stock_pred = df_stock_pred.sort_index(ascending=True) df_stock_pred = df_stock_pred[s_start:] b_quit = pred_controller.menu( - df_stock_pred, s_ticker, s_start, s_interval="1440min" + df_stock_pred, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval="1440min", ) except Exception as e: print(e) @@ -299,7 +337,12 @@ def main(): return elif ns_known_args.opt == "ra": - b_quit = ra_controller.menu(df_stock, s_ticker, s_start, s_interval) + b_quit = ra_controller.menu( + df_stock, + s_ticker.split(".")[0] if "." in s_ticker else s_ticker, + s_start, + s_interval, + ) elif ns_known_args.opt == "scr": b_quit = screener_controller.menu() From 304585cdb1f0c7e9f31e5f48cca5630c06e9acd6 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Sun, 18 Apr 2021 22:01:13 +0100 Subject: [PATCH 02/11] add discord server to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 84a6007fdd1..df5e46c0181 100644 --- a/README.md +++ b/README.md @@ -363,6 +363,9 @@ Distributed under the MIT License. See [LICENSE](https://github.com/DidierRLopes [Artem Veremy](https://www.linkedin.com/in/veremey/) - artem@veremey.net [James Maslek](https://www.linkedin.com/in/james-maslek-b6810186/) - jmaslek11@gmail.com + +Feel free to share porn loss, memes or any questions at https://discord.gg/FmKjHKMn + ## Acknowledgments * [VICE article](https://www.vice.com/en/article/qjp9vp/gamestonk-terminal-is-a-diy-meme-stock-version-of-bloomberg-terminal) From 76de01a024c108d0969fc52d9eb311f8ec89ca06 Mon Sep 17 00:00:00 2001 From: didier Date: Sun, 18 Apr 2021 22:27:06 +0100 Subject: [PATCH 03/11] improve bar width of option calls/puts --- gamestonk_terminal/options/volume_view.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gamestonk_terminal/options/volume_view.py b/gamestonk_terminal/options/volume_view.py index a4f3062a960..4d32126c682 100644 --- a/gamestonk_terminal/options/volume_view.py +++ b/gamestonk_terminal/options/volume_view.py @@ -351,8 +351,9 @@ def plot_calls_volume_open_interest( df_calls["strike"], df_calls["volume"] + df_calls["openInterest"], color="lightgreen", + width=0.45, ) - plt.bar(df_calls["strike"], df_calls["volume"], color="green") + plt.bar(df_calls["strike"], df_calls["volume"], color="green", width=0.45) plt.title(f"{ticker} calls volumes for {exp_date} ") plt.legend(["Stock Price", "Open Interest", "Volume"]) @@ -443,8 +444,9 @@ def plot_puts_volume_open_interest( df_puts["strike"], -df_puts["volume"] - df_puts["openInterest"], color="pink", + width=0.45, ) - plt.bar(df_puts["strike"], -df_puts["volume"], color="red") + plt.bar(df_puts["strike"], -df_puts["volume"], color="red", width=0.45) plt.title(f"{ticker} puts volumes for {exp_date} ") plt.legend(["Stock Price", "Open Interest", "Volume"]) From 8407cccedb72ce76d3dbb3766c0da6fe3373bc73 Mon Sep 17 00:00:00 2001 From: didier Date: Sun, 18 Apr 2021 22:29:15 +0100 Subject: [PATCH 04/11] Add new line after option chains --- gamestonk_terminal/options/chains_view.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gamestonk_terminal/options/chains_view.py b/gamestonk_terminal/options/chains_view.py index c05552a909e..8bc63ef24a4 100644 --- a/gamestonk_terminal/options/chains_view.py +++ b/gamestonk_terminal/options/chains_view.py @@ -201,6 +201,7 @@ def display_chains(symbol: str, expiry: str, other_args: List[str]): floatfmt=".2f", ) ) + print("") except Exception as e: print(e) From d348d867ae0c2b1ee002d070da6190abeeb187ab Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Sun, 18 Apr 2021 22:54:09 +0100 Subject: [PATCH 05/11] Improve options data readme --- gamestonk_terminal/options/README.md | 93 ++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 27 deletions(-) diff --git a/gamestonk_terminal/options/README.md b/gamestonk_terminal/options/README.md index 980be7495c4..4742badb005 100644 --- a/gamestonk_terminal/options/README.md +++ b/gamestonk_terminal/options/README.md @@ -1,50 +1,89 @@ -# OPTIONS DATA +# OPTIONS -This menu aims to give insight on options. options can cause significant share price movement, and option pricing gives -info about market sentiment for a ticker. +This menu aims to give insight on options. -* [volume](#volume) - * Show traded options for a given expiry [Yahoo Finance] +This menu aims to give insight on options. Options can cause significant share price movement, and option pricing gives info about market sentiment for a ticker. The usage of the following commands along with an example will be exploited below: +* [exp](#exp) + * See/set expiry date [Yahoo Finance] +* [voi](#voi) + * Volume + open interest options trading plot [Yahoo Finance] +* [vcalls](#vcalls) + * Calls volume + open interest plot [Yahoo Finance] +* [vputs](#vputs) + * Puts volume + open interest plot [Yahoo Finance] * [chains](#chains) - * Display option chains for + * Display option chains [Source: Tradier] -## volume + +## exp ```text -usage: volume -e yyyy-mm-dd +usage: exp [-d {0,1,2,3,4,5,6,7,8,9,10,11}] ``` -or +See/set expiry dates. [Source: Yahoo Finance] + +* -d : Expiry date index to set. + +exp + + +## voi ```text -usage: volume --expiry yyyy-mm-dd +usage: voi [-v MIN_VOL] [-m MIN_SP] [-M MAX_SP] ``` +Plots Volume + Open Interest of calls vs puts. [Source: Yahoo Finance] -Display volume graph for a date. [Source: Yahoo Finance] +* -v : Minimum volume (considering open interest) threshold of the plot. +* -m : Minimum strike price to consider in the plot. +* -M : Maximum strike price to consider in the plot. + +![voinio](https://user-images.githubusercontent.com/25267873/115161878-f7a19600-a097-11eb-889b-e9cc945f174d.png) + + +## vcalls + +```text +usage: vcalls [-m MIN_SP] [-M MAX_SP] +``` + +Plots Calls Volume + Open Interest. [Source: Yahoo Finance] + +* -m : Minimum strike price to consider in the plot. +* -M : Maximum strike price to consider in the plot. + +![vcalls](https://user-images.githubusercontent.com/25267873/115161874-f5d7d280-a097-11eb-93e2-3a2b20292f09.png) + + +## vputs + +```text +usage: vputs [-m MIN_SP] [-M MAX_SP] +``` + +Plots Puts Volume + Open Interest. [Source: Yahoo Finance] + +* -m : Minimum strike price to consider in the plot. +* -M : Maximum strike price to consider in the plot. + +![vputs](https://user-images.githubusercontent.com/25267873/115161873-f40e0f00-a097-11eb-8334-3d4f14b56766.png) -* -e, --expiry : expiration date. ## chains -Display a table of options chains. - -This data requires a Tradier sandbox developer account, which can be made [here](#https://tradier.com/products/market-data-api) ```` -usage: chains [--calls] [--puts] [-m MIN] [-M MAX] +usage: chains [--calls] [--puts] [-m MIN_SP] [-M MAX_SP] ```` -* --calls : Flag to only display call options -* --puts : Flag to display only put options -* -m : Minimum strike price to show -* -M : Maximum strike price to show -For combines tables, call options are on the left and put options are on the right of the strike +Display options chains. [Source: Tradier] -As an example, if I load my ticker and select an expiry, to view the options chain for strikes between $129 and $135, one would use: +* --calls : Flag to show calls only +* --puts : Flag to show puts only +* -m : Minimum strike price to consider. +* -M : Maximum strike price to consider. -```` -chains -m 129 -M 135 -```` -Which outputs: -![im](https://user-images.githubusercontent.com/18151143/115068041-b191da00-9ebf-11eb-941e-4e255787ab94.png) + +chains From b2932efee156223c534daec103f2ac74d10bb3b2 Mon Sep 17 00:00:00 2001 From: didier Date: Sun, 18 Apr 2021 23:00:59 +0100 Subject: [PATCH 06/11] minor improvements --- gamestonk_terminal/options/chains_view.py | 4 +++- gamestonk_terminal/options/op_controller.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gamestonk_terminal/options/chains_view.py b/gamestonk_terminal/options/chains_view.py index 8bc63ef24a4..d1a99a9d1e3 100644 --- a/gamestonk_terminal/options/chains_view.py +++ b/gamestonk_terminal/options/chains_view.py @@ -88,7 +88,9 @@ def get_option_chains(symbol: str, expiry: str) -> pd.DataFrame: def display_chains(symbol: str, expiry: str, other_args: List[str]): parser = argparse.ArgumentParser( - prog="chains", add_help=False, description="Display options chains" + prog="chains", + add_help=False, + description="Display option chains [Source: Tradier]", ) parser.add_argument( diff --git a/gamestonk_terminal/options/op_controller.py b/gamestonk_terminal/options/op_controller.py index 4caa51dbd63..4a37d485327 100644 --- a/gamestonk_terminal/options/op_controller.py +++ b/gamestonk_terminal/options/op_controller.py @@ -38,7 +38,7 @@ class OptionsController: parser = argparse.ArgumentParser( add_help=False, prog="exp", - description="""See expiry dates.""", + description="""See/set expiry dates. [Source: Yahoo Finance]""", ) parser.add_argument( "-d", From ca7a4da4302f92501fdd6d6fb87c7b697aa19e36 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Mon, 19 Apr 2021 08:44:44 +0100 Subject: [PATCH 07/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index df5e46c0181..7724ad3300c 100644 --- a/README.md +++ b/README.md @@ -364,7 +364,7 @@ Distributed under the MIT License. See [LICENSE](https://github.com/DidierRLopes [James Maslek](https://www.linkedin.com/in/james-maslek-b6810186/) - jmaslek11@gmail.com -Feel free to share porn loss, memes or any questions at https://discord.gg/FmKjHKMn +Feel free to share loss porn, memes or any questions at https://discord.gg/FmKjHKMn ## Acknowledgments From 4ab29f483bba47fe00980f7e3c08d74c86c83705 Mon Sep 17 00:00:00 2001 From: didier Date: Mon, 19 Apr 2021 08:51:44 +0100 Subject: [PATCH 08/11] minor fixes --- gamestonk_terminal/README.md | 1 + gamestonk_terminal/due_diligence/sec_view.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gamestonk_terminal/README.md b/gamestonk_terminal/README.md index eb3dfae535b..fdaa9118d84 100644 --- a/gamestonk_terminal/README.md +++ b/gamestonk_terminal/README.md @@ -214,6 +214,7 @@ Command|Description|Source `short` |short interest |[Quandl](https://www.quandl.com/) `warnings` |company warnings according to Sean Seah book |[MarketWatch](https://www.marketwatch.com/) `dp` |dark pools (ATS) vs OTC data [FINRA](https://www.finra.org/#/) +`ftd` |display fails-to-deliver data [SEC](https://www.sec.gov)   diff --git a/gamestonk_terminal/due_diligence/sec_view.py b/gamestonk_terminal/due_diligence/sec_view.py index 803cf8ecf3c..9a8ecba46ed 100644 --- a/gamestonk_terminal/due_diligence/sec_view.py +++ b/gamestonk_terminal/due_diligence/sec_view.py @@ -102,5 +102,7 @@ def fails_to_deliver(other_args: List[str], ticker: str): plt.show() + print("") + except Exception as e: print(e, "\n") From ec0cab1b0dd263d7ed4ac94934dc259643ab1b7c Mon Sep 17 00:00:00 2001 From: didier Date: Mon, 19 Apr 2021 08:54:58 +0100 Subject: [PATCH 09/11] add a bit more dates to ftd --- gamestonk_terminal/due_diligence/sec_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamestonk_terminal/due_diligence/sec_view.py b/gamestonk_terminal/due_diligence/sec_view.py index 9a8ecba46ed..a2528f87387 100644 --- a/gamestonk_terminal/due_diligence/sec_view.py +++ b/gamestonk_terminal/due_diligence/sec_view.py @@ -93,7 +93,7 @@ def fails_to_deliver(other_args: List[str], ticker: str): plt.title(f"Fails-to-deliver Data for {ticker}") plt.grid(b=True, which="major", color="#666666", linestyle="-", alpha=0.2) plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%Y/%m/%d")) - plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=7)) + plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=3)) plt.gcf().autofmt_xdate() plt.xlabel("Days") From b74d70a3d30cd68caa342596627ad7d85c56250c Mon Sep 17 00:00:00 2001 From: didier Date: Mon, 19 Apr 2021 08:58:13 +0100 Subject: [PATCH 10/11] update default shown to 1 month --- gamestonk_terminal/due_diligence/sec_view.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamestonk_terminal/due_diligence/sec_view.py b/gamestonk_terminal/due_diligence/sec_view.py index a2528f87387..9eb3f02e8f8 100644 --- a/gamestonk_terminal/due_diligence/sec_view.py +++ b/gamestonk_terminal/due_diligence/sec_view.py @@ -39,7 +39,7 @@ def fails_to_deliver(other_args: List[str], ticker: str): action="store", dest="n_num", type=check_positive, - default=10, + default=20, help="number of latest fails-to-deliver being printed", ) @@ -93,7 +93,7 @@ def fails_to_deliver(other_args: List[str], ticker: str): plt.title(f"Fails-to-deliver Data for {ticker}") plt.grid(b=True, which="major", color="#666666", linestyle="-", alpha=0.2) plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%Y/%m/%d")) - plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=3)) + plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=7)) plt.gcf().autofmt_xdate() plt.xlabel("Days") From 5fe3746546223a92a5f34549361e977da09981a2 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Mon, 19 Apr 2021 09:00:03 +0100 Subject: [PATCH 11/11] Update README.md --- gamestonk_terminal/due_diligence/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gamestonk_terminal/due_diligence/README.md b/gamestonk_terminal/due_diligence/README.md index 2d0c9fb2d0c..cb8854b78e5 100644 --- a/gamestonk_terminal/due_diligence/README.md +++ b/gamestonk_terminal/due_diligence/README.md @@ -175,11 +175,12 @@ Display barchart of dark pool (ATS) and OTC (Non ATS) data ## ftd ```text -usage: ftd [-n] +usage: ftd [-n N_NUM] ``` The fails-to-deliver data collected by SEC. Fails to deliver on a given day are a cumulative number of all fails outstanding until that day, plus new fails that occur that day, less fails that settle that day. See . [Source: SEC] -* -n : number of latest fails-to-deliver being printed. Default 10. +* -n : number of latest fails-to-deliver being printed. Default 20. + +![ftd](https://user-images.githubusercontent.com/25267873/115201750-93a9bc80-a0ed-11eb-8f13-68508749259e.png) -ftd