question

Upvotes
Accepted
7 1 0 2

REDI API L1 Stream

Hello Community,

This question is related to REDI API Python application on Windows using win32com.

I've been trying to stream L1 pricing data for a single instrument but keep getting the following error message. Would appreciate any guidance you may be able to offer. Thank you, Berat Pehlivanoglu.

(mach) PS C:\code\redi> & C:/Users/BeratPehlivanoglu/anaconda3/envs/mach/python.exe "c:/code/redi/Market Data Subscriber.py"

Traceback (most recent call last):

  File "C:\Users\BeratPehlivanoglu\anaconda3\envs\mach\lib\site-packages\win32com\client\dynamic.py", line 86, in _GetGoodDispatch

    IDispatch = pythoncom.connect(IDispatch)

pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "c:\code\redi\Market Data Subscriber.py", line 37, in <module>

    q = win32com.client.Dispatch("REDI.CacheControl")

  File "C:\Users\BeratPehlivanoglu\anaconda3\envs\mach\lib\site-packages\win32com\client\__init__.py", line 117, in Dispatch

    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch, userName, clsctx)

  File "C:\Users\BeratPehlivanoglu\anaconda3\envs\mach\lib\site-packages\win32com\client\dynamic.py", line 106, in _GetGoodDispatchAndUserName

    return (_GetGoodDispatch(IDispatch, clsctx), userName)

  File "C:\Users\BeratPehlivanoglu\anaconda3\envs\mach\lib\site-packages\win32com\client\dynamic.py", line 88, in _GetGoodDispatch

    IDispatch = pythoncom.CoCreateInstance(

pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

I have no issues when requesting L1 data;

(mach) PS C:\code\redi> & C:/Users/BeratPehlivanoglu/anaconda3/envs/mach/python.exe c:/code/redi/l1.py
2023-01-31 11:36:56 Symbol=135.30 Last=IBM success=True
2023-01-31 11:36:56 Symbol=20.07 Ask=T success=True
2023-01-31 11:36:56 Symbol=207.20 Bid=BA success=True
2023-01-31 11:36:56 Symbol=207.20 InvalidSymbol=InvalidSymbol success=False
(mach) PS C:\code\redi> 

or when sending an order;

(mach) PS C:\code\redi> & C:/Users/BeratPehlivanoglu/anaconda3/envs/mach/python.exe "c:/code/redi/Order Entry - Equities & Futures.py"
True
win32com.client.VARIANT(16396, None)
(mach) PS C:\code\redi> 
#technology#productredi-apistreaming-priceswin32
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
78.1k 246 52 72

@beratp1

Thanks for reaching out to us.

According to this discussion, in Python, you will be able to consume L1 via get. CacheControl is not supported in Python.

Basic Python example code can be found on GitHub: https://github.com/Refinitiv-API-Samples/Example.REDI.Python.BasicExamples.

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
7 1 0 2

Hi @Jirapongse,

I had been working on the attached code sample that was available in the FTP site: sftp.redi.com. Attaching the file for your review. Abandoning the CacheControl route on Python, will explore the GetL1Value route to stream and circle back.

Thank you.

MarketDataSubscriber_text.txt


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
78.1k 246 52 72

l1py.txt (1.4 KiB)
1675242623893.png (19.5 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
7 1 0 2

@Jirapongse, I have run this code and have received the same response. Is there a line that could keep say Last for Symbol=IBM streaming on either an as updated basis or a certain period to be specified, say every 1 minute.

Thanks.

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
7 1 0 2
symbolVar.value = "IBM"
ret = q.GetL1Value(symbolVar, "Last", tgtVarName)
print(strftime("%Y-%m-%d %H:%M:%S", gmtime()) + " Symbol=" + tgtVarName.value + " Last" + "=" + str(symbolVar.value) + " success=" + str(ret))

This is the line I'm looking to keep getting the value as the price changes.

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.