amberdata-derivatives is a Python library to access the Amberdata Derivatives API.
Documentation: https://docs.amberdata.io/reference/derivatives-information
To install the latest version:
pip install git+https://github.com/amberdata/amberdata-derivatives-sdk.git
To install a specific version:
pip install git+https://github.com/amberdata/[email protected]
from amberdata_derivatives import AmberdataDerivatives
amberdata_client = AmberdataDerivatives(api_key='<Enter your API key here>')
amberdata_client.get_volatility_term_structures_constant(currency='BTC', exchange='deribit')
Rather than hardcoding the API key, it can be stored in an environment file and loaded dynamically at runtime.
$ cat .env
API_KEY=<Enter your API key here>
from amberdata_derivatives import AmberdataDerivatives
from dotenv import load_dotenv
load_dotenv()
amberdata_client = AmberdataDerivatives(api_key=os.getenv('API_KEY'))
amberdata_client.get_volatility_term_structures_constant(currency='BTC', exchange='deribit')
The default time format for timestamp fields can also be configured globally (so it does not have to be specified with each call).
from amberdata_derivatives import AmberdataDerivatives
from dotenv import load_dotenv
load_dotenv()
amberdata_client = AmberdataDerivatives(api_key=os.getenv('API_KEY'), time_format='iso')
amberdata_client.get_volatility_term_structures_constant(currency='BTC', exchange='deribit')
python3 -m unittest -v tests/*.py
pylint --generate-rcfile > .pylintrc
pylint $(git ls-files '*.py')