mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-13 21:02:13 +00:00
fix fred helpers
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import csv
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import List, Literal
|
||||
|
||||
CPI_COUNTRIES = Literal[
|
||||
@@ -61,8 +63,10 @@ CPI_FREQUENCY = Literal["monthly", "quarterly", "annual"]
|
||||
def all_cpi_options(harmonized: bool = False) -> List[dict]:
|
||||
data = []
|
||||
|
||||
current_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
file = "harmonized_cpi.csv" if harmonized else "cpi.csv"
|
||||
with open(file, encoding="utf-8") as csv_file_handler:
|
||||
|
||||
with open(Path(current_dir, file), encoding="utf-8") as csv_file_handler:
|
||||
csv_reader = csv.DictReader(csv_file_handler)
|
||||
for rows in csv_reader:
|
||||
row = {key.lstrip("\ufeff"): value for key, value in rows.items()}
|
||||
|
||||
Reference in New Issue
Block a user