Oanda REST-v20 API wrapper
==========================

|PyPI latest| |PyPI Version| |Coverage Status| |Travis Build Status| |Code Health| |PyPI License|


OVERVIEW
--------

`OANDAPY <https://github.com/rhenter/oandapy>`_ is a python3 wrapper for Oanda's REST API v20.
This library currently implements the features released under `version 3.0.1 <http://developer.oanda.com/rest-live-v20/release-notes/>`_ of OANDA's REST API.

Head over to `OANDA's REST API v20 docs <http://developer.oanda.com/rest-live-v20/introduction>`_ to go through their documentation.
This repository start on fork from Gustavo Ferreira and have a massive change later

Requirements
------------

This project requires:

    * Python 3.4 or earlier
    * git client
    * virtualenvwrapper/virtualenv for local development


Installation
------------

.. code-block:: bash

    $ pip install oandapy

Or, you can download the source and

.. code-block:: bash

    $ git clone git@github.com:rhenter/oandapy.git
    $ cd oandapy
    $ python setup.py install

USAGE
-----

1. Create a account on `<https://www.oanda.com>`_ to get a API Access Token.
2. Import the oandapy module and create an instance with your access token:

.. code-block:: python

    from oandapy import APIv20
    from oandapy.exceptions import OandaError

    access_token = ""
    con = APIv20(environment="practice", access_token=access_token)

    try:
      result = con.account.get_accounts().as_obj()

      for acc in result.accounts:
        print(acc.aid)
    except oanda.OandaError as exc:
      print(str(exc))



Contributing
------------

Please send pull requests, very much appreciated.


1. Fork the `repository <https://github.com/rhenter/oandapy>`_ on GitHub.
2. Create a virtualenv.
3. Install requirements. ``pip install -r requirements-dev.txt``
4. Install pre-commit. ``pre-commit install``
5. Make a branch off of master and commit your changes to it.
6. Create a Pull Request with your contribution


NOTES
-----

* Oanda API REST-v20 is still under development, some functionality have not yet been implemented (Pricing History, Forex Labs), but I will keep an eye on it, and as soon as it gets implemented I will update this library accordingly.
* DO NOT USE THIS LIBRARY ON PRODUCTION! It is under heavy development and still lacks testing suites. It is also partially documented.
* Use this library at your own risk.
* Happy hunting on the markets!!


.. |Travis Build Status| image:: https://travis-ci.org/rhenter/oandapy.svg?branch=master
   :target: https://travis-ci.org/rhenter/oandapy.svg?branch=master
.. |Coverage Status| image:: https://coveralls.io/repos/github/rhenter/oandapy/badge.svg?branch=master
   :target: https://coveralls.io/github/rhenter/oandapy?branch=master
.. |Code Health| image:: https://landscape.io/github/rhenter/oandapy/master/landscape.svg?style=flat
   :target: https://landscape.io/github/rhenter/oandapy/master
.. |PyPI Version| image:: https://img.shields.io/pypi/pyversions/oandapy.svg?maxAge=2000000
   :target: https://pypi.python.org/pypi/oandapy
.. |PyPI License| image:: https://img.shields.io/pypi/l/oandapy.svg?maxAge=360
   :target: https://github.com/rhenter/oandapy/blob/master/LICENCE
.. |PyPI latest| image:: https://img.shields.io/pypi/v/oandapy.svg?maxAge=180
   :target: https://pypi.python.org/pypi/oandapy
