openbb-cli 1.0.0__py3-none-any.whl

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.
Files changed (42) hide show
  1. openbb_cli/__init__.py +1 -0
  2. openbb_cli/argparse_translator/__init__.py +0 -0
  3. openbb_cli/argparse_translator/argparse_class_processor.py +148 -0
  4. openbb_cli/argparse_translator/argparse_translator.py +627 -0
  5. openbb_cli/argparse_translator/obbject_registry.py +94 -0
  6. openbb_cli/assets/routines/routine_example.openbb +21 -0
  7. openbb_cli/assets/styles/default/Consolas.ttf +0 -0
  8. openbb_cli/assets/styles/default/dark.mpfstyle.json +47 -0
  9. openbb_cli/assets/styles/default/dark.mplrc.json +7 -0
  10. openbb_cli/assets/styles/default/dark.mplstyle +96 -0
  11. openbb_cli/assets/styles/default/dark.pltstyle.json +132 -0
  12. openbb_cli/assets/styles/default/dark.richstyle.json +9 -0
  13. openbb_cli/assets/styles/default/light.mpfstyle.json +47 -0
  14. openbb_cli/assets/styles/default/light.mplrc.json +7 -0
  15. openbb_cli/assets/styles/default/light.mplstyle +95 -0
  16. openbb_cli/assets/styles/default/light.pltstyle.json +871 -0
  17. openbb_cli/assets/styles/default/light.richstyle.json +9 -0
  18. openbb_cli/assets/styles/default/tables.pltstyle.json +102 -0
  19. openbb_cli/assets/styles/user/openbb.richstyle.json +9 -0
  20. openbb_cli/cli.py +20 -0
  21. openbb_cli/config/__init__.py +1 -0
  22. openbb_cli/config/completer.py +427 -0
  23. openbb_cli/config/console.py +93 -0
  24. openbb_cli/config/constants.py +80 -0
  25. openbb_cli/config/menu_text.py +165 -0
  26. openbb_cli/config/setup.py +11 -0
  27. openbb_cli/config/style.py +108 -0
  28. openbb_cli/controllers/base_controller.py +941 -0
  29. openbb_cli/controllers/base_platform_controller.py +349 -0
  30. openbb_cli/controllers/choices.py +324 -0
  31. openbb_cli/controllers/cli_controller.py +946 -0
  32. openbb_cli/controllers/hub_service.py +107 -0
  33. openbb_cli/controllers/platform_controller_factory.py +58 -0
  34. openbb_cli/controllers/script_parser.py +488 -0
  35. openbb_cli/controllers/settings_controller.py +373 -0
  36. openbb_cli/controllers/utils.py +967 -0
  37. openbb_cli/models/settings.py +73 -0
  38. openbb_cli/session.py +92 -0
  39. openbb_cli-1.0.0.dist-info/METADATA +91 -0
  40. openbb_cli-1.0.0.dist-info/RECORD +42 -0
  41. openbb_cli-1.0.0.dist-info/WHEEL +4 -0
  42. openbb_cli-1.0.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,94 @@
