Hey there QC

I want to develop (python) code for the well known forex triangle arbitrage strategy, e.g.:


The goal is to use forex triangular arbitrage to teach some of my students about shortest path algorithms. 

I am still relatively new to QC (and algorithmic trading): I can see how one can purchase and hold certain currency pairs, but I cannot see how these trades converts into ownership of foreign currency, with which to continue the arbitrage path. 

So, more specifically, can you let me know how I can:

1) buy foreign currencies (and see how much of these currencies I hold)

2) purchase foreign currencies using a chosen currency that I hold (i.e. not always USD).

For example, I know how to purchase USD/EUR and then sell it, but I don’t know how to buy EUR using USD, and then use that EUR to buy GBP say.

Thanks so much