API freightOS 40' Container Rates data via python

I'm interested in API'ing freightOS 40' Container Rates data via python.

Line of code: data, err = eikon.get_data(ric, fields, params)

Prior to calling eikon.get_data, I define ric, fields, and params immediately below.

ric = 'FREIGHTOS-CN-USWC'

fields = ['RHistory.LAST_QUOTE.Timestamp', 'RHistory.LAST_QUOTE.Close']

params= {'SDate': start_date, 'EDate': lastMonth, 'INTERVAL': '1MO', 'Ch': 'Fd', }

start_date = '1979-12-31'

lastMonth = '2021-10-31'

I have also tried setting fields equal to what is found immediately below, however, that does not help. fields = ['LAST_QUOTE.Timestamp', 'LAST_QUOTE.Close']

Tagged:

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @Alex.ottrisk

    The get_data method can't get the RHistory fields. It can be used to get Real-Time & Fundamentals fields which are the same fields as the =TR Excel function. 1636435879368.png

    Please try the get_timeseries method instead.

    df = ek.get_timeseries('FREIGHTOS-CN-USWC',
    start_date = '1979-12-31T00:00:00',
    end_date = '2021-10-31T00:00:00',
    fields = ['CLOSE'],
    interval = 'monthly')

    The output is:

    1636436260410.png