1
+ """Registry for OBBjects."""
2
+
3
+ import json
4
+ from typing import Dict, List
5
+
6
+ from openbb_core.app.model.obbject import OBBject
7
+
8
+
9
+ class Registry:
10
+ """Registry for OBBjects."""
11
+
12
+ def __init__(self):
13
+ """Initialize the registry."""
14
+ self._obbjects: List[OBBject] = []
15
+
16
+ @staticmethod
17
+ def _contains_obbject(uuid: str, obbjects: List[OBBject]) -> bool:
18
+ """Check if obbject with uuid is in the registry."""
19
+ return any(obbject.id == uuid for obbject in obbjects)
20
+
21
+ def register(self, obbject: OBBject) -> bool:
22
+ """Designed to add an OBBject instance to the registry."""
23
+ if (
24
+ isinstance(obbject, OBBject)
25
+ and not self._contains_obbject(obbject.id, self._obbjects)
26
+ and obbject.results
27
+ ):
28
+ self._obbjects.append(obbject)
29
+ return True
30
+ return False
31
+
32
+ def get(self, idx: int) -> OBBject:
33
+ """Return the obbject at index idx."""
34
+ # the list should work as a stack
35
+ # i.e., the last element needs to be accessed by idx=0 and so on
36
+ reversed_list = list(reversed(self._obbjects))
37
+ return reversed_list[idx]
38
+
39
+ def remove(self, idx: int = -1):
40
+ """Remove the obbject at index idx, default is the last element."""
41
+ # the list should work as a stack
42
+ # i.e., the last element needs to be accessed by idx=0 and so on
43
+ reversed_list = list(reversed(self._obbjects))
44
+ del reversed_list[idx]
45
+ self._obbjects = list(reversed(reversed_list))
46
+
47
+ @property
48
+ def all(self) -> Dict[int, Dict]:
49
+ """Return all obbjects in the registry"""
50
+
51
+ def _handle_standard_params(obbject: OBBject) -> str:
52
+ """Handle standard params for obbjects"""
53
+ standard_params_json = ""
54
+ std_params = obbject._standard_params # pylint: disable=protected-access
55
+ if hasattr(std_params, "__dict__"):
56
+ standard_params = {
57
+ k: str(v)[:30] for k, v in std_params.__dict__.items() if v
58
+ }
59
+ standard_params_json = json.dumps(standard_params)
60
+
61
+ return standard_params_json
62
+
63
+ def _handle_data_repr(obbject: OBBject) -> str:
64
+ """Handle data representation for obbjects"""
65
+ data_repr = ""
66
+ if hasattr(obbject, "results") and obbject.results:
67
+ data_schema = (
68
+ obbject.results[0].model_json_schema()
69
+ if obbject.results and isinstance(obbject.results, list)
70
+ else ""
71
+ )
72
+ if data_schema and "title" in data_schema:
73
+ data_repr = f"{data_schema['title']}"
74
+ if data_schema and "description" in data_schema:
75
+ data_repr += f" - {data_schema['description'].split('.')[0]}"
76
+
77
+ return data_repr
78
+
79
+ obbjects = {}
80
+ for i, obbject in enumerate(list(reversed(self._obbjects))):
81
+ obbjects[i] = {
82
+ "route": obbject._route, # pylint: disable=protected-access
83
+ "provider": obbject.provider,
84
+ "standard params": _handle_standard_params(obbject),
85
+ "data": _handle_data_repr(obbject),
86
+ "command": obbject.extra.get("command", ""),
87
+ }
88
+
89
+ return obbjects
90
+
91
+ @property
92
+ def obbjects(self) -> List[OBBject]:
93
+ """Return all obbjects in the registry"""
94
+ return self._obbjects
@@ -0,0 +1,21 @@
1
+ # Go into the equity context
2
+ equity
3
+
4
+ # Get the company's profile
5
+ profile --symbol aapl
6
+
7
+ # Get company's statements
8
+ fundamental
9
+ balance --symbol aapl
10
+ cash --symbol aapl
11
+ transcript --symbol aapl --year 2023
12
+
13
+ # Load company's historical data
14
+ ../price
15
+ historical --symbol aapl
16
+
17
+ # Get its performance
18
+ performance --symbol aapl
19
+
20
+ # Export the candle as an image and the historical data into a csv
21
+ historical --symbol aapl --chart --export csv,jpg
@@ -0,0 +1,47 @@
1
+ {
2
+ "style_name": "dark",
3
+ "base_mpf_style": null,
4
+ "marketcolors": {
5
+ "candle": {
6
+ "up": "#00ACFF",
7
+ "down": "#e4003a"
8
+ },
9
+ "edge": {
10
+ "up": "#00ACFF",
11
+ "down": "#e4003a"
12
+ },
13
+ "wick": {
14
+ "up": "#00ACFF",
15
+ "down": "#e4003a"
16
+ },
17
+ "ohlc": {
18
+ "up": "#00ACFF",
19
+ "down": "#e4003a"
20
+ },
21
+ "volume": {
22
+ "up": "#00ACFF",
23
+ "down": "#e4003a"
24
+ },
25
+ "vcedge": {
26
+ "up": "#219E4F",
27
+ "down": "#9E1711"
28
+ },
29
+ "vcdopcod": true,
30
+ "alpha": 1
31
+ },
32
+ "mavcolors": [
33
+ "#EB3DBC",
34
+ "#31EBEA",
35
+ "#EB8C54",
36
+ "#EB5549"
37
+ ],
38
+ "y_on_right": true,
39
+ "gridcolor": "#A3A0A2",
40
+ "gridstyle": ":",
41
+ "facecolor": "black",
42
+ "edgecolor": null,
43
+ "figcolor": null,
44
+ "gridaxis": null,
45
+ "rc": null,
46
+ "legacy_rc": null
47
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "xticks_rotation": 10,
3
+ "tight_layout_padding": 2,
4
+ "pie_wedgeprops": {"linewidth": 0.5, "edgecolor": "#FFFFFF"},
5
+ "pie_startangle": 90,
6
+ "volume_bar_width": 0.5
7
+ }
@@ -0,0 +1,96 @@
1
+ # The cool hackerman style
2
+
3
+ # LINES
4
+ # http://matplotlib.org/api/artist_api.html#module-matplotlib.lines
5
+ lines.linewidth: 1.5
6
+ lines.color: F5EFF3
7
+ lines.linestyle: -
8
+ lines.marker: None
9
+ lines.markeredgewidth: 0.5
10
+ lines.markersize: 4
11
+ lines.dash_joinstyle: miter
12
+ lines.dash_capstyle: butt
13
+ lines.solid_joinstyle: miter
14
+ lines.solid_capstyle: projecting
15
+ lines.antialiased: True
16
+
17
+ patch.edgecolor: F5EFF3
18
+ patch.facecolor: 00aaff
19
+ patch.linewidth: 1
20
+
21
+ # TEXT
22
+ # http://matplotlib.org/api/font_manager_api.html
23
+ font.family: sans-serif
24
+ font.sans-serif: Consolas, Deja Vu Sans, Arial, Helvetica
25
+ font.style: normal
26
+ font.variant: normal
27
+ font.weight: medium
28
+ font.stretch: normal
29
+ font.size: 16
30
+
31
+ text.color: F5EFF3
32
+
33
+ axes.spines.left: true
34
+ axes.spines.bottom: true
35
+ axes.spines.top: true
36
+ axes.spines.right: true
37
+ axes.linewidth: 0.4
38
+
39
+ axes.labelsize: small
40
+ axes.titlelocation: left
41
+
42
+ axes.facecolor: black
43
+ axes.edgecolor: F5EFF3
44
+ axes.labelcolor: F5EFF3
45
+ axes.grid: true
46
+ axes.grid.which: major
47
+
48
+ axes.prop_cycle: cycler('color', ['ffed00', 'ef7d00', 'e4003a', 'c13246', '822661', '48277c', '005ca9', '00aaff', '9b30d9', 'af005f', '5f00af', 'af87ff'])
49
+
50
+ xtick.color: F5EFF3
51
+ ytick.color: F5EFF3
52
+
53
+ xtick.major.size: 2
54
+ xtick.minor.size: 1
55
+ xtick.labelsize: small
56
+ xtick.alignment: center
57
+ xtick.major.width: 0.2
58
+
59
+ ytick.major.size: 2
60
+ ytick.minor.size: 1
61
+ ytick.labelsize: small
62
+
63
+ ytick.left: False
64
+ ytick.labelleft: False
65
+ ytick.right: True
66
+ ytick.labelright: True
67
+ ytick.major.width: 0.2
68
+
69
+ grid.color: F5EFF3
70
+ grid.linewidth: 0.4
71
+ grid.linestyle: :
72
+
73
+ legend.framealpha: 0.6
74
+ legend.frameon: true
75
+ legend.facecolor: black
76
+ legend.edgecolor: black
77
+ legend.scatterpoints: 3
78
+ legend.fontsize: small
79
+ legend.loc: upper left
80
+
81
+ figure.facecolor: black
82
+ figure.edgecolor: black
83
+ figure.subplot.hspace: 0.2
84
+
85
+ savefig.facecolor: black
86
+ savefig.edgecolor: black
87
+
88
+ ### Boxplots
89
+ boxplot.boxprops.color: F5EFF3
90
+ boxplot.capprops.color: F5EFF3
91
+ boxplot.flierprops.color: F5EFF3
92
+ boxplot.flierprops.markeredgecolor: F5EFF3
93
+ boxplot.whiskerprops.color: F5EFF3
94
+ boxplot.medianprops.color: F5EFF3
95
+ boxplot.meanprops.markeredgecolor: F5EFF3
96
+ boxplot.meanprops.color: F5EFF3
@@ -0,0 +1,132 @@
1
+ {
2
+ "line": {
3
+ "up_color": "#00ACFF",
4
+ "down_color": "#e4003a",
5
+ "color": "#ffed00",
6
+ "width": 1.5
7
+ },
8
+ "data": {
9
+ "candlestick": [
10
+ {
11
+ "decreasing": {
12
+ "fillcolor": "#e4003a",
13
+ "line": {
14
+ "color": "#e4003a"
15
+ }
16
+ },
17
+ "increasing": {
18
+ "fillcolor": "#00ACFF",
19
+ "line": {
20
+ "color": "#00ACFF"
21
+ }
22
+ },
23
+ "type": "candlestick"
24
+ }
25
+ ]
26
+ },
27
+ "layout": {
28
+ "annotationdefaults": {
29
+ "showarrow": false
30
+ },
31
+ "autotypenumbers": "strict",
32
+ "colorway": [
33
+ "#ffed00",
34
+ "#ef7d00",
35
+ "#e4003a",
36
+ "#c13246",
37
+ "#822661",
38
+ "#48277c",
39
+ "#005ca9",
40
+ "#00aaff",
41
+ "#9b30d9",
42
+ "#af005f",
43
+ "#5f00af",
44
+ "#af87ff"
45
+ ],
46
+ "dragmode": "pan",
47
+ "font": {
48
+ "family": "Fira Code",
49
+ "size": 18
50
+ },
51
+ "hoverlabel": {
52
+ "align": "left"
53
+ },
54
+ "mapbox": {
55
+ "style": "dark"
56
+ },
57
+ "hovermode": "x",
58
+ "legend": {
59
+ "bgcolor": "rgba(0, 0, 0, 0.5)",
60
+ "x": 0.01,
61
+ "xanchor": "left",
62
+ "y": 0.99,
63
+ "yanchor": "top",
64
+ "font": {
65
+ "size": 15
66
+ }
67
+ },
68
+ "legend2": {
69
+ "bgcolor": "rgba(0, 0, 0, 0.5)",
70
+ "font": {
71
+ "size": 15
72
+ }
73
+ },
74
+ "legend3": {
75
+ "bgcolor": "rgba(0, 0, 0, 0.5)",
76
+ "font": {
77
+ "size": 15
78
+ }
79
+ },
80
+ "legend4": {
81
+ "bgcolor": "rgba(0, 0, 0, 0.5)",
82
+ "font": {
83
+ "size": 15
84
+ }
85
+ },
86
+ "legend5": {
87
+ "bgcolor": "rgba(0, 0, 0, 0.5)",
88
+ "font": {
89
+ "size": 15
90
+ }
91
+ },
92
+ "paper_bgcolor": "#000000",
93
+ "plot_bgcolor": "#000000",
94
+ "xaxis": {
95
+ "automargin": true,
96
+ "autorange": true,
97
+ "rangeslider": {
98
+ "visible": false
99
+ },
100
+ "showgrid": true,
101
+ "showline": true,
102
+ "tickfont": {
103
+ "size": 14
104
+ },
105
+ "zeroline": false,
106
+ "tick0": 1,
107
+ "title": {
108
+ "standoff": 20
109
+ },
110
+ "linecolor": "#F5EFF3",
111
+ "mirror": true,
112
+ "ticks": "outside"
113
+ },
114
+ "yaxis": {
115
+ "anchor": "x",
116
+ "automargin": true,
117
+ "fixedrange": false,
118
+ "zeroline": false,
119
+ "showgrid": true,
120
+ "showline": true,
121
+ "side": "right",
122
+ "tick0": 0.5,
123
+ "title": {
124
+ "standoff": 20
125
+ },
126
+ "gridcolor": "#283442",
127
+ "linecolor": "#F5EFF3",
128
+ "mirror": true,
129
+ "ticks": "outside"
130
+ }
131
+ }
132
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "info": "rgb(224,131,48)",
3
+ "cmds": "rgb(102,203,228)",
4
+ "param": "rgb(247,206,70)",
5
+ "menu": "rgb(50,115,185)",
6
+ "src": "rgb(216,90,64)",
7
+ "unvl": "grey30",
8
+ "help": "#FAC900"
9
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "style_name": "light",
3
+ "base_mpf_style": null,
4
+ "marketcolors": {
5
+ "candle": {
6
+ "up": "#00ACFF",
7
+ "down": "#e4003a"
8
+ },
9
+ "edge": {
10
+ "up": "#00ACFF",
11
+ "down": "#e4003a"
12
+ },
13
+ "wick": {
14
+ "up": "#00ACFF",
15
+ "down": "#e4003a"
16
+ },
17
+ "ohlc": {
18
+ "up": "#00ACFF",
19
+ "down": "#e4003a"
20
+ },
21
+ "volume": {
22
+ "up": "#00ACFF",
23
+ "down": "#e4003a"
24
+ },
25
+ "vcedge": {
26
+ "up": "#219E4F",
27
+ "down": "#9E1711"
28
+ },
29
+ "vcdopcod": true,
30
+ "alpha": 1
31
+ },
32
+ "mavcolors": [
33
+ "#EB3DBC",
34
+ "#31EBEA",
35
+ "#EB8C54",
36
+ "#EB5549"
37
+ ],
38
+ "y_on_right": true,
39
+ "gridcolor": "grey",
40
+ "gridstyle": ":",
41
+ "facecolor": "white",
42
+ "edgecolor": null,
43
+ "figcolor": null,
44
+ "gridaxis": null,
45
+ "rc": null,
46
+ "legacy_rc": null
47
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "xticks_rotation": 10,
3
+ "tight_layout_padding": 2,
4
+ "pie_wedgeprops": {"linewidth": 0.5, "edgecolor": "#000000"},
5
+ "pie_startangle": 90,
6
+ "volume_bar_width": 0.5
7
+ }
@@ -0,0 +1,95 @@
1
+ # The cool hackerman style
2
+
3
+ # LINES
4
+ # http://matplotlib.org/api/artist_api.html#module-matplotlib.lines
5
+ lines.linewidth: 1.1
6
+ lines.color: 0F0F0F
7
+ lines.linestyle: -
8
+ lines.marker: None
9
+ lines.markeredgewidth: 0.5
10
+ lines.markersize: 4
11
+ lines.dash_joinstyle: miter
12
+ lines.dash_capstyle: butt
13
+ lines.solid_joinstyle: miter
14
+ lines.solid_capstyle: projecting
15
+ lines.antialiased: True
16
+
17
+ patch.edgecolor: 000000
18
+ patch.facecolor: 822661
19
+ patch.linewidth: 1
20
+
21
+ # TEXT
22
+ # http://matplotlib.org/api/font_manager_api.html
23
+ font.family: sans-serif
24
+ font.sans-serif: Consolas, Deja Vu Sans, Arial, Helvetica
25
+ font.style: normal
26
+ font.variant: normal
27
+ font.weight: medium
28
+ font.stretch: normal
29
+ font.size: 13
30
+
31
+ text.color: 0F0F0F
32
+
33
+ axes.spines.left: true
34
+ axes.spines.bottom: true
35
+ axes.spines.top: true
36
+ axes.spines.right: true
37
+ axes.linewidth: 0.2
38
+
39
+ axes.labelsize: small
40
+ axes.titlelocation: left
41
+
42
+ axes.facecolor: white
43
+ axes.edgecolor: 0F0F0F
44
+ axes.labelcolor: 0F0F0F
45
+ axes.grid: true
46
+ axes.grid.which: major
47
+
48
+ axes.prop_cycle: cycler('color', ['254495', 'c13246', '48277c', 'e4003a', 'ef7d00', '822661', 'ffed00', '00aaff', '9b30d9', 'af005f', '5f00af', 'af87ff'])
49
+
50
+ xtick.color: 0F0F0F
51
+ ytick.color: 0F0F0F
52
+
53
+ xtick.major.size: 2
54
+ xtick.minor.size: 1
55
+ xtick.labelsize: small
56
+
57
+ ytick.major.size: 2
58
+ ytick.minor.size: 1
59
+ ytick.labelsize: small
60
+ xtick.alignment: center
61
+
62
+ ytick.left: False
63
+ ytick.labelleft: False
64
+ ytick.right: True
65
+ ytick.labelright: True
66
+
67
+
68
+ grid.color: 0F0F0F
69
+ grid.linewidth: 0.4
70
+ grid.linestyle: :
71
+
72
+ legend.framealpha: 0.6
73
+ legend.frameon: true
74
+ legend.facecolor: white
75
+ legend.edgecolor: white
76
+ legend.scatterpoints: 3
77
+ legend.fontsize: small
78
+ legend.loc: best
79
+
80
+ figure.facecolor: white
81
+ figure.edgecolor: white
82
+ figure.subplot.hspace: 0.2
83
+
84
+ savefig.facecolor: white
85
+ savefig.edgecolor: white
86
+
87
+ ### Boxplots
88
+ boxplot.boxprops.color: 0F0F0F
89
+ boxplot.capprops.color: 0F0F0F
90
+ boxplot.flierprops.color: 0F0F0F
91
+ boxplot.flierprops.markeredgecolor: 0F0F0F
92
+ boxplot.whiskerprops.color: 0F0F0F
93
+ boxplot.medianprops.color: 0F0F0F
94
+ boxplot.meanprops.markeredgecolor: 0F0F0F
95
+ boxplot.meanprops.color: 0F0F0F