Tutorial oandapyV20

Installing oandapyV20

Installing oandapyV20 from pypi:

$ pip install oandapyV20

Tests

If you want to run the tests, clone the repository:

$ git clone https://github.com/hootnot/oanda-api-v20
    $ cd oanda-api-v20

    # install necessary packages for testing
    $ grep "\- pip install" .travis.yml |
    > while read LNE
    > do `echo $LNE| cut -c2-` ; done

    $ python setup.py test
    $ python setup.py install

Jupyter

To use this Jupyter notebook you need to install Jupyter:

$ pip install jupyter

See, http://jupyter.org/install.html for all details regarding Jupyter.

When installed you can start Jupyter from the cloned repo directory:

$ cd jupyter
# provide your V20-accountID and token by editing account.txt and token.txt
$ jupyter notebook
# ... will launch your brouwser with the notebook tree structure.

Examples

Examples are provided in the https://github.com/hootnot/oandapyV20-examples repository.

Design

The design of the oandapyV20 library differs from the library covering the REST-V1 interface: https://github.com/oanda/oandapy (oandapy), which is based on 'mixin' classes.

Client

The V20-library has a client class (API) which processes all APIRequest objects. Status and response are properties of the request and are assigned by the client when performing the request. The response is also returned by the client.

Requests

In the V20-library endpoints are represented as APIRequest objects derived from the APIRequest base class. Each endpoint group (accounts, trades, etc.) is represented by it's own (abstract) class covering the functionality of all endpoints for that group. Each endpoint within that group is covered by a class derived from the abstract class.

oandapyV20 step by step