Welcome to cryptocom-exchange documentation!
This package provides interfaces to access a https://crypto.com/exchange API. Supports only Python 3.7+ versions. You can find tests with examples of trading and exchange data usage at github. Full reference you can find in the API section.
Quick-start
Create virtual environment, activate, install
python3 -m venv venv
source venv/bin/activate
pip3 install cryptocom-exchange
Useful examples
To use pairs from server and have fresh data instead of constants from pairs use sync_pairs
import asyncio
import cryptocom.exchange as cro
async def main():
exchange = cro.Exchange()
# ensure pairs fresh from exchange
await exchange.sync_pairs()
account = cro.Account(api_key='test', api_secret='test')
await account.sync_pairs()
asyncio.run(main())
Get current price data for pair
import asyncio
import cryptocom.exchange as cro
async def main():
exchange = cro.Exchange()
price = await exchange.get_price(cro.pairs.CRO_USDT)
print(f'CRO price {price}')
asyncio.run(main())
Get account balance. You can provide env vars for auth keys.
export CRYPTOCOM_API_KEY="***"
export CRYPTOCOM_API_SECRET="***"
python3 mybot.py
or by providing attributes to Account(api_key='***', api_secret='***')
import asyncio
import cryptocom.exchange as cro
async def main():
account = cro.Account(from_env=True)
data = await account.get_balance()
print(f'Account balance {data}')
asyncio.run(main())