-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added rapidapi key integration * prep for 2.1.3 * Removing get_batch_stock_quotes method (#189) * Removing get_batch_stock_quotes method Remove get_batch_stock_quotes method, resolving issue #184. * remove tests for get_batch_stock_quotes * Delete mock_batch_quotes Was only used for the tests removed in the previous commits, which made this file dead weight. * Add asyncio support for all components (#191) * 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() ``` * Add asyncio packages to setup.py * Issue #206: Add 'time_period' argument to 'get_bbands()' documentation. (#207) * Fixes small documentation bugs (#208) * fixed fx documentation * fixed pypi badge for documentation * prep for 2.2.0 (#209) * fixed fx documentation * fixed pypi badge for documentation * prep for 2.2.0 * small documentaiton change for 2.2.0 Co-authored-by: Aaron Sanders <[email protected]> Co-authored-by: Jon Cinque <[email protected]> Co-authored-by: Peter Anderson <[email protected]>
- Loading branch information
1 parent
0a7a65d
commit 3d8d213
Showing
20 changed files
with
912 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ Vantage (http://www.alphavantage.co/). It requires a free API key, that can be r | |
|
||
## News | ||
|
||
* From version 2.2.0 onwards, asyncio support now provided. See below for more information. | ||
* From version 2.1.3 onwards, [rapidAPI](https://rapidapi.com/alphavantage/api/alpha-vantage-alpha-vantage-default) key integration is now available. | ||
* From version 2.1.0 onwards, error logging of bad API calls has been made more apparent. | ||
* From version 1.9.0 onwards, the urllib was substituted by pythons request library that is thread safe. If you have any error, post an issue. | ||
|
@@ -159,7 +160,7 @@ Giving us as output: | |
|
||
### Foreign Exchange (FX) | ||
|
||
The foreign exchange is just metadata, thus only available as json format (using the 'csv' or 'pandas' format will raise an Error) | ||
The foreign exchange endpoint has no metadata, thus only available as json format and pandas (using the 'csv' format will raise an Error) | ||
|
||
```python | ||
from alpha_vantage.foreignexchange import ForeignExchange | ||
|
@@ -182,6 +183,36 @@ Giving us as output: | |
} | ||
``` | ||
|
||
### Asyncio support | ||
|
||
From version 2.2.0 on, asyncio support will now be available. This is only for python versions 3.5+. If you do not have 3.5+, the code will break. | ||
|
||
The syntax is simple, just mark your methods with the `async` keyword, and use the `await` keyword. | ||
|
||
Here is an example of a for loop for getting multiple symbols asyncronously. This greatly improving the performance of a program with multiple API calls. | ||
|
||
```python | ||
import asyncio | ||
from alpha_vantage.async_support.timeseries import TimeSeries | ||
|
||
symbols = ['AAPL', 'GOOG', 'TSLA', 'MSFT'] | ||
|
||
|
||
async def get_data(symbol): | ||
ts = TimeSeries(key='YOUR_KEY_HERE') | ||
data, _ = await ts.get_quote_endpoint(symbol) | ||
await ts.close() | ||
return data | ||
|
||
loop = asyncio.get_event_loop() | ||
tasks = [get_data(symbol) for symbol in symbols] | ||
group1 = asyncio.gather(*tasks) | ||
results = loop.run_until_complete(group1) | ||
loop.close() | ||
print(results) | ||
``` | ||
|
||
|
||
## Examples | ||
|
||
I have added a repository with examples in a python notebook to better see the | ||
|
@@ -207,13 +238,16 @@ Contributing is always welcome. Just contact us on how best you can contribute, | |
* The integration tests are not being run at the moment within travis, gotta fix them to run. | ||
* Add test for csv calls as well. | ||
* Add tests for incompatible parameter raise errors. | ||
* Github actions & other items in the issues page. | ||
|
||
|
||
|
||
## Contact: | ||
You can reach the Alpha Vantage team on any of the following platforms: | ||
You can reach/follow the Alpha Vantage team on any of the following platforms: | ||
* [Slack](https://alphavantage.herokuapp.com/) | ||
* [Twitter: @alpha_vantage](https://twitter.com/alpha_vantage) | ||
* [Medium-Patrick](https://medium.com/@patrick.collins_58673) | ||
* [Medium-AlphaVantage](https://medium.com/alpha-vantage) | ||
* Email: [email protected] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.