Skip to main content

Python3 CryptoCoin data parser

Project description

This python3 script is based on the coinmarketcap API

For getting coin data you can use the shortcodes for the coins.

So you don’t have to use ‘Basic Attention Token’ but ‘bat’ is enough to get the coin data.

Limits

Please limit requests to no more than 10 per minute.

Endpoints update every 5 minutes.

Create your own caching mechanism to keep requests to minimum

How do I get set up?

  • Install this script with:

    • pip3 py_cryptocoin –upgrade (or pip py_nsapi –upgrade )

  • ready to use it!

Current Coins

‘btc’ : ‘Bitcoin’, ‘eth’ : ‘Ethereum’, ‘xrp’ : ‘Ripple’, ‘bch’ : ‘Bitcoin Cash’, ‘ada’ : ‘Cardano’, ‘ltc’ : ‘Litecoin’, ‘xem’ : ‘NEM’, ‘neo’ : ‘NEO’, ‘xlm’ : ‘Stellar’, ‘eos’ : ‘EOS’, ‘miota’ : ‘IOTA’, ‘dash’ : ‘Dash’, ‘xmr’ : ‘Monero’, ‘trx’ : ‘TRON’, ‘btg’ : ‘Bitcoin Gold’, ‘icx’ : ‘ICON’, ‘qtum’ : ‘Qtum’, ‘etc’ : ‘Ethereum Classic’, ‘lsk’ : ‘Lisk’, ‘xrb’ : ‘RaiBlocks’, ‘ven’ : ‘VeChain’, ‘omg’ : ‘OmiseGO’, ‘usdt’ : ‘Tether’, ‘ppt’ : ‘Populous’, ‘zec’ : ‘Zcash’, ‘xvg’ : ‘Verge’, ‘sc’ : ‘Siacoin’, ‘bnb’ : ‘Binance Coin’, ‘strat’ : ‘Stratis’, ‘bcn’ : ‘Bytecoin’, ‘steem’ : ‘Steem’, ‘ardr’ : ‘Ardor’, ‘snt’ : ‘Status’, ‘mkr’ : ‘Maker’, ‘rep’ : ‘Augur’, ‘bts’ : ‘BitShares’, ‘kcs’ : ‘KuCoin Shares’, ‘waves’ : ‘Waves’, ‘zrx’ : ‘0x’, ‘doge’ : ‘Dogecoin’, ‘etn’ : ‘Electroneum’, ‘veri’ : ‘Veritaseum’, ‘kmd’ : ‘Komodo’, ‘dcr’ : ‘Decred’, ‘drgn’ : ‘Dragonchain’, ‘wtc’ : ‘Walton’, ‘dcn’ : ‘Dentacoin’, ‘lrc’ : ‘Loopring’, ‘ark’ : ‘Ark’, ‘salt’ : ‘SALT’, ‘qash’ : ‘QASH’, ‘dgb’ : ‘DigiByte’, ‘bat’ : ‘Basic Attention Token’, ‘gnt’ : ‘Golem’, ‘hsr’ : ‘Hshare’, ‘knc’ : ‘Kyber Network’, ‘gas’ : ‘Gas’, ‘wax’ : ‘WAX’, ‘ethos’ : ‘Ethos’, ‘pivx’ : ‘PIVX’, ‘gbyte’ : ‘Byteball Bytes’, ‘fun’ : ‘FunFair’, ‘aion’ : ‘Aion’, ‘rhoc’ : ‘RChain’, ‘zcl’ : ‘ZClassic’, ‘fct’ : ‘Factom’, ‘smart’ : ‘SmartCash’, ‘dent’ : ‘Dent’, ‘mona’ : ‘MonaCoin’, ‘elf’ : ‘aelf’, ‘powr’ : ‘Power Ledger’, ‘dgd’ : ‘DigixDAO’, ‘kin’ : ‘Kin’, ‘rdd’ : ‘ReddCoin’, ‘ae’ : ‘Aeternity’, ‘btm’ : ‘Bytom’, ‘nas’ : ‘Nebulas’, ‘sys’ : ‘Syscoin’, ‘req’ : ‘Request Network’, ‘nebl’ : ‘Neblio’, ‘link’ : ‘ChainLink’, ‘eng’ : ‘Enigma’, ‘xp’ : ‘Experience Points’, ‘gxs’ : ‘GXShares’, ‘maid’ : ‘MaidSafeCoin’, ‘sub’ : ‘Substratum’, ‘xzc’ : ‘ZCoin’, ‘nxs’ : ‘Nexus’, ‘nxt’ : ‘Nxt’, ‘med’ : ‘MediBloc’, ‘emc’ : ‘Emercoin’, ‘btx’ : ‘Bitcore’, ‘bnt’ : ‘Bancor’, ‘cnd’ : ‘Cindicator’, ‘qsp’ : ‘Quantstamp’, ‘cnx’ : ‘Cryptonex’, ‘icn’ : ‘Iconomi’, ‘game’ : ‘GameCredits’, ‘pay’ : ‘TenX’, ‘part’ : ‘Particl’

