From 61ea0b4059f2580639b637b72d1a03001c69fcbd Mon Sep 17 00:00:00 2001 From: colin99d Date: Tue, 27 Sep 2022 13:31:30 +0200 Subject: [PATCH 1/2] Fixed the bug --- .../cryptocurrency/due_diligence/coinglass_model.py | 3 ++- .../cryptocurrency/due_diligence/dd_controller.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py b/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py index 1e9bef419b30..4d3b0662a82e 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py +++ b/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py @@ -13,7 +13,8 @@ api_url = "https://open-api.coinglass.com/api/pro/v1/" -INTERVALS = [0, 1, 2, 4] +intervals = [0, 1, 2, 4] +INTERVALS = [str(x) for x in intervals] @log_start_end(log=logger) diff --git a/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py b/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py index fbe00609f4de..eeb38a455e8b 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py +++ b/openbb_terminal/cryptocurrency/due_diligence/dd_controller.py @@ -528,9 +528,9 @@ def call_oi(self, other_args): "-i", "--interval", dest="interval", - type=int, + type=str, help="Frequency interval. Default: 0", - default=0, + default="0", choices=coinglass_model.INTERVALS, ) @@ -538,10 +538,15 @@ def call_oi(self, other_args): parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES ) + try: + interval = int(ns_parser.interval) + except ValueError: + console.print("[red]Interval must be an integer value[/red]\n") + if ns_parser: coinglass_view.display_open_interest( symbol=self.symbol.upper(), - interval=ns_parser.interval, + interval=interval, export=ns_parser.export, ) From b3f1b92f098a9189797aaa1f703a23dbf1fc4453 Mon Sep 17 00:00:00 2001 From: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:12:47 +0200 Subject: [PATCH 2/2] Update coinglass_model.py --- openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py b/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py index 4d3b0662a82e..0777ad2db9f5 100644 --- a/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py +++ b/openbb_terminal/cryptocurrency/due_diligence/coinglass_model.py @@ -13,6 +13,7 @@ api_url = "https://open-api.coinglass.com/api/pro/v1/" +# Prompt toolkit does not allow integers, so these items need to be strings intervals = [0, 1, 2, 4] INTERVALS = [str(x) for x in intervals]