Ejemplo n.º 1
0
def test_investpy_news():
    """
    This function checks that investpy news retrieval functionality works as expected.
    """

    params = [
        {
            'time_zone': None,
            'time_filter': 'time_only',
            'countries': ['spain', 'france'],
            'importances': ['high', 'low'],
            'categories': ['credit', 'employment'],
            'from_date': None,
            'to_date': None
        },
        {
            'time_zone': 'GMT -3:00',
            'time_filter': 'time_only',
            'countries': None,
            'importances': None,
            'categories': None,
            'from_date': '01/01/2020',
            'to_date': '01/02/2020'
        }
    ]

    for param in params:
        investpy.economic_calendar(time_zone=param['time_zone'],
                              time_filter=param['time_filter'],
                              countries=param['countries'],
                              importances=param['importances'],
                              categories=param['categories'],
                              from_date=param['from_date'],
                              to_date=param['to_date'])
Ejemplo n.º 2
0
# Economic Calendar
# investpy_economic_calendar_us_20000101_20220215 = investpy.economic_calendar(
#     countries=["united states"], from_date="01/01/2000", to_date="15/02/2022")
# investpy_economic_calendar_us_20000101_20220215.to_pickle('./Market_Watch_Data/investpy_economic_calendar_us_20000101_20220215.pkl')

# # Economic Calendar US (20000101~20220131)
# investpy_economic_calendar_us_20000101_20220131 = investpy.economic_calendar(
#     countries=["united states"], from_date="01/01/2000", to_date="31/01/2022")
# investpy_economic_calendar_us_20000101_20220131.to_pickle('./Market_Watch_Data/investpy_economic_calendar_us_20000101_20220131.pkl')

# Economic Calendar US (20000101~20220131)
investpy_economic_calendar_us_20000101_20220131 = \
    pd.read_pickle('./Market_Watch_Data/investpy_economic_calendar_us_20000101_20220131.pkl')

# Economic Calendar US (20220201~Current)
investpy_economic_calendar_us_20220201_current = investpy.economic_calendar(
    countries=["united states"], from_date="01/02/2022", to_date=DD_END_DATE)
investpy_economic_calendar_us_20220201_current.to_pickle(
    './Market_Watch_Data/investpy_economic_calendar_us_20220201_current.pkl')

# Economic Calendar US 합치기
investpy_economic_calendar_us = pd.concat([
    investpy_economic_calendar_us_20000101_20220131,
    investpy_economic_calendar_us_20220201_current
])

# 데이터 저장
investpy_economic_calendar_us.to_pickle(
    './Market_Watch_Data/investpy_economic_calendar_us.pkl')

########################################################################################################################
# investpy 패키지를 사용하여 MSCI 자료 업데이트 받기