Streaming real-time sample

I have tried to use the code in the Streaming real time data tutorial, as follows:

image

But as you can see, it gives me an error message. Can someone help me solve the problem?

I have just upgraded to version 1.1.6.post2. The get_snapshot function works as expected...

Best Answer

  • Hi,

    Your code is incorrect : a ')' left before streaming_prices.open()

    Otherwise, I can run it on my side:

    imageI assume that there is an hidden escape character that causes invalid syntax.

    You can copy/paste from following block :

    streaming_prices = ek.StreamingPrices(
        instruments = ['LCOc1', 'CLc1'],
        fields = ['CF_TIME', 'CF_BID', 'CF_ASK', 'OPEN_PRC', 'CF_HIGH', 'CF_LOW', 'CF_CLOSE'],
        on_refresh = lambda st, inst, fields : display_fields(st, inst, fields),
        on_update = lambda st, inst, fields : display_fields(st, inst, fields))
    streaming_prices.open()


Answers

  • Thanks Pierre - you found the error... all working now. Incidentally, I copied the code from the tutorial, so the error is there...