Eikon API for MACD(Moving Average) chart data

Hi Team,

I am deciding whether I should go for Eikon API.

Basically we would like to obtain the 5minute/3minute/1day MACD (moving average) chart data programatically on request basis.

Is Eikon API feasible to do that?

Thanks very much.

Cheers,

Juno

Best Answer

  • Zhenya Kovalyov
    Answer ✓

    @Juno Chan there are no pre-calculated intraday MACD values, and the pre-calc ones are a snapshot, rather than time series:

    import pandas as pd
    import eikon as tr

    tr.set_app_id('your_eikon_id')

    aapl_daily_macd, err = tr.get_data(['AAPL.O'],
    ['TR.MovAvgCDLine1.date','TR.MovAvgCDLine1','TR.MovAvgCDLine2','TR.MovAvgCDSignal'])
    aapl_daily_macd

    image

    As for the intraday, you can calculate it with the standard pandas tools, as get_timeseries() returns a pandas.Dataframe. The intervals that are supported are 'tick', 'minute', 'hour', 'daily', 'weekly', 'monthly', 'quarterly', 'yearly'.

    aapl_1_min = tr.get_timeseries(['AAPL.O'], ['TIMESTAMP', 'CLOSE'],interval='minute', start_date='2018-02-01', end_date='2018-02-02')

    aapl_1_min_ewm_fast = aapl_5_min.ewm(span=12, min_periods=1).mean()
    aapl_1_min_ewm_slow = aapl_5_min.ewm(span=26, min_periods=1).mean()

    aapl_1_min_macd = pd.DataFrame(aapl_1_min_ewm_fast-aapl_1_min_ewm_slow)

    image

    You can resample 1 min series to get 3 and 5 mins with pandas.Series.resample().

Answers