cryptologic-1.0.2
توضیحات
Python wrapper for cryptocompare API
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cryptologic-1.0.2 |
| نام | cryptologic |
| نسخه کتابخانه | 1.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Gerrishon Sirere |
| ایمیل نویسنده | secretum.inc@pm.me |
| آدرس صفحه اصلی | https://github.com/secretum-inc/cryptologic |
| آدرس اینترنتی | https://pypi.org/project/cryptologic/ |
| مجوز | - |
# cryptologic
 [](https://coveralls.io/github/secretum-inc/cryptologic?branch=main)  [](https://badge.fury.io/py/cryptologic)
Python3 wrapper to query cryptocurrency prices (and more) using the [CryptoCompare](https://min-api.cryptocompare.com/) API.
## Install
```sh
pip install cryptologic
```
## Usage
```python
import cryptologic
```
## API Key
If you have an API key, you can either set it as environment variable `CRYPTOCOMPARE_API_KEY` or set it manually with:
```
cryptologic.cryptologic._set_api_key_parameter(KEY_HERE)
```
### Coin List
```python
cryptologic.coin_list(format=False)
# ...
# },
# 'BTC': {
# 'Id': '1182'
# 'Url': '/coins/btc/overview'
# 'ImageUrl': '/media/19633/btc.png'
# 'Name': 'BTC'
# 'CoinName': 'Bitcoin'
# 'FullName': 'Bitcoin (BTC)'
# 'Algorithm': 'SHA256'
# 'ProofType': 'PoW'
# 'FullyPremined': '0'
# 'TotalCoinSupply': '21000000'
# 'PreMinedValue': 'N/A'
# 'TotalCoinsFreeFloat': 'N/A'
# 'SortOrder': '1'
# },
# ...
```
If `format` is `True`, the coin list is returned as Python list,
containing only the abbreviations (like `BTC`).
### Price
```python
cryptologic.get_price('BTC')
# or
cryptologic.get_price('BTC', currency='USD', full=True)
# or
cryptologic.get_price(['BTC', 'ETH'], ['EUR', 'GBP'])
# {'BTC': {'EUR': 3709.04, 'GBP': 3354.78},
# 'ETH': {'EUR': 258.1, 'GBP': 241.25}}
```
### Historical Prices
```python
# pass either datetime or time instance
cryptologic.price('XMR', timestamp=datetime.datetime(2017,6,6), exchange='CCCAGG')
# or
cryptologic.price('XMR', 'EUR', datetime.datetime(2017,6,6))
# {'XMR': {'EUR': 43.05}}
```
#### Day
```python
cryptologic.price_day('BTC', currency='EUR')
cryptologic.price_day('BTC', currency='EUR', limit=30)
cryptologic.price_day('BTC', 'EUR', limit=24, exchange='CCCAGG', toTs=datetime.datetime(2019,6,6))
# or
cryptologic.price_day('BTC', 'EUR', limit=24, exchange='CCCAGG', toTs=datetime.datetime(1559815200))
```
#### Hour
```python
cryptologic.price_hour('BTC', currency='USD')
cryptologic.price_hour('BTC', currency='EUR', limit=24)
cryptologic.price_hour('BTC', 'EUR', limit=24, exchange='CCCAGG')
cryptologic.price_hour('BTC', 'EUR', limit=24, exchange='CCCAGG', toTs=datetime.datetime(2019,6,6,12))
# or
cryptologic.price_hour('BTC', 'EUR', limit=24, exchange='CCCAGG', toTs=datetime.datetime(1559815200))
```
#### Minute
```python
cryptologic.price_minute('BTC', currency='EUR')
cryptologic.price_minute('BTC', currency='EUR', limit=1440)
cryptologic.price_minute('BTC', 'EUR', limit=24, exchange='CCCAGG', toTs=datetime.datetime.now())
```
### Average
```python
cryptologic.get_average('BTC', currency='EUR', exchange='Kraken')
# {
# 'MARKET': 'CUSTOMAGG',
# 'FROMSYMBOL': 'BTC',
# 'TOSYMBOL': 'EUR',
# 'FLAGS': 0,
# 'PRICE': 3610,
# 'LASTUPDATE': 1503066719,
# 'LASTVOLUME': 0.5,
# 'LASTVOLUMETO': 1805,
# 'LASTTRADEID': 1503066719.7584,
# 'VOLUME24HOUR': 12614.509997469995,
# 'VOLUME24HOURTO': 46397723.00499387,
# 'OPEN24HOUR': 3847.9,
# 'HIGH24HOUR': 3848.96,
# 'LOW24HOUR': 3555,
# 'LASTMARKET': 'Kraken',
# 'CHANGE24HOUR': -237.9000000000001,
# 'CHANGEPCT24HOUR': -6.182593102731363
# }
```
### Exchanges
```python
cryptologic.get_exchanges()
```
### Pairs
```python
cryptologic.get_pairs()
pairs = cryptologic.get_pairs(exchange='Kraken')
```
## Developing
Tests run assuming you have an API key, otherwise they will error due to rate limiting. Install the dev dependencies and run the tests:
```sh
pip3 install -r requirements.txt
python3 -m pytest
```
## Credit
* The [CryptoCompare API](https://min-api.cryptocompare.com/).
نیازمندی
| مقدار | نام |
|---|---|
| =2.24.0,<3.0. | requests |
| - | astroid==2.4.2 |
| - | attrs==20.3.0 |
| - | quo==2021.1 |
| - | autopep8==1.5.4 |
| - | certifi==2020.12.5 |
| - | chardet==4.0.0 |
| - | coveralls==3.0.0 |
| - | doc8==0.8.1 |
| - | docopt==0.6.2 |
| - | docutils==0.16 |
| - | filelock==3.0.12 |
| - | idna==2.10 |
| - | iniconfig==1.1.1 |
| - | isort==5.7.0 |
| - | lazy-object-proxy==1.4.3 |
| - | mccabe==0.6.1 |
| - | more-itertools==8.6.0 |
| - | mypy==0.800 |
| - | mypy-extensions==0.4.3 |
| - | packaging==20.8 |
| - | pbr==5.5.1 |
| - | pluggy==0.13.1 |
| - | public==2020.12.3 |
| - | py==1.10.0 |
| - | pycodestyle==2.6.0 |
| - | Pygments==2.7.4 |
| - | pylint==2.6.0 |
| - | pyparsing==2.4.7 |
| - | pytest==6.2.1 |
| - | pytest-cov==2.11.1 |
| - | pytest-mypy==0.8.0 |
| - | query-string==2020.12.3 |
| - | requests==2.25.1 |
| - | restructuredtext-lint==1.3.2 |
| - | six==1.15.0 |
| - | stevedore==3.3.0 |
| - | toml==0.10.2 |
| - | typed-ast==1.4.2 |
| - | typing-extensions==3.7.4.3 |
| - | urllib3==1.26.5 |
| - | wcwidth==0.2.5 |
| - | wrapt==1.12.1 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl cryptologic-1.0.2:
pip install cryptologic-1.0.2.whl
نصب پکیج tar.gz cryptologic-1.0.2:
pip install cryptologic-1.0.2.tar.gz