question

Upvotes
Accepted
1 2 1 1

problems with StreamingPrices object's "open()" method

Hi,

I was trying to use eikon's streaming prices function via Python API.

I simply copy and paste github's tutorial code as following on my jupyter and spyder:

streaming_prices = ek.StreamingPrices(

instruments = ['GBP=','JPY=', 'CAD='],

fields = ['CF_BID','CF_ASK','OPEN_PRC', 'CF_HIGH','CF_LOW', 'CF_CLOSE'] )

streaming_prices.open()


but both IDE can't finish running "open()" function.

Does anyone have the same problem?

My conda version is 4.4.10 and eikon API version is 1.1.2.

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apistreaming-prices
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
Accepted
18.2k 21 13 21

Hi @lawrence.chiang

I just tested the code and it works fine for me:

So I checked a little bit on your profile but I could not find Thomson Reuters Eikon product associated with your profile.

Anyway, I can confirm that the API call is valid.

Are you able to retrieve snapshot data using get_data() ?

df,e = ek.get_data(['GBP=','JPY=','CAD='],
                   ['CF_BID','CF_ASK','OPEN_PRC','CF_HIGH','CF_LOW','CF_CLOSE'])
df



ahs.png (25.8 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.

Thank you

I can run your code and output is as follow:

Instrument CF_BID CF_ASK OPEN_PRC CF_HIGH CF_LOW CF_CLOSE

0 GBP= 1.2788 1.2792 1.2810 1.2830 1.2781 1.2810

1 JPY= 107.3900 107.4200 107.1200 107.6800 106.8600 107.1200

2 CAD= 1.3356 1.3357 1.3382 1.3387 1.3344 1.3385


so i think my eikon api runs fine except for streaming prices function?

or is it because i shouldn't use jupyter to run streaming price function?

thanks for your help!


Hello @lawrence.chiang,

Streaming prices example runs in jupiter notebook.

Please note, it does not immediately return with result on Open, it takes a pause before I see the output.

In jupiter, something else may be already running, and preventing. May be worthwhile to restart the kernel on the page, and to re-run beginning from the first step of the example: connection, api key, session, then open.

Hope this helps.

Hi @lawrence.chiang

The code works on Jupyter notebook.

But please do as @zoya.farberov suggested.

Restart the notebook before running the code

def display_fields(streaming_prices, instrument_name, fields):
    print("Fields received for", instrument_name, ":", fields)

streaming_prices = ek.StreamingPrices(
    instruments = ['EUR=','GBP=','JPY=', 'CAD='], 
    fields   = ['SALTIM', 'CF_BID','CF_ASK','OPEN_PRC', 'CF_HIGH','CF_LOW', 'CF_CLOSE'],
    on_refresh = lambda streaming_prices, instrument_name, fields : 
        display_fields(streaming_prices, instrument_name, fields),
    on_update = lambda streaming_prices, instrument_name, fields : 
        display_fields(streaming_prices, instrument_name, fields)
)
streaming_prices.open()


ahs.png (56.3 KiB)
Upvotes
32.2k 41 11 20

Hello @lawrence.chiang,

In addition to the info from @chavalit.jintamalit,

1. I would confirm you are on the new version of Eikon library,by upgrading to the latest:

python -m pip install --upgrade eikon

2. Make sure your Eikon desktop is running and you are logged in and no errors are reported by Eikon desktop.

3. Next, would also, right after you include eikon, at the very beginning of tutorial code, confirm that your Jupiter, and environment are in a good state by doing

import eikon as ek
import datetime
print(ek.__version__)

You should see your library version printed.

If you do not, it is environment and not this specific code, would close any browsers, restart Jupiter, make sure you are in a clean state and then re-run.

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.

Thank you!

I already update my eikon library to 1.1.2

the out put of print(ek.__version__) is 1.1.2

Upvotes
1 1 1 2

Hello team,

I 'm having the same issue and done all the checks,

This method seems just not running.

I had it complete once (returning open:3) but got only Nans in values,

Can someone help?

Thanks,

Mahjoub

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.

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.