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

Crypto intraday #317

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions alpha_vantage/cryptocurrencies.py
Expand Up @@ -4,6 +4,26 @@
class CryptoCurrencies(av):
"""This class implements all the crypto currencies api calls
"""
@av._output_format
@av._call_api_on_func
def get_digital_currency_intraday(self, symbol, market, interval='15min'):
""" Returns intraday time series (timestamp, open, high, low, close, volume)
of the cryptocurrency specified, updated realtime.

Keyword Arguments:
symbol: The digital/crypto currency of your choice. It can be any
of the currencies in the digital currency list. For example:
symbol=BTC.
market: The exchange market of your choice. It can be any of the
market in the market list. For example: market=CNY.
interval: Time interval between two consecutive data points in
the time series.
The following values are supported: '1min', '5min', '15min', '30min', '60min'
(default '15min')
"""
_FUNCTION_KEY = 'CRYPTO_INTRADAY'
return _FUNCTION_KEY, 'Time Series Crypto ({})'.format(interval), 'Meta Data'

@av._output_format
@av._call_api_on_func
def get_digital_currency_daily(self, symbol, market):
Expand Down
16 changes: 16 additions & 0 deletions test_alpha_vantage/test_integration_alphavantage.py
Expand Up @@ -232,3 +232,19 @@ def test_get_digital_currency_weekly(self):
output_format='pandas',
symbol='BTC',
market='CNY')

def test_get_digital_currency_intraday(self):
"""Test that we get a dictionary containing json data
"""
cc = CryptoCurrencies(key=TestAlphaVantage._API_KEY_TEST)
self._assert_result_is_format(cc.get_digital_currency_intraday,
output_format='json',
symbol='BTC',
market='CNY')
# Test panda as output
cc = CryptoCurrencies(
key=TestAlphaVantage._API_KEY_TEST, output_format='pandas')
self._assert_result_is_format(cc.get_digital_currency_intraday,
output_format='pandas',
symbol='BTC',
market='CNY')