Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
36 0 0 2

get_history stopped working in API (Visual code studio)

Hi, since few weeks ( not sure but I think after upgrading some python libraries like pandas etc.) I have problems with getting data using refinitive API in Visual code studio.

for example I get empty df with this simple code:

import pandas as pd

import refinitiv.data as rd

rd.open_session()

rd.get_history(universe="LSEG.L")


and warning:

c:\Users\tpm20\AppData\Local\Programs\Python\Python310\lib\site-packages\refinitiv\data\_tools\_dataframe.py:188: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)` df.fillna(np.nan, inplace=True)

on the other hand code:

rd.get_history(universe="LSEG.L", fields='BID') is working very well as always

LSEG.LBIDDate

2024-03-2696662024-03-2795922024-03-2894902024-04-0294222024-04-039356


Any idea how can I fix it?

#technologyrefinitiv-data-platformpython apipandas
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
36 0 0 2

SOLVED !!!

the problem refers to old refinitiv.data modul = ver. 1.0.0 (interesting because I am sure I upgraded it lately)

thank you @nick.zincone very much for your help



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
17.5k 82 39 63

Hi @Przemyslaw.Miedziocha

I just ran the following code within VS Code:

import pandas as pd

import refinitiv.data as rd

rd.open_session("desktop.workspace")

result = rd.get_history(universe="LSEG.L")
print(f"Result: [{result}]")

My environment:

  • Python: 3.10.8
  • pandas: 2.2.2
  • refinitiv-data: 1.6.0

And did see the same warning, but did receive data:

1714003572577.png



1714003572577.png (81.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
36 0 0 2

Thank you for your reply.

I used your code and again got nothing:

Result: [Empty DataFrameColumns: []Index: []]

c:\Users\tpm20\AppData\Local\Programs\Python\Python310\lib\site-packages\refinitiv\data\_tools\_dataframe.py:188: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)` df.fillna(np.nan, inplace=True)

There is one extra part in my warning - df.fillna(np.nan, inplace=True) - which can make a difference.



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
36 0 0 2

what is interesting api log shows that some data is appearing but finnal df still empty:

[2024-04-25T10:56:46.878205+02:00] - [DEBUG] - [sessions.desktop.workspace.7] - [22444] | HistoricalRequestThread_0

HTTP Response id 38

status_code = 200

