Utility code for interacting with amberdata
Project description
pyamber
Some utility code for interacting with amberdata. For more information on amberdata please check out https://amberdata.io/.
Installing pyamber
Install with pip
pip install pyamber
AmberRequest
AmberRequest is a class hiding the management of your key, the pagination of requests and conversion of your results to standard pandas containers.
from pyamber.request import AmberRequest, TimeInterval
if __name__ == '__main__':
request = AmberRequest(key="...")
f = request.prices.history(pair="eth_usd", time_interval=TimeInterval.HOURS)
print(f)
Settings.cfg
We recommend to define a configuration file (*.cfg)
containing
AMBERDATA = {'x-api-key': 'ENTER YOUR KEY HERE'}
Flask-AmberData
A Flask extension that provides integration with AmberData. In particular this flask extension provides management of the your AmberRequests. You can use configuration files such as settings.cfg to follow standard flask practices. The configuration is easy, just fetch the extension:
import pandas as pd
from flask import Flask
from pyamber.flask_amberdata import amberdata
from pyamber.request import TimeInterval
if __name__ == '__main__':
app = Flask(__name__)
app.config.from_pyfile('/amberdata/config/settings.cfg')
amberdata.init_app(app)
with app.app_context():
assert amberdata.request.health
x = amberdata.request.prices.history("eth_usd", time_interval=TimeInterval.DAYS, start_date=pd.Timestamp("2020-01-12"), end_date=pd.Timestamp("2020-01-16"))
print(x)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyamber-0.0.9.tar.gz
.
File metadata
- Download URL: pyamber-0.0.9.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51811332fd11acf21ef573237ab651c010a74d3c4c71b6ec4498a6a2f04223be |
|
MD5 | 28b4d4505ac1082e5d7e32422cae50a7 |
|
BLAKE2b-256 | d194697233ae23a2cba3e4d19d0c7a169ebf40c331c965f2d9ebf9e60c9cae2f |