Get Ahead in Crypto with Python-Driven Quotes.

Getting crypto quotes for trading.


Using Python you can instantly obtain crypto market quotes for any given coin/currency and easily automate this process without requirement to use a web browser, so you can use a solution below that will provide necessary information in dataframe or JSON format.

The Python script below will make a HTTP request to "Yahoo Finance" API - the gold standard for stock-data APIs available for both individual and enterprise-level users. The API use is free and reliable and wil provide you with cryptocurrency quotes, up-to-date news, portfolio management resources, international market data, social interaction, mortgage and more...

Cryptocurrency quotes.
Cryptocurrency quotes meme.

Python Knowledge Base: Make coding great again.
- Updated: 2024-12-20 by Andrey BRATUS, Senior Data Analyst.




    Obtained cryptocurrency results in a form of dataframes or JSON files can be converted to any format suitable for further visualisation and financial data analysis to perform valuable business decisions. The script itself can be easily modified to obtain necessary historical data with any desired crypto coin, interval or time aggregations.


  1. Python code to obtain cryptocurrency quotes:


  2. 
    # pip install yfinance
    
    import yfinance as yf
    
    Cryptocurrency = "BTC-USD"
    
    data = yf.download(tickers={Cryptocurrency}, period = '12h', interval = '60m')
    
    data
    

  3. Cryptocurrency quotes data output:


  4. Crypto quotes interval data.



  5. Obtaining coins detailed INFO:


  6. 
    Cryptocurrency = "BTC-USD"
    stock = yf.Ticker(Cryptocurrency)
    # get coins info
    stock.info
    

  7. Coins INFO data output:


  8. 
    {'companyOfficers': [],
     'name': 'Bitcoin',
     'startDate': 1367107200,
     'description': 'Bitcoin (BTC) is a cryptocurrency . Users are able to generate BTC through the process of mining. Bitcoin has a current supply of 19,156,318. The last known price of Bitcoin is 18,942.38937415 USD and is down -2.58 over the last 24 hours. It is currently trading on 9747 active market(s) with $36,190,925,613.00 traded over the last 24 hours. More information can be found at https://bitcoin.org/.',
     'maxAge': 1,
     'exchange': 'CCC',
     'shortName': 'Bitcoin USD',
     'exchangeTimezoneName': 'UTC',
     'exchangeTimezoneShortName': 'UTC',
     'isEsgPopulated': False,
     'gmtOffSetMilliseconds': '0',
     'quoteType': 'CRYPTOCURRENCY',
     'symbol': 'BTC-USD',
     'messageBoardId': 'finmb_BTC_CCC',
     'market': 'ccc_market',
     'previousClose': 18883.615,
     'regularMarketOpen': 18883.615,
     'twoHundredDayAverage': 29361.217,
     'trailingAnnualDividendYield': None,
     'payoutRatio': None,
     'volume24Hr': 34840641536,
     'regularMarketDayHigh': 19092.328,
     'navPrice': None,
     'averageDailyVolume10Day': 37348488097,
     'totalAssets': None,
     'regularMarketPreviousClose': 18883.615,
     'fiftyDayAverage': 21536.887,
     'trailingAnnualDividendRate': None,
     'open': 18883.615,
     'toCurrency': 'USD=X',
     'averageVolume10days': 37348488097,
     'expireDate': None,
     'yield': None,
     'algorithm': None,
     'dividendRate': None,
     'exDividendDate': None,
     'beta': None,
     'circulatingSupply': 19156444,
     'regularMarketDayLow': 18883.615,
     'priceHint': 2,
     'currency': 'USD',
     'regularMarketVolume': 34840641536,
     'lastMarket': 'CoinMarketCap',
     'maxSupply': None,
     'openInterest': None,
     'marketCap': 363256840192,
     'volumeAllCurrencies': 34840641536,
     'strikePrice': None,
     'averageVolume': 29998151554,
     'priceToSalesTrailing12Months': None,
     'dayLow': 18883.615,
     'ask': None,
     'ytdReturn': None,
     'askSize': None,
     'volume': 34840641536,
     'fiftyTwoWeekHigh': 68789.625,
     'forwardPE': None,
     'fromCurrency': 'BTC',
     'fiveYearAvgDividendYield': None,
     'fiftyTwoWeekLow': 17708.623,
     'bid': None,
     'tradeable': False,
     'dividendYield': None,
     'bidSize': None,
     'dayHigh': 19092.328,
     'coinMarketCapLink': 'https://coinmarketcap.com/currencies/bitcoin',
     'regularMarketPrice': 18962.646,
     'preMarketPrice': None,
     'logo_url': ''}
    




See also related topics: