From e116bb3a2fb3e76191fcb32bb803927a0d7aa7fc Mon Sep 17 00:00:00 2001 From: sanjay Date: Mon, 17 Oct 2022 10:10:00 +0530 Subject: [PATCH] Add CoinMarketCapPrice.py which provide details like current price, mcap, vol-traded etc of a crypto --- CoinMarketCapPrice.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 CoinMarketCapPrice.py diff --git a/CoinMarketCapPrice.py b/CoinMarketCapPrice.py new file mode 100644 index 0000000..3bedba1 --- /dev/null +++ b/CoinMarketCapPrice.py @@ -0,0 +1,13 @@ +import requests, json + +while True: + print('use ctrl+c or type EXIT to close the script') + fiat = input("Provide fiat name eg: USDT, BUSD\t\t\t\t") + symbol = input("Provide crypto symbol eg: BTC, ETH, BNB\t\t\t") + endpoint = "https://3rdparty-apis.coinmarketcap.com/v1/cryptocurrency/widget?convert={}&symbol={}".format(fiat, symbol) + response = requests.get(endpoint) + + if response.status_code==200: + print(json.dumps(json.loads(response.text), indent=4)) + else: + print("Oop! Something went wrong. Invalid request query input") \ No newline at end of file