Skip to content

Commit

Permalink
remove the alpha vantage integration from this package
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomiku committed Jul 24, 2020
1 parent 0605371 commit ab9ab20
Show file tree
Hide file tree
Showing 20 changed files with 1 addition and 2,473 deletions.
62 changes: 0 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ The Alpaca SDK will check the environment for a number of variables which can be
| APCA_RETRY_CODES=429,504 | 429,504 | comma-separated HTTP status code for which retry is attempted |
| POLYGON_WS_URL | wss://socket.polygon.io/stocks | Endpoint for streaming polygon data. You likely don't need to change this unless you want to proxy it for example |
| POLYGON_KEY_ID | | Your Polygon key, if it's not the same as your Alpaca API key. Most users will not need to set this to access Polygon. |
| ALPHAVANTAGE_API_KEY=<key_id> | | Your Alpha Vantage API key. You can get [one for free here](https://www.alphavantage.co/support/#api-key). |

## REST

Expand Down Expand Up @@ -406,67 +405,6 @@ dict[symbol -> `Financials`] if `symbol` is a list of string.
### polygon/REST.news(symbol)
Returns a `NewsList` entity for the symbol.


---
# Alpha Vantage API Service

In addition to Polygon is Alpha Vantage, for users without a live account (paper trading) or want to use the unique features of AV data. You can get a free key [here](https://www.alphavantage.co/support/#api-key) and the documentation is [here](https://www.alphavantage.co/documentation/). Premium keys are also available [here](https://www.alphavantage.co/premium/#intro)
This python SDK wraps their API service and seamlessly integrates it with the Alpaca
API. `alpaca_trade_api.REST.alpha_vantage` will be the `REST` object for Alpha Vantage.

The example below gives AAPL daily OHLCV data in a DataFrame format.

```py
import alpaca_trade_api as tradeapi

api = tradeapi.REST()
aapl = api.alpha_vantage.historic_quotes('AAPL', adjusted=True, output_format='pandas')
```

## alpha_vantage/REST
It is initialized through alpaca `REST` object.

### alpha_vantage/REST.get(params=None)
Customizable endpoint, where you can pass all keywords/paramters from the documentation:https://www.alphavantage.co/documentation/#

Returns the specific customized data.

### alpha_vantage/REST.historic_quotes(symbol, adjusted=False, outputsize='full', cadence='daily', output_format=None)
Returns a `csv`, `json`, or `pandas` object of historical OHLCV data.

### alpha_vantage/REST.intraday_quotes(symbol, interval='5min', outputsize='full', output_format=None)
Returns a `csv`, `json`, or `pandas` object of intraday OHLCV data.

### alpha_vantage/REST.current_quote(symbol)
Returns a `json` object with the current OHLCV data of the selected symbol.

### alpha_vantage/REST.last_quote(symbol)
Returns a `json` object with the current OHLCV data of the selected symbol (same as `current_quote`).

### alpha_vantage/REST.search_endpoint(keywords, datatype='json')
Returns a `csv`, `json`, or `pandas` object that contains the best-matching symbols and market information based on keywords of your choice.

### alpha_vantage/REST.company(symbol, datatype='json')
Same as `search_endpoint`.

### alpha_vantage/REST.historic_fx_quotes(from_symbol, to_symbol, outputsize='full', cadence='daily', output_format=None)
Returns a `csv`, `json`, or `pandas` object of historical OHLCV data for the currency pair.

### alpha_vantage/REST.intraday_fx_quotes(from_symbol, to_symbol, interval='5min', outputsize='full', output_format=None)
Returns a `csv`, `json`, or `pandas` object of intraday OHLCV data for the currency pair.

### alpha_vantage/REST.exchange_rate(from_currency, to_currency)
Returns a `json` object with the current OHLCV data of the selected currency pair (digital or physical)

### alpha_vantage/REST.historic_cryptocurrency_quotes(self, symbol, market, cadence='daily', output_format=None)
Returns a `csv`, `json`, or `pandas` object of historical OHLCV data for the cryptocurrency pair.

### alpha_vantage/REST.techindicators(self, techindicator='SMA', output_format='json', **kwargs)
Returns a `csv`, `json`, or `pandas` object with the data from the techindicator of choice.

### alpha_vantage/REST.sector()
Returns a `json` of the currrency sector performances.

## Support and Contribution

For technical issues particular to this module, please report the
Expand Down
1 change: 0 additions & 1 deletion alpaca_trade_api/alpha_vantage/__init__.py

This file was deleted.

155 changes: 0 additions & 155 deletions alpaca_trade_api/alpha_vantage/rest.py

This file was deleted.

8 changes: 0 additions & 8 deletions alpaca_trade_api/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@ def get_polygon_credentials(alpaca_key: str = None) -> str:
return key_id


def get_alpha_vantage_credentials(alpha_vantage_key: str = None) -> str:
key_id = alpha_vantage_key or os.environ.get('ALPHAVANTAGE_API_KEY')
if key_id is None:
raise ValueError('Key ID must be given to access Alpha Vantage API'
' (env: ALPHAVANTAGE_API_KEY)')
return key_id


def get_api_version(api_version: str) -> str:
api_version = api_version or os.environ.get('APCA_API_VERSION')
if api_version is None:
Expand Down
2 changes: 0 additions & 2 deletions alpaca_trade_api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
Aggs, Trade, Quote, Watchlist, PortfolioHistory
)
from . import polygon
from . import alpha_vantage

logger = logging.getLogger(__name__)
Positions = List[Position]
Expand Down Expand Up @@ -82,7 +81,6 @@ def __init__(self,
'APCA_RETRY_CODES', '429,504').split(',')]
self.polygon = polygon.REST(
self._key_id, 'staging' in self._base_url)
self.alpha_vantage = alpha_vantage.REST(self._key_id)

def _request(self,
method,
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ requests>2,<3
urllib3>1.24,<1.26
websocket-client>=0.56.0,<1
websockets>=8.0,<9
alpha_vantage>=2,<3

1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
packages=[
'alpaca_trade_api',
'alpaca_trade_api.polygon',
'alpaca_trade_api.alpha_vantage',
],
install_requires=REQUIREMENTS,
tests_require=REQUIREMENTS_TEST,
Expand Down
Empty file.
14 changes: 0 additions & 14 deletions tests/test_alpha_vantage/test_data/global_quote

This file was deleted.

27 changes: 0 additions & 27 deletions tests/test_alpha_vantage/test_data/mock_batch_quotes

This file was deleted.

61 changes: 0 additions & 61 deletions tests/test_alpha_vantage/test_data/mock_crypto_currencies

This file was deleted.

11 changes: 0 additions & 11 deletions tests/test_alpha_vantage/test_data/mock_foreign_exchange

This file was deleted.

Loading

0 comments on commit ab9ab20

Please sign in to comment.