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

  • @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

  • Thanks @Zhenya Kovalyov for the python implementation. Is this based on the "Eikon API Proxy Beta"?

    On the other hand, also seeing there is a .NET version of Eikon API getting time series of 1minute/30minute/daily. Could the 1minute intraday also be resampled to 5minute interval?

    Just would like to compare the implementations between both .net and python.

    Cheers,

    Juno

  • You can resample any 1-min or tick data into any evenly spaced interval, it is simpler in python in my opinion, as the tool set for working with data is much reacher with the pandas data frame, however there is a bunch of examples how to do it in .net as well (for example, this). I would use python, as it also has access to the fundamental data API, something that the legacy .NET API will not get.