openbb-cli 1.0.0__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/PKG-INFO +6 -6
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/README.md +4 -4
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/argparse_translator/argparse_class_processor.py +0 -1
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/argparse_translator/argparse_translator.py +0 -3
- openbb_cli-1.0.1/openbb_cli/cli.py +23 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/base_controller.py +23 -11
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/base_platform_controller.py +0 -1
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/choices.py +6 -4
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/cli_controller.py +13 -9
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/utils.py +5 -2
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/pyproject.toml +3 -6
- openbb_cli-1.0.0/openbb_cli/cli.py +0 -20
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/__init__.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/argparse_translator/__init__.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/argparse_translator/obbject_registry.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/routines/routine_example.openbb +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/Consolas.ttf +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/dark.mpfstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/dark.mplrc.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/dark.mplstyle +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/dark.pltstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/dark.richstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/light.mpfstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/light.mplrc.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/light.mplstyle +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/light.pltstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/light.richstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/default/tables.pltstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/assets/styles/user/openbb.richstyle.json +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/__init__.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/completer.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/console.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/constants.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/menu_text.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/setup.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/config/style.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/hub_service.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/platform_controller_factory.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/script_parser.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/controllers/settings_controller.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/models/settings.py +0 -0
- {openbb_cli-1.0.0 → openbb_cli-1.0.1}/openbb_cli/session.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: openbb-cli
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Investment Research for Everyone, Anywhere.
|
|
5
5
|
Home-page: https://openbb.co
|
|
6
6
|
License: AGPL-3.0-only
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Requires-Dist: openbb[all] (>=4.2.
|
|
15
|
+
Requires-Dist: openbb[all] (>=4.2.1,<5.0.0)
|
|
16
16
|
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
|
|
17
17
|
Requires-Dist: prompt-toolkit (>=3.0.16,<4.0.0)
|
|
18
18
|
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
|
|
@@ -33,11 +33,11 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
|
|
34
34
|
## Overview
|
|
35
35
|
|
|
36
|
-
The OpenBB CLI is a command line interface that wraps [OpenBB Platform](https://docs.openbb.co/platform).
|
|
36
|
+
The OpenBB Platform CLI is a command line interface that wraps [OpenBB Platform](https://docs.openbb.co/platform).
|
|
37
37
|
|
|
38
38
|
It offers a convenient way to interact with the OpenBB Platform and its extensions, as well as automate data collection via OpenBB Routine Scripts.
|
|
39
39
|
|
|
40
|
-
Find the most complete documentation, examples, and usage guides for the OpenBB Platform CLI [here](https://
|
|
40
|
+
Find the most complete documentation, examples, and usage guides for the OpenBB Platform CLI [here](https://docs.openbb.co/cli).
|
|
41
41
|
|
|
42
42
|
## Installation
|
|
43
43
|
|
|
@@ -47,9 +47,9 @@ The command below provides access to the all the available OpenBB extensions beh
|
|
|
47
47
|
pip install openbb-cli
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
> Note: Find the most complete installation hints and tips [here](https://
|
|
50
|
+
> Note: Find the most complete installation hints and tips [here](https://docs.openbb.co/cli/installation).
|
|
51
51
|
|
|
52
|
-
After the installation is complete, you can deploy the OpenBB CLI by running the following command:
|
|
52
|
+
After the installation is complete, you can deploy the OpenBB Platform CLI by running the following command:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
openbb
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
## Overview
|
|
12
12
|
|
|
13
|
-
The OpenBB CLI is a command line interface that wraps [OpenBB Platform](https://docs.openbb.co/platform).
|
|
13
|
+
The OpenBB Platform CLI is a command line interface that wraps [OpenBB Platform](https://docs.openbb.co/platform).
|
|
14
14
|
|
|
15
15
|
It offers a convenient way to interact with the OpenBB Platform and its extensions, as well as automate data collection via OpenBB Routine Scripts.
|
|
16
16
|
|
|
17
|
-
Find the most complete documentation, examples, and usage guides for the OpenBB Platform CLI [here](https://
|
|
17
|
+
Find the most complete documentation, examples, and usage guides for the OpenBB Platform CLI [here](https://docs.openbb.co/cli).
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
@@ -24,9 +24,9 @@ The command below provides access to the all the available OpenBB extensions beh
|
|
|
24
24
|
pip install openbb-cli
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
> Note: Find the most complete installation hints and tips [here](https://
|
|
27
|
+
> Note: Find the most complete installation hints and tips [here](https://docs.openbb.co/cli/installation).
|
|
28
28
|
|
|
29
|
-
After the installation is complete, you can deploy the OpenBB CLI by running the following command:
|
|
29
|
+
After the installation is complete, you can deploy the OpenBB Platform CLI by running the following command:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
openbb
|
|
@@ -33,7 +33,6 @@ class ArgparseActionType(Enum):
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class CustomArgument(BaseModel):
|
|
36
|
-
|
|
37
36
|
name: str
|
|
38
37
|
type: Optional[Any]
|
|
39
38
|
dest: str
|
|
@@ -62,7 +61,6 @@ class CustomArgument(BaseModel):
|
|
|
62
61
|
|
|
63
62
|
# override
|
|
64
63
|
def model_dump(self, **kwargs):
|
|
65
|
-
|
|
66
64
|
res = super().model_dump(**kwargs)
|
|
67
65
|
|
|
68
66
|
# Check if choices is present and if it's an empty tuple remove it
|
|
@@ -152,7 +150,6 @@ class ReferenceToCustomArgumentsProcessor:
|
|
|
152
150
|
def build_custom_groups(self):
|
|
153
151
|
"""Build the custom groups from the reference."""
|
|
154
152
|
for route, v in self.reference.items():
|
|
155
|
-
|
|
156
153
|
for provider, args in v["parameters"].items():
|
|
157
154
|
if provider == "standard":
|
|
158
155
|
continue
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""OpenBB Platform CLI entry point."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
"""Use the main entry point for the OpenBB Platform CLI."""
|
|
8
|
+
print("Loading...\n") # noqa: T201
|
|
9
|
+
|
|
10
|
+
# pylint: disable=import-outside-toplevel
|
|
11
|
+
from openbb_cli.config.setup import bootstrap
|
|
12
|
+
from openbb_cli.controllers.cli_controller import launch
|
|
13
|
+
|
|
14
|
+
bootstrap()
|
|
15
|
+
|
|
16
|
+
dev = "--dev" in sys.argv[1:]
|
|
17
|
+
debug = "--debug" in sys.argv[1:]
|
|
18
|
+
|
|
19
|
+
launch(dev, debug)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
main()
|
|
@@ -4,6 +4,7 @@ import argparse
|
|
|
4
4
|
import difflib
|
|
5
5
|
import os
|
|
6
6
|
import re
|
|
7
|
+
import shlex
|
|
7
8
|
from abc import ABCMeta, abstractmethod
|
|
8
9
|
from datetime import datetime
|
|
9
10
|
from pathlib import Path
|
|
@@ -240,7 +241,7 @@ class BaseController(metaclass=ABCMeta):
|
|
|
240
241
|
else:
|
|
241
242
|
try:
|
|
242
243
|
(known_args, other_args) = self.parser.parse_known_args(
|
|
243
|
-
|
|
244
|
+
shlex.split(an_input)
|
|
244
245
|
)
|
|
245
246
|
except Exception as exc:
|
|
246
247
|
raise SystemExit from exc
|
|
@@ -744,11 +745,11 @@ class BaseController(metaclass=ABCMeta):
|
|
|
744
745
|
choices_export = ["csv", "json", "xlsx"]
|
|
745
746
|
help_export = "Export raw data into csv, json, xlsx"
|
|
746
747
|
elif export_allowed == "figures_only":
|
|
747
|
-
choices_export = ["png", "jpg", "
|
|
748
|
-
help_export = "Export figure into png, jpg,
|
|
748
|
+
choices_export = ["png", "jpg", "svg"]
|
|
749
|
+
help_export = "Export figure into png, jpg, svg "
|
|
749
750
|
else:
|
|
750
|
-
choices_export = ["csv", "json", "xlsx", "png", "jpg", "
|
|
751
|
-
help_export = "Export raw data into csv, json, xlsx and figure into png, jpg,
|
|
751
|
+
choices_export = ["csv", "json", "xlsx", "png", "jpg", "svg"]
|
|
752
|
+
help_export = "Export raw data into csv, json, xlsx and figure into png, jpg, svg "
|
|
752
753
|
|
|
753
754
|
parser.add_argument(
|
|
754
755
|
"--export",
|
|
@@ -798,11 +799,22 @@ class BaseController(metaclass=ABCMeta):
|
|
|
798
799
|
return None
|
|
799
800
|
|
|
800
801
|
try:
|
|
801
|
-
#
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
802
|
+
# Determine the index of the routine arguments
|
|
803
|
+
routine_args_index = next(
|
|
804
|
+
(
|
|
805
|
+
i + 1
|
|
806
|
+
for i, arg in enumerate(other_args)
|
|
807
|
+
if arg in ("-i", "--input")
|
|
808
|
+
and "routine_args" in [action.dest for action in parser._actions]
|
|
809
|
+
),
|
|
810
|
+
-1,
|
|
811
|
+
)
|
|
812
|
+
# Split comma-separated arguments, except for the argument at routine_args_index
|
|
813
|
+
other_args = [
|
|
814
|
+
part
|
|
815
|
+
for index, arg in enumerate(other_args)
|
|
816
|
+
for part in (arg.split(",") if index != routine_args_index else [arg])
|
|
817
|
+
]
|
|
806
818
|
|
|
807
819
|
(ns_parser, l_unknown_args) = parser.parse_known_args(other_args)
|
|
808
820
|
|
|
@@ -811,7 +823,7 @@ class BaseController(metaclass=ABCMeta):
|
|
|
811
823
|
"raw_data_and_figures",
|
|
812
824
|
]:
|
|
813
825
|
ns_parser.is_image = any(
|
|
814
|
-
ext in ns_parser.export for ext in ["png", "svg", "jpg"
|
|
826
|
+
ext in ns_parser.export for ext in ["png", "svg", "jpg"]
|
|
815
827
|
)
|
|
816
828
|
|
|
817
829
|
except SystemExit:
|
|
@@ -58,11 +58,13 @@ def __mock_parse_known_args_and_warn(
|
|
|
58
58
|
choices_export = ["csv", "json", "xlsx"]
|
|
59
59
|
help_export = "Export raw data into csv, json, xlsx"
|
|
60
60
|
elif export_allowed == "figures_only":
|
|
61
|
-
choices_export = ["png", "jpg", "
|
|
62
|
-
help_export = "Export figure into png, jpg,
|
|
61
|
+
choices_export = ["png", "jpg", "svg"]
|
|
62
|
+
help_export = "Export figure into png, jpg, svg "
|
|
63
63
|
else:
|
|
64
|
-
choices_export = ["csv", "json", "xlsx", "png", "jpg", "
|
|
65
|
-
help_export =
|
|
64
|
+
choices_export = ["csv", "json", "xlsx", "png", "jpg", "svg"]
|
|
65
|
+
help_export = (
|
|
66
|
+
"Export raw data into csv, json, xlsx and figure into png, jpg, svg "
|
|
67
|
+
)
|
|
66
68
|
|
|
67
69
|
parser.add_argument(
|
|
68
70
|
"--export",
|
|
@@ -355,7 +355,7 @@ class CLIController(BaseController):
|
|
|
355
355
|
"--input",
|
|
356
356
|
help="Select multiple inputs to be replaced in the routine and separated by commas. E.g. GME,AMC,BTC-USD",
|
|
357
357
|
dest="routine_args",
|
|
358
|
-
type=
|
|
358
|
+
type=str,
|
|
359
359
|
)
|
|
360
360
|
parser.add_argument(
|
|
361
361
|
"-e",
|
|
@@ -431,17 +431,22 @@ class CLIController(BaseController):
|
|
|
431
431
|
with open(routine_path) as fp:
|
|
432
432
|
raw_lines = list(fp)
|
|
433
433
|
|
|
434
|
+
script_inputs = []
|
|
434
435
|
# Capture ARGV either as list if args separated by commas or as single value
|
|
435
|
-
if ns_parser.routine_args:
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
if routine_args := ns_parser.routine_args:
|
|
437
|
+
pattern = r"\[(.*?)\]"
|
|
438
|
+
matches = re.findall(pattern, routine_args)
|
|
439
|
+
|
|
440
|
+
for match in matches:
|
|
441
|
+
routine_args = routine_args.replace(f"[{match}]", "")
|
|
442
|
+
script_inputs.append(match)
|
|
443
|
+
|
|
444
|
+
script_inputs.extend(
|
|
445
|
+
[val for val in routine_args.split(",") if val]
|
|
440
446
|
)
|
|
441
447
|
|
|
442
448
|
err, parsed_script = parse_openbb_script(
|
|
443
|
-
raw_lines=raw_lines,
|
|
444
|
-
script_inputs=script_inputs if ns_parser.routine_args else None,
|
|
449
|
+
raw_lines=raw_lines, script_inputs=script_inputs
|
|
445
450
|
)
|
|
446
451
|
|
|
447
452
|
# If there err output is not an empty string then it means there was an
|
|
@@ -546,7 +551,6 @@ def run_cli(jobs_cmds: Optional[List[str]] = None, test_mode=False):
|
|
|
546
551
|
t_controller.print_help()
|
|
547
552
|
|
|
548
553
|
while ret_code:
|
|
549
|
-
|
|
550
554
|
# There is a command in the queue
|
|
551
555
|
if t_controller.queue and len(t_controller.queue) > 0:
|
|
552
556
|
# If the command is quitting the menu we want to return in here
|
|
@@ -901,7 +901,7 @@ def export_data(
|
|
|
901
901
|
else:
|
|
902
902
|
save_to_excel(df, saved_path, sheet_name)
|
|
903
903
|
|
|
904
|
-
elif saved_path.suffix in [".jpg", ".
|
|
904
|
+
elif saved_path.suffix in [".jpg", ".png", ".svg"]:
|
|
905
905
|
if figure is None:
|
|
906
906
|
Session().console.print("No plot to export.")
|
|
907
907
|
continue
|
|
@@ -910,7 +910,10 @@ def export_data(
|
|
|
910
910
|
Session().console.print("Wrong export file specified.")
|
|
911
911
|
continue
|
|
912
912
|
|
|
913
|
-
|
|
913
|
+
if saved_path.exists():
|
|
914
|
+
Session().console.print(f"Saved file: {saved_path}")
|
|
915
|
+
else:
|
|
916
|
+
Session().console.print(f"Failed to save file: {saved_path}")
|
|
914
917
|
|
|
915
918
|
if figure is not None:
|
|
916
919
|
figure._exported = True # pylint: disable=protected-access
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "openbb-cli"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.1"
|
|
4
4
|
description = "Investment Research for Everyone, Anywhere."
|
|
5
5
|
authors = ["OpenBB <hello@openbb.co>"]
|
|
6
6
|
packages = [{ include = "openbb_cli" }]
|
|
@@ -17,17 +17,14 @@ openbb = 'openbb_cli.cli:main'
|
|
|
17
17
|
python = "^3.8.1,<3.12"
|
|
18
18
|
|
|
19
19
|
# OpenBB dependencies
|
|
20
|
-
openbb = { version = "^4.2.
|
|
20
|
+
openbb = { version = "^4.2.1", extras = ["all"] }
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# CLI dependencies
|
|
23
23
|
prompt-toolkit = "^3.0.16"
|
|
24
24
|
rich = "^13"
|
|
25
25
|
python-dotenv = "^1.0.0"
|
|
26
26
|
openpyxl = "^3.1.2"
|
|
27
27
|
|
|
28
|
-
[tool.poetry.group.dev.dependencies]
|
|
29
|
-
openbb-devtools = "^1.1.3"
|
|
30
|
-
|
|
31
28
|
[build-system]
|
|
32
29
|
requires = ["setuptools<65.5.0", "poetry-core>=1.0.0"]
|
|
33
30
|
build-backend = "poetry.core.masonry.api"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"""OpenBB Platform CLI entry point."""
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
|
|
5
|
-
from openbb_cli.config.setup import bootstrap
|
|
6
|
-
from openbb_cli.controllers.cli_controller import launch
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main():
|
|
10
|
-
"""Use the main entry point for the OpenBB CLI."""
|
|
11
|
-
bootstrap()
|
|
12
|
-
|
|
13
|
-
dev = "--dev" in sys.argv[1:]
|
|
14
|
-
debug = "--debug" in sys.argv[1:]
|
|
15
|
-
|
|
16
|
-
launch(dev, debug)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if __name__ == "__main__":
|
|
20
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|