Global Data

The global data return a Dictionary (DICT) with total market cap and volume of currencies

Parameters

Optional parameters: - (string) convert - return 24h volume, and market cap in terms of another currency. Valid values are: - “AUD”, “BRL”, “CAD”, “CHF”, “CLP”, “CNY”, “CZK”, “DKK”, “EUR”, “GBP”, “HKD”, “HUF”, “IDR”, “ILS”, “INR”, “JPY”, “KRW”, “MXN”, “MYR”, “NOK”, “NZD”, “PHP”, “PKR”, “PLN”, “RUB”, “SEK”, “SGD”, “THB”, “TRY”, “TWD”, “ZAR”

Return Fields

You will get a DICT with the followin fields

  • total_market_cap_usd

  • total_24h_volume_usd

  • bitcoin_percentage_of_market_cap

  • active_currencies

  • active_assets

  • active_markets

  • last_updated

Example code

import CryptoCoin

cc = CryptoCoin()
data = cc.getGlobalData() #standard currency (USD)

#or

data = cc.getGlobalData('EUR') #to get by currency

print(data)

Coin Data

Returns al information about one cryptocoin and the pricing

If you add the convert parameter it will return the cryptocoin price in that currency

Parameters

  • (string) cryptocoin shortcode, see Current Coins above what to use

Optional parameters: -(string) currency - return price, 24h volume, and market cap in terms of another currency. Valid values are: - “AUD”, “BRL”, “CAD”, “CHF”, “CLP”, “CNY”, “CZK”, “DKK”, “EUR”, “GBP”, “HKD”, “HUF”, “IDR”, “ILS”, “INR”, “JPY”, “KRW”, “MXN”, “MYR”, “NOK”, “NZD”, “PHP”, “PKR”, “PLN”, “RUB”, “SEK”, “SGD”, “THB”, “TRY”, “TWD”, “ZAR”

Return Fields

You will get a DICT with the followin fields

  • id

  • name

  • symbol

  • rank

  • price_usd [depening on convert / currency]

  • price_btc

  • 24h_volume_usd [depening on convert / currency]

  • market_cap_usd [depening on convert / currency]

  • available_supply

  • total_supply

  • max_supply

  • percent_change_1h

  • percent_change_24h

  • percent_change_7d

  • last_updated

Example code

import CryptoCoin

coin = "bat"

cc = CryptoCoin()
data = cc.(coin) # standard US Dollars

#or

data = cc.(coin, "EUR") #get the coin price back in Euro's

print(data)

All Coins Data

Returns al information about all current know cryptocoins and the pricing

If you add the convert parameter it will return the cryptocoin price in that currency

Parameters

Optional parameters: - (int) start - return results from rank [start] and above - (int) limit - return a maximum of [limit] results (default is 100, use 0 to return all results) - (string) currency - return price, 24h volume, and market cap in terms of another currency. Valid values are: - “AUD”, “BRL”, “CAD”, “CHF”, “CLP”, “CNY”, “CZK”, “DKK”, “EUR”, “GBP”, “HKD”, “HUF”, “IDR”, “ILS”, “INR”, “JPY”, “KRW”, “MXN”, “MYR”, “NOK”, “NZD”, “PHP”, “PKR”, “PLN”, “RUB”, “SEK”, “SGD”, “THB”, “TRY”, “TWD”, “ZAR”

Return Fields

You will get a DICT with the followin fields

  • id

  • name

  • symbol

  • rank

  • price_usd [depening on convert / currency]

  • price_btc

  • 24h_volume_usd [depening on convert / currency]

  • market_cap_usd [depening on convert / currency]

  • available_supply

  • total_supply

  • max_supply

  • percent_change_1h

  • percent_change_24h

  • percent_change_7d

  • last_updated

Example code

import CryptoCoin

cc = CryptoCoin()
data = cc.getAllCoinData() # Get default data in US Dollars

start = 100
limit = 10
currency = "EUR"

data = cc.getAllCoinData(start, limit, currrency)

print(data)

Who do I talk to?

License

Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

You are free to:

  • Share — copy and redistribute the material in any medium or format

  • Adapt — remix, transform, and build upon the material

-The licensor cannot revoke these freedoms as long as you follow the license terms.-

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

  • NonCommercial — You may not use the material for commercial purposes.

  • ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_cryptocoin-1.0.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file py_cryptocoin-1.0.tar.gz.

File metadata

  • Download URL: py_cryptocoin-1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py_cryptocoin-1.0.tar.gz
Algorithm Hash digest
SHA256 87a1a9cf1c2571874f7ed14e08b1de9536fbdeafbd73675d808b5a2ce74eb4a6
MD5 4205fe9948e3a2fedfa6fe8de61bb5cd
BLAKE2b-256 620fedd13464499595bf210676e20dab288f399339ba8585995f59209c90ae69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page