Connect to the OANDA API

After you did setup your cloud environment including IPython/ Jupyter you are able to make the next steps.

Be sure that IPython is started and accessible. Perhaps you need to open a port on the firewall so that you can connect to IPython from anywhere. The default port is 9999.

But before you call OANDA API functions, there are still some prerequisites that need to be met. But luckily you can do everything from within IPython.

The first step is to obtain the python OANDA api wrapper and then configure your OANDA credentials. You can generate a token in the OANDA webinterface after you log in. Be sure to use a practice account for your first experiments.

And finally you need to do the import.

Those first three steps are shown on this IPython screenshot:


Now you're ready to connect to the API and play around with it to see if everything works as expected.

In my example I fetch a list of all instruments that are available for trading with OANDA, print a filtered list of instruments I'm interested in and then print the ask/ bid price of Gold (XAU/USD).

Write a comment

Comments: 0