Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asyncio support for all components #191

Merged
merged 2 commits into from Feb 19, 2020
Merged

Add asyncio support for all components #191

merged 2 commits into from Feb 19, 2020

Commits on Feb 13, 2020

  1. Add asyncio support for all components

    In order to minimize the copy-paste between the async and sync
    implementations, all of the non-base components are sym-linked to their
    sync counterparts.  Since these import `AlphaVantage` locally, they
    automatically pick up the async version, which is really nifty!
    
    There was some refactoring in `SectorPerformance` to make the re-use
    possible.
    
    The async verison of AlphaVantage tries to re-use as much as possible
    from the sync version.  The main differences are:
    * a new `session` for the HTTP calls
    * a new `close()` function which should be called when you're done
    * `proxy` is a string instead of a dict
    
    Using it:
    ```python
    import asyncio
    from alpha_vantage.async_support.timeseries import TimeSeries
    
    async def get_data():
        ts = TimeSeries(key='YOUR_API_KEY')
        data, meta_data = await ts.get_intraday('GOOGL')
        await ts.close()
    
    loop = asyncio.get_event_loop()
    loop.run_until_complete(get_data())
    loop.close()
    ```
    joncinque committed Feb 13, 2020
    Configuration menu
    Copy the full SHA
    0ec348a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9acf53b View commit details
    Browse the repository at this point in the history