Skip to content

Commit

Permalink
Updates readme for PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespeterschinner committed Oct 23, 2017
1 parent 7c0427a commit ccfc63e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
20 changes: 19 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ we are ready to begin.

Lets first take a look at this code example, then go though it line by line.

.. code-block:: python
import asyncio
from async_v20 import OandaClient
Expand All @@ -91,36 +93,52 @@ Lets first take a look at this code example, then go though it line by line.
First we need to import *asyncio* this allows up to run our *coroutine*
.. code-block:: python
import asyncio
We then import *OandaClient* which provides us the means to interact with OANDA
.. code-block:: python
from async_v20 import OandaClient
Because *OandaClient* returns *coroutines* we use *async def*. This allows the use of the *await* syntax
.. code-block:: python
async def account():
*OandaClient* is a *context manager*, we use *async with* to instantiate a
client instance. Doing so will automatically close the *http session* when we're done
.. code-block:: python
async with OandaClient() as client:
We then create and *run* the *coroutine* by calling *client*. **get_account_details()**
.. code-block:: python
return await client.get_account_details()
return await client.get_account_details()
Now we have defined our *coroutine* we need to execute it.
To do so we need an event loop. Achieved using *asyncio*. **get_event_loop()**
.. code-block:: python
loop = asyncio.get_event_loop()
The value returned by executing the `account()` *coroutine* is accessed through the event loop.
.. code-block:: python
response = loop.run_until_complete(account())
`async_v20` objects have a `series()` method that returns a `pandas.Series`
.. code-block:: python
print(response['account'].series())
2 changes: 1 addition & 1 deletion async_v20/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .helpers import request_limiter, initializer
from .interface import *

version = '1.1.2a1'
version = '1.1.2a4'


class OandaClient(AccountInterface, InstrumentInterface, OrderInterface, PositionInterface,
Expand Down
Binary file modified dist/async_v20-1.1.2a1.tar.gz
Binary file not shown.
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import os

from setuptools import setup, find_packages
version = '1.1.2a1'
version = '1.1.2a4'

def read(f):
return open(os.path.join(os.path.dirname(__file__), f)).read().strip()

setup(name='async_v20',
version=version,
description="Asynchronous wrapper for OANDA's v20 REST API",
long_description=read('README.rst'),
author='James Peter Schinner',
author_email='james.peter.schinner@gmail.com',
url='https://github.com/jamespeterschinner/async_v20',
Expand Down

0 comments on commit ccfc63e

Please sign in to comment.