question

Upvotes
Accepted
1 0 0 0

From VBA to Python

Years ago I programmed some macros in Eikon that capture and save in a folder on his PC hard disk the graphs of about 200 RICs (stocks, indices, currencies, etc.). They are graphs that have studies, annotations, trend lines, Fibonacci, and that are generated in daily and weekly format. The macros convert all the graphics in his Eikon quotelists one by one to jpg format, and are the ones that are saved to a folder daily. Now I have Workspace, and I have been told that WS doesn't suppor VBA, but Python.How can I convert my VBA macros into Python? I would really appreciate if somebody could guide me, as I don't know Pyhton....

#productvbaworkspace-upgrade
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
6.9k 21 3 6

For such a workflow, I would advise using the Refinitiv Data Library for Python in CodeBook. I’d advise starting with the articles “Summary of Common LSEG Refinitiv APIs” and “WEBINAR Beginners' Guide to Python and the London Stock Exchange Refinitiv Data Library”. You might then be interested in building an app using functions shown in the “13. User Interface Library” folder:

1723110893777.png

You can plot graphs with Plotly in CodeBook and you can even build Voila apps.


1723110893777.png (103.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.

Upvote
19k 85 39 63

Hi @jurraca

I would suggest you review the pages under the Upgrading to Workspace within the Developer Portal.

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

hi @nick.zincone . I did, but honestly, the solution that I have been provided with is reprogramming my VBA macros into Python. And the issue is that I don't know anything about Python.

It would be great if somebody could illustrate and guide me: I could check my VBA macros and how to adopt them to Python with this person that would be willing to help me.

Thank you so much if someone here could help.

Juan

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

Thanks for your answer, @jonathan.legrand. I really appreciate it. But honestly, I haven't been able to find out how to save a chart as image from Workspace in another folder, I don't know where it can be or how I can do it (and believe me I have tried hard). Any idea/input/suggestion?

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 @jurraca, I understand, it can be overwhelming switing to a new coding environment.


As an example, I thought it best to use a piece I wrote in the __Examples__ folder in CodeBook, specifically "__Examples__/03. Quantitative Analytics/03.08. Curves/Cross_Currency_Curves.ipynb".

In this example, if you run all but the last cell (that closes your session which you need opened to create a curve), you can choose the currency pair you'd like to choose a curve for, along with details you can choose in drop downs:

1723634543013.png


If you place your cursor anywhere in the red box I drew in the screenshot above, a menu appears at the top right. You can choose there to download the image as an image if you choose to:


1723634612664.png


Note that this is only one of many ways to get an image out of your code, you can programmatically ask for images to be outputted using, for e.g., Matplotlib.


1723634543013.png (87.7 KiB)
1723634612664.png (4.8 KiB)

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.