Key error: 'eikon'

Just starting out using the API and ran into a Key Error issue

My code is below:

import eikon as ek

import configparser as cp

import cufflinks as cf

cfg = cp.ConfigParser()

cfg.read('eikon.cfg')

ek.set_app_key(cfg['eikon']['*This is my app key*'])

rics = ['JKMc1','TRGBNBPMc1']

print(rics)

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @vincent.turner

    It looks like to be the error message from the configparser library.

    From my testing, the eikon.cfg should have the following entries:

    [eikon]
    appkey = <appkey>

    Please replace the <appkey> with your application key.

    Then, the appkey can be used in the ek.set_app_key method with the following code.

    cfg = cp.ConfigParser()
    cfg.read('eikon.cfg')
    ek.set_app_key(cfg['eikon']['appkey'])