text = [{"universe":{"ric":"LSEG.L"},"interval":"P1D","summaryTimestampLabel":"endPeriod","adjustments":["exchangeCorrection","manualCorrection","CCH","CRE","RTS","RPO"],"defaultPricingField":"OFF_CLOSE","qos":{"timeliness":"delayed"},"headers":[{"name":"DATE","type":"string"},{"name":"TRDPRC_1","type":"number","decimalChar":"."},{"name":"MKT_HIGH","type":"number","decimalChar":"."},{"name":"MKT_LOW","type":"number","decimalChar":"."},{"name":"ACVOL_UNS","type":"number","decimalChar":"."},{"name":"MKT_OPEN","type":"number","decimalChar":"."},{"name":"BID","type":"number","decimalChar":"."},{"name":"ASK","type":"number","decimalChar":"."},{"name":"TRNOVR_UNS","type":"number","decimalChar":"."},{"name":"VWAP","type":"number","decimalChar":"."},{"name":"MID_PRICE","type":"number","decimalChar":"."},{"name":"PERATIO","type":"number","decimalChar":"."},{"name":"ORDBK_VOL","type":"number","decimalChar":"."},{"name":"NUM_MOVES","type":"number","decimalChar":"."},{"name":"IND_AUCVOL","type":"number","decimalChar":"."},{"name":"OFFBK_VOL","type":"number","decimalChar":"."},{"name":"HIGH_1","type":"number","decimalChar":"."},{"name":"ORDBK_VWAP","type":"number","decimalChar":"."},{"name":"IND_AUC","type":"number","decimalChar":"."},{"name":"OPEN_PRC","type":"number","decimalChar":"."},{"name":"LOW_1","type":"number","decimalChar":"."},{"name":"OFF_CLOSE","type":"number","decimalChar":"."},{"name":"CLS_AUCVOL","type":"number","decimalChar":"."},{"name":"OPN_AUCVOL","type":"number","decimalChar":"."},{"name":"OPN_AUC","type":"number","decimalChar":"."},{"name":"CLS_AUC","type":"number","decimalChar":"."},{"name":"TRD_STATUS","type":"number","decimalChar":"."},{"name":"INT_AUC","type":"number","decimalChar":"."},{"name":"INT_AUCVOL","type":"number","decimalChar":"."},{"name":"EX_VOL_UNS","type":"number","decimalChar":"."},{"name":"ALL_C_MOVE","type":"number","decimalChar":"."},{"name":"ELG_NUMMOV","type":"number","decimalChar":"."},{"name":"NAVALUE","type":"number","decimalChar":"."}],"data":[["2024-04-24",8860.147,9052,8762,1338681,8998,8808,8812,11820244429.40194,8829.758,8810,64.8364,865581,7681,548485,473100,9012,8823.991,8808,8998,8762,8808,548485,6090,8998,8808,1,null,null,1338683,7681,7091,null], ["2024-04-23",8998.9,9240,8992,2413323,9200,8998,9000,22040067506.38,9132.487,8999,65.5714,772619,6888,440603,1606173,9240,9044.493,8998,9200,8992,8998,440603,14524,9200,8998,1,null,null,2413325,6888,6425,null], ["2024-04-22",9083.427,9139.676,8930,1009645,8930,9100,9106,9183192475.57088,9095.4272,9103,64.7356,498208,5697,301848,511437,9138,9097.946,9100,9084,9050,9100,301848,9259,9084,9100,1,null,null,1009649,5697,5229,null], ["2024-04-19",8983.371,9020,8930,3657198,9000,8984,8986,32894471518.62,8993.008,8985,65.1102,490843,4284,298794,2415525,9010,8978.325,8984,9000,8930,8984,298794,5941,9000,8984,1,8960,28266,3657199,4284,3954,null], ["2024-04-18",9044.09,9186,9000,1407522,9100,9036,9038,12765653998.72,9069.594,9037,65.7876,375837,3310,249992,1031239,9100,9038.059,9036,9100,9002,9036,249992,4695,9100,9036,1,null,null,1407523,3310,2866,null], ["2024-04-17",9176.273,9208,9054,586736,9114,9128,9130,5359882247.19534,9135.0332,9129,65.9461,333856,2598,220813,252880,9192,9134.105,9130,9114,9106,9130,220813,5355,9114,9130,1,null,null,586739,2598,2216,null], ["2024-04-16",9177.358,9230,9108,3220578,9222,9152,9154,29574825722.75222,9183.073,9153,66.7964,666754,6611,383453,2553824,9226,9157.907,9152,9222,9108,9152,383453,7834,9222,9152,1,null,null,3220580,6611,6264,null], ["2024-04-15",9283.343,9336,9226,737056,9300,9270,9272,6836306978.72838,9275.1229,9271,67.1134,413581,3323,297059,323475,9336,9273.835,9270,9300,9226,9270,297059,7767,9300,9270,1,null,null,737058,3323,3032,null], ["2024-04-12",9309.672,9366,9280,678949,9328,9314,9316,6323120477.57,9313.0032,9315,67.0558,543810,4919,354066,135139,9366,9313.783,9314,9328,9280,9314,354066,7760,9328,9314,1,null,null,678956,4919,4500,null], ["2024-04-11",9269.416,9342,9214,746957,9280,9306,9308,6938812855.07038,9289.4155,9307,66.7964,514355,6424,262117,232602,9336,9290.712,9306,9280,9240,9306,262117,2523,9280,9306,1,null,null,746959,6424,6037,null], ["2024-04-10",9267.459,9280,9130,1388237,9160,9268,9270,12821526632.31734,9235.818,9269,66.2199,696641,6304,403274,691596,9280,9246.973,9270,9160,9160,9270,403274,8348,9160,9270,1,null,null,1388239,6304,5942,null], ["2024-04-09",9197.31,9254,9166,1943305,9238,9190,9194,17909452024.52,9217.047,9192,66.5514,703999,5520,401270,1239306,9252,9198.364,9190,9238,9166,9190,401270,7198,9238,9190,1,null,null,1943308,5520,5135,null], ["2024-04-08",9247.802,9372,9166,1058177,9362,9236,9238,9816934349.93542,9277.195,9237,67.5746,559066,7139,257740,499111,9364,9246.285,9236,9362,9166,9236,257740,8308,9362,9236,1,null,null,1058179,7139,6741,null], ["2024-04-05",9375.981,9472,9288,2933895,9340,9376,9378,27464419966.36,9361.075,9377,67.834,709647,5928,437594,2224248,9412,9373.979,9378,9340,9288,9378,437594,12199,9340,9378,1,null,null,2933896,5928,5596,null], ["2024-04-04",9378,9442,9314,846510,9374,9414,9418,7962872446.91,9406.6336,9416,67.4449,583348,3795,396101,259043,9442,9410.364,9414,9374,9314,9414,396101,9662,9374,9414,1,null,null,846512,3795,3463,null], ["2024-04-03",9312.622,9414,9300,943311,9398,9356,9360,8825788206.20178,9356.1803,9358,67.906,749113,4708,489300,194198,9414,9357.486,9360,9398,9300,9360,489300,8704,9398,9360,1,null,null,943311,4708,4356,null], ["2024-04-02",9436.688,9548,9368,1745847,9430,9422,9424,16498184637.78,9439.326,9423,68.3816,862813,6553,416842,485752,9530,9433.227,9424,9486,9368,9424,416842,36885,9486,9424,1,null,null,1745849,6553,5861,null], ["2024-03-28",9497.715,9650,9464,1134820,9526,9490,9496,10782978885.6196,9501.914,9493,69.1166,895460,6522,570328,239360,9600,9501.613,9490,9588,9464,9490,570328,11699,9588,9490,1,null,null,1134822,6522,6001,null], ["2024-03-27",9676,9696,9590,1849869,9676,9592,9594,17848377506.82416,9648.442,9593,69.7075,503647,4268,273610,1346222,9696,9614.04,9592,9676,9590,9592,273610,12488,9676,9592,1,null,null,1849871,4268,3778,null], ["2024-03-26",9598,9674.484,9520,2062076,9588,9666,9674,19906429850.22,9642.835,9670,69.0157,669774,4063,435726,679375,9674,9657.587,9674,9588,9532,9674,435726,12753,9588,9674,1,null,null,2229725,4064,3735,null]],"meta":{"blendingEntry":{"headers":[{"name":"DATE","type":"string"},{"name":"TRDPRC_1","type":"number","decimalChar":"."},{"name":"MKT_HIGH","type":"number","decimalChar":"."},{"name":"MKT_LOW","type":"number","decimalChar":"."},{"name":"ACVOL_UNS","type":"number","decimalChar":"."},{"name":"MKT_OPEN","type":"number","decimalChar":"."},{"name":"BID","type":"number","decimalChar":"."},{"name":"ASK","type":"number","decimalChar":"."},{"name":"TRNOVR_UNS","type":"number","decimalChar":"."},{"name":"VWAP","type":"number","decimalChar":"."},{"name":"MID_PRICE","type":"number","decimalChar":"."},{"name":"PERATIO","type":"number","decimalChar":"."},{"name":"ORDBK_VOL","type":"number","decimalChar":"."},{"name":"NUM_MOVES","type":"number","decimalChar":"."},{"name":"IND_AUCVOL","type":"number","decimalChar":"."},{"name":"OFFBK_VOL","type":"number","decimalChar":"."},{"name":"HIGH_1","type":"number","decimalChar":"."},{"name":"ORDBK_VWAP","type":"number","decimalChar":"."},{"name":"IND_AUC","type":"number","decimalChar":"."},{"name":"OPEN_PRC","type":"number","decimalChar":"."},{"name":"LOW_1","type":"number","decimalChar":"."},{"name":"OFF_CLOSE","type":"number","decimalChar":"."},{"name":"CLS_AUCVOL","type":"number","decimalChar":"."},{"name":"OPN_AUCVOL","type":"number","decimalChar":"."},{"name":"OPN_AUC","type":"number","decimalChar":"."},{"name":"CLS_AUC","type":"number","decimalChar":"."},{"name":"TRD_STATUS","type":"number","decimalChar":"."},{"name":"INT_AUC","type":"number","decimalChar":"."},{"name":"INT_AUCVOL","type":"number","decimalChar":"."},{"name":"EX_VOL_UNS","type":"number","decimalChar":"."},{"name":"ALL_C_MOVE","type":"number","decimalChar":"."},{"name":"ELG_NUMMOV","type":"number","decimalChar":"."},{"name":"NAVALUE","type":"number","decimalChar":"."}],"data":[["2024-04-24",8860.147,9052,8762,1338681,8998,8808,8812,11820244429.40194,8829.758,8810,64.8364,865581,7681,548485,473100,9012,8823.991,8808,8998,8762,8808,548485,6090,8998,8808,1,null,null,1338683,7681,7091,null]]}}}]

Result: [Empty DataFrame

Columns: []

Index: []]


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @Przemyslaw.Miedziocha

Can you provide the versions of the modules within your environment? If not already, can you ensure you are using the latest version of the Refinitiv-data library?

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.