Simple methods for working with coinmarketcap API
Project description
CoinCrypt
An code to handle basic methods in the coin market cap API.
To use this code initialize an class Coincrypt
Getting Started
Simple Code to connect the API :
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
Methods
get_price_by_symbol :
This method is made for getting the actual price(USD) given an symbol ex (BTC,ETE,LTC...)
Obs - in version >=2.10.0 you can also use list of strings
-
Parameters:
-
symbol :: str -- The symbol of the crypto (for multiple prices use , inside the string )
-
max_search :: int -- the maximun number of cryptos the method will search
-
Code Example:
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_price_by_symbol('BTC,ADA,ETH')
get_by_price :
This method is made to give an python dictionary with all the coins inside the parameters given
-
Parameters:
-
max_price :: float -- The maximum price of the coin
-
min_price :: float -- The minimum price of the coin
-
max_search :: int -- the maximun number of cryptos the method will search
-
Code Example :
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_by_price(min_price = 0.2,max_price = 1, max_search = 100)# will return a python dict with the coins inside this values
get_price_by_name :
This methods get the price by the name of the coin ex : cardano, bitcoin, ethereum ...
Parameters:
name :: str -- The name of the coin,(To use multiple coins separte then by , )
Code Example :
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_price_by_name(name = 'cardano,bitcoin')
get_by_volume :
This method returns an python dictionary with the coins symbols and the volume in certain period
-
Parameters :
-
min_vol :: float -- minimun volume for search
-
max_vol :: float -- maximum volume for search
-
period :: int -- the period you want to volume to be analized
-
period == 0 --> volume in 24 hours
-
period == 1 --> moving average of the last 7 days
-
period == 2 --> moving average of the last 30 days
-
-
max_search :: int -- the maximun number of cryptos the method will search
-
Code Example:
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_price_by_volume(min_vol = 0 , max_vol = 100000, period = 0 )# get all the coins with the volume of 0 to 100000 in 24 hours in a dict with vol
get_by_change :
This method returns a python dictionary with the coins that are inside the interval of changes
-
Parameters :.
-
min_change :: float -- the minimum of the interval of change
-
max_change :: float -- the maximun of the interval of change
-
period :: int -- the period you want the interval of chage to be analized
-
period == 0 --> change in percentage of 1 hour
-
period == 1 --> change in percentage in 24 hours
-
period == 2 --> change in percentage in 7 days
-
period == 3 --> change in percentage in 30 days
-
-
Code Example :
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_price_by_volume(min_change = 0 , max_change = 1, period = 0) # will return a dict with all coins with the variation between 0 and 1 in 1 hour
get_historical :
This method gives the historical features of the coin
-
Parameters :
- symbol :: str -- The symbol of the coin you want to know the history of (only accepts one)
Code Example :
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_historical('BTC')# returns historical features of bitcoin in json Object
convert_crypto :
This method converts criptos(BTC,ETH,ADA...) in their value in fiat coins such as BRL,EUR,USD,GBP...
Obs - in version >=2.10.0 you can also use list of strings in convert_to
-
Parameters :
-
converte_from :: str -- The symbol of the cryptocurrency you want to be converted (can use multiple entrance depending on your api plan)
-
convert_to :: str -- The symbol of the flat coin you want to be converted to
-
amount :: float -- The amount of cryptocurrency you want to be converted
-
Code Example :
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.convert_crypto('BTC','USD,1)# returns a dict with the realtion between USD and the price of 1 bitcoin
get_global_metrics :
This method gives the global metrics of the crytptocurrencies market
-
Parameters :
- convert_to :: str -- The symbol of the currency wich the data will be showed
Code Example:
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.convert_crypto('BRL') # return global market data in dict format converted to BRL('Brazilian Real)
get_FCAS_latest:
Show the latest FCAS (Fundamental Crypto Asset Score) of the crypto
-
Parameters :
-
slug :: str -- The name of the crypto you want to have tha data information
-
symbol :: str -- The symbol of the crypto you want to have the data information
-
Code Example:
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_FCAS_latest('BTC')# returns json Object with the FCAS data
get_data_by_string:
Get all the data avaliable by the API given an string of symbols or names of coins
Obs - in version >=2.10.0 you can also use list of strings
-
Parameters :
-
slug :: str -- The name of the crypto you want to have tha data information
-
symbol :: str -- The symbol of the crypto you want to have the data information
-
Code Example:
from CoinCrypt import Coincrypt as cp
cr = cp.coincrypt('API_KEY')
cr.get_data_by_string(symbol = 'BTC,ETH,BNB')
how_much_can_buy
Returns an dict with the number of coins such amount of fiat coin can buy
Obs - in version >=2.10.0 you can also use list of strings
-
Parameters:
-
slug :: str -- The name of the crypto you want to 'buy'
-
symbol :: str -- the symbol of the crypto you want to 'buy'
-
fiat_coin :: str -- the code of the fiat coin you want to buy from
-
amount :: float -- the amount of fiat coin you have to buy in that cryptocurrencies
-
Code Example :
from CoinCrypt import Coincrypt as cp
cr = coincrypt('API_KEY')
amount = cr.how_much_can_buy(symbol='ADA,ETH',amount=80))
if you like to help me here is my cardano,BitCoin and Ethereum wallet:
ADA : addr1q9rm6tavahr3qda2dje7vsac6l0yyqxuj3x82l9ckjpm7fxj7y2w4rym5f6psf5v4kw5dcezdjmw29625sews2zqtjhql2dlxj
BTC : bc1qazdaj8at50mcs5fsm5vj8wzfn6yxac9nes3ktg
ETH : 0x62786833a10436B394512E8F42F26C6BD3c4040c
Created by Henrique Domiciano Osinski
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
Built Distribution
File details
Details for the file CoinCrypt-0.0.2.10.0.tar.gz
.
File metadata
- Download URL: CoinCrypt-0.0.2.10.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8eb9b560124c93ec3ae529c892905ef0de1be1d4199987bdbbfc4d2de79246c |
|
MD5 | 644e11afc1f414848edb43b2d44484c8 |
|
BLAKE2b-256 | 6d819761529cd0437c5b4b28ddce5c0c81a8f4579849bf83f946fc496c111ca1 |
File details
Details for the file CoinCrypt-0.0.2.10.0-py3-none-any.whl
.
File metadata
- Download URL: CoinCrypt-0.0.2.10.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c23c30fab6f0f67db91c5f403e9745ed931d105b7143db0f17d8c55143d3594 |
|
MD5 | e099ca9be80f83c0a651be072e8d45b7 |
|
BLAKE2b-256 | 78dd1cc4b630f7fe0cca23d8109ae5d218e9897e4486deae14c7f17b7152c3c2 |