Rename ecocal to events and fix categories filtering (#2268)

* fix investpy categories filter

* change ecocal to events

* update website doc

* rewrite menu help test

* update menu command description

* update main.yml

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
This commit is contained in:
montezdesousa
2022-08-08 14:19:33 +01:00
committed by GitHub
parent 32c656b7f0
commit 9ff9d121a8
7 changed files with 62 additions and 64 deletions

2
i18n/en.yml vendored
View File

@@ -782,7 +782,7 @@ en:
economy/index: find and plot any (major) index on the market
economy/treasury: obtain U.S. treasury rates
economy/ycrv: show sovereign yield curves
economy/ecocal: display economic calendar
economy/events: display economic calendar
economy/plot: plot data from the above commands together
economy/rtps: real-time performance sectors
economy/valuation: valuation of sectors, industry, country

View File

@@ -64,7 +64,7 @@ class EconomyController(BaseController):
"industry",
"bigmac",
"ycrv",
"ecocal",
"events",
]
CHOICES_MENUS = ["pred", "qa"]
@@ -189,21 +189,21 @@ class EconomyController(BaseController):
c: None for c in investingcom_model.BOND_COUNTRIES
}
self.choices["ecocal"]["-c"] = {
self.choices["events"]["-c"] = {
c: None for c in investingcom_model.CALENDAR_COUNTRIES
}
self.choices["ecocal"]["--countries"] = {
self.choices["events"]["--countries"] = {
c: None for c in investingcom_model.CALENDAR_COUNTRIES
}
self.choices["ecocal"]["-i"] = {
self.choices["events"]["-i"] = {
c: None for c in investingcom_model.IMPORTANCES
}
self.choices["ecocal"]["--importances"] = {
self.choices["events"]["--importances"] = {
c: None for c in investingcom_model.IMPORTANCES
}
self.choices["ecocal"]["--cat"] = {
self.choices["events"]["--cat"] = {
c: None for c in investingcom_model.CATEGORIES
}
@@ -258,7 +258,7 @@ class EconomyController(BaseController):
mt.add_cmd("map", "Finviz")
mt.add_cmd("bigmac", "NASDAQ Datalink")
mt.add_cmd("ycrv", "Investing.com / FRED")
mt.add_cmd("ecocal", "Investing.com")
mt.add_cmd("events", "Investing.com")
mt.add_raw("\n")
mt.add_cmd("rtps", "Alpha Vantage")
mt.add_cmd("valuation", "Finviz")
@@ -1030,13 +1030,13 @@ class EconomyController(BaseController):
)
@log_start_end(log=logger)
def call_ecocal(self, other_args: List[str]):
"""Process ecocal command"""
def call_events(self, other_args: List[str]):
"""Process events command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="ecocal",
description="Economic calendar. If no start or end dates, default is the current day.",
prog="events",
description="Economic calendar. If no start or end dates, default is the current day high importance events.",
)
parser.add_argument(
"-c",
@@ -1091,9 +1091,6 @@ class EconomyController(BaseController):
if isinstance(ns_parser.country, list):
ns_parser.country = " ".join(ns_parser.country)
if ns_parser.categories:
ns_parser.categories = ns_parser.categories.replace("_", " ")
investingcom_model.check_correct_country(
ns_parser.country, investingcom_model.CALENDAR_COUNTRIES
)

View File

@@ -192,6 +192,6 @@ def display_economic_calendar(
export_data(
export,
os.path.dirname(os.path.abspath(__file__)),
"ecocal",
"events",
df,
)

View File

@@ -3,7 +3,7 @@
map S&P500 index stocks map [Finviz]
bigmac The Economist Big Mac index [NASDAQ Datalink]
ycrv show sovereign yield curves [Investing.com / FRED]
ecocal display economic calendar [Investing.com]
events display economic calendar [Investing.com]
rtps real-time performance sectors [Alpha Vantage]
valuation valuation of sectors, industry, country [Finviz]

View File

@@ -1,45 +0,0 @@
```
usage: ecocal [-c COUNTRY [COUNTRY ...]] [-i {high,medium,low,all}]
[-cat {Employment,Credit,Balance,Economic Activity,Central Banks,Bonds,Inflation,Confidence Index} [{Employment,Credit,Balance,Economic Activity,Central Banks,Bonds,Inflation,Confidence Index} ...]]
[-s START_DATE] [-e END_DATE] [-h] [--export EXPORT] [--raw]
```
Economic calendar.
```
optional arguments:
-c COUNTRY [COUNTRY ...], --country COUNTRY [COUNTRY ...]
Display calendar for specific country. (default: united states)
-i {high,medium,low,all}, --importances {high,medium,low,all}
Event importance classified as high, medium, low or all. (default: all)
-cat {employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} [{employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} ...], --categories {employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} [{employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} ...]
Event category. (default: None)
-s START_DATE, --start_date START_DATE
The start date of the data (format: YEAR-MONTH-DAY, i.e. 2010-12-31) (default: None)
-e END_DATE, --end_date END_DATE
The start date of the data (format: YEAR-MONTH-DAY, i.e. 2010-12-31) (default: None)
-h, --help show this help message (default: False)
--export EXPORT Export raw data into csv, json, xlsx (default: )
--raw Flag to display raw data (default: False)
```
Example:
```
2022 Jul 11, 16:55 (🦋) /economy/ $ ecocal -c united states -i medium -cat inflation -s 2022-06-15 -e 2022-07-01
Economic Calendar (GMT +1:00)
┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
┃ date ┃ time ┃ zone ┃ currency ┃ importance ┃ event ┃ actual ┃ forecast ┃ previous ┃
┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩
│ 15/06/2022 │ 14:30 │ united states │ USD │ medium │ Export Price Index (MoM) (May) │ 2.8% │ 1.3% │ 0.8% │
├────────────┼───────┼───────────────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 15/06/2022 │ 14:30 │ united states │ USD │ medium │ Import Price Index (MoM) (May) │ 0.6% │ 1.1% │ 0.4% │
├────────────┼───────┼───────────────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 29/06/2022 │ 14:30 │ united states │ USD │ medium │ GDP Price Index (QoQ) (Q1) │ 8.3% │ 8.1% │ 8.1% │
├────────────┼───────┼───────────────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 30/06/2022 │ 14:30 │ united states │ USD │ medium │ Core PCE Price Index (YoY) (May) │ 4.7% │ 4.8% │ 4.9% │
├────────────┼───────┼───────────────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 30/06/2022 │ 14:30 │ united states │ USD │ medium │ PCE Price index (YoY) (May) │ 6.3 │ │ 6.3 │
├────────────┼───────┼───────────────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 30/06/2022 │ 14:30 │ united states │ USD │ medium │ PCE price index (MoM) (May) │ 0.6% │ │ 0.2% │
└────────────┴───────┴───────────────┴──────────┴────────────┴───────────────────────────────────┴────────┴──────────┴──────────┘
```

View File

@@ -0,0 +1,46 @@
```
usage: events [-c COUNTRY [COUNTRY ...]] [-i {high,medium,low,all}] [--cat {employment,credit,balance,economic_activity,central_banks,bonds,inflation,confidence_index}]
[-s START_DATE] [-e END_DATE] [-h] [--export EXPORT] [--raw] [-l LIMIT]
```
Economic calendar. If no start or end dates, default is the current day high importance events.
```
optional arguments:
-c COUNTRY [COUNTRY ...], --country COUNTRY [COUNTRY ...]
Display calendar for specific country. (default: united states)
-i {high,medium,low,all}, --importances {high,medium,low,all}
Event importance classified as high, medium, low or all. (default: all)
-cat {employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} [{employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} ...], --categories {employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} [{employment,credit,balance,economic activity,central banks,bonds,inflation,confidence index} ...]
Event category. (default: None)
-s START_DATE, --start_date START_DATE
The start date of the data (format: YEAR-MONTH-DAY, i.e. 2010-12-31) (default: None)
-e END_DATE, --end_date END_DATE
The start date of the data (format: YEAR-MONTH-DAY, i.e. 2010-12-31) (default: None)
-h, --help show this help message (default: False)
--export EXPORT Export raw data into csv, json, xlsx (default: )
--raw Flag to display raw data (default: False)
-l LIMIT, --limit LIMIT
Number of entries to show in data. (default: 100)
```
Example:
```
2022 Aug 08, 09:41 (🦋) /economy/ $ events -c united states -i medium --cat inflation -s 2022-06-15 -e 2022-07-01
United States economic calendar (GMT +1:00)
┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
┃ Date ┃ Time ┃ Currency ┃ Importance ┃ Event ┃ Actual ┃ Forecast ┃ Previous ┃
┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━┩
│ 2022-06-15 │ 14:30 │ USD │ Medium │ Export Price Index (MoM) (May) │ 2.8% │ 1.3% │ 0.8% │
├────────────┼───────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 2022-06-15 │ 14:30 │ USD │ Medium │ Import Price Index (MoM) (May) │ 0.6% │ 1.1% │ 0.4% │
├────────────┼───────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 2022-06-29 │ 14:30 │ USD │ Medium │ GDP Price Index (QoQ) (Q1) │ 8.3% │ 8.1% │ 8.1% │
├────────────┼───────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 2022-06-30 │ 14:30 │ USD │ Medium │ Core PCE Price Index (YoY) (May) │ 4.7% │ 4.8% │ 4.9% │
├────────────┼───────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 2022-06-30 │ 14:30 │ USD │ Medium │ PCE Price index (YoY) (May) │ 6.3 │ │ 6.3 │
├────────────┼───────┼──────────┼────────────┼───────────────────────────────────┼────────┼──────────┼──────────┤
│ 2022-06-30 │ 14:30 │ USD │ Medium │ PCE price index (MoM) (May) │ 0.6% │ │ 0.2% │
└────────────┴───────┴──────────┴────────────┴───────────────────────────────────┴────────┴──────────┴──────────┘
```

View File

@@ -991,8 +991,8 @@ main:
ref: "/terminal/economy/yield"
- name: ycrv
ref: "/terminal/economy/ycrv"
- name: ecocal
ref: "/terminal/economy/ecocal"
- name: events
ref: "/terminal/economy/events"
- name: plot
ref: "/terminal/economy/plot"
- name: rtps