Improve Jupyter and API (#1274)

* Added no-input option

* Added test for gst

* Removed export

* Added options URL
This commit is contained in:
Colin Delahunty
2022-01-27 21:43:01 -05:00
committed by GitHub
parent 29dbc0da9a
commit e5fbc4de70
8 changed files with 44 additions and 21 deletions

View File

@@ -10,10 +10,7 @@ from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import (
EXPORT_ONLY_RAW_DATA_ALLOWED,
parse_known_args_and_warn,
)
from gamestonk_terminal.helper_funcs import parse_known_args_and_warn
from gamestonk_terminal.menu import session
# pylint: disable=consider-using-with
@@ -82,19 +79,28 @@ def create_call(other_args: List[str], name: str, filename: str = None) -> None:
dest="jupyter",
help="Shows dashboard in jupyter-lab.",
)
ns_parser = parse_known_args_and_warn(
parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED
parser.add_argument(
"-n",
"--no-input",
action="store_true",
default=False,
dest="input",
help="Skips confirmation to run server.",
)
ns_parser = parse_known_args_and_warn(parser, other_args)
if ns_parser:
cmd = "jupyter-lab" if ns_parser.jupyter else "voila"
file = os.path.join(
os.path.abspath(os.path.dirname(__file__)), f"{filename}.ipynb"
)
console.print(f"Warning: opens a port on your computer to run a {cmd} server.")
response = input("Would you like us to run the server for you? y/n\n")
if response.lower() == "y":
if not ns_parser.input:
console.print(
f"Warning: opens a port on your computer to run a {cmd} server."
)
response = input("Would you like us to run the server for you? y/n\n")
if ns_parser.input or response.lower() == "y":
subprocess.Popen(
f"{cmd} {file}",
stdout=subprocess.PIPE,

View File

@@ -141,7 +141,8 @@ class Option:
opt_type: int = 1,
):
"""
Class for getting the greeks of options
Class for getting the greeks of options. Inspiration from:
http://www.smileofthales.com/computation/option-pricing-python-inheritance/
Parameters
----------

View File

@@ -0,0 +1,11 @@
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
# IMPORTATION INTERNAL
def test_import_api():
# pylint: disable=import-outside-toplevel, unused-import
# flake8: noqa
from gamestonk_terminal import api

View File

@@ -6,6 +6,7 @@ Opens a voila dashboard showing option chain information for a given ticker and
```
optional arguments:
-j opens in jupyterlab instead of voila (default: False)
-j, --jupyter opens in jupyterlab instead of voila (default: False)
-n, --no-input does not ask the user if it can open a server (default: False)
-h, --help show this help message
```

View File

@@ -6,6 +6,7 @@ Opens a voila dashboard showing the correlations between stocks
```
optional arguments:
-j opens in jupyterlab instead of voila (default: False)
-j, --jupyter opens in jupyterlab instead of voila (default: False)
-n, --no-input does not ask the user if it can open a server (default: False)
-h, --help show this help message
```

View File

@@ -4,9 +4,9 @@ usage: shortdata [-j] [-h] [--export {csv,json,xlsx}]
Shows shortdata dashboard
```optional arguments:
-j, --jupyter Shows dashboard in jupyter-lab. (default: False)
-h, --help show this help message (default: False)
--export {csv,json,xlsx}
Export raw data into csv, json, xlsx (default: )
```
```
optional arguments:
-j, --jupyter opens in jupyterlab instead of voila (default: False)
-n, --no-input does not ask the user if it can open a server (default: False)
-h, --help show this help message
```

View File

@@ -6,6 +6,8 @@ Opens a voila dashboard showing historical data for stocks
```
optional arguments:
-j opens in jupyterlab instead of voila (default: False)
-j, --jupyter opens in jupyterlab instead of voila (default: False)
-n, --no-input does not ask the user if it can open a server (default: False)
-h, --help show this help message
```

View File

@@ -6,6 +6,7 @@ Shows the volatility surface for options
```
optional arguments:
-j opens in jupyterlab instead of voila (default: False)
-j, --jupyter opens in jupyterlab instead of voila (default: False)
-n, --no-input does not ask the user if it can open a server (default: False)
-h, --help show this help message
```