• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Crypto Currency
  • Technology
  • Contact
NEO Share

NEO Share

Sharing The Latest Tech News

  • Home
  • Artificial Intelligence
  • Machine Learning
  • Computers
  • Mobile
  • Crypto Currency

Python: How to Get Live Cryptocurrency Data(Less Than 0.1-Second Lag).

January 18, 2021 by systems

Yahoo Finance API will need three mandatory arguments in this order:

  • Tickers (1)
  • Start date + End date or Period (2)
  • Interval (3)

For our case, the ticker(argument 1) will be the pair BTC-USD. Furthermore, we are going to choose for this example to select the 22 last hours as a period(argument 2). And set up an interval(argument 3) of 15 minutes.

To call your data, you will have to use the following structure:

Above described the structure to get data which interest us.

Before going further, I will bring some details on the third argument (interval).

A quick lookup on interval

I want to give you a quick shot on the different interval you can set up using yahoo finance API.

Detailed below the full list of interval possibilities which can be required:

Above are listed the different intervals which can be chosen.

Now that we have defined our three arguments, let’s execute the query and check the output.

Let’s pursue a live test.

When I am executing the line below, we are the 15th of January 2021, and it is 5:40 PM in London. Let’s see how the API respond and if yahoo finance can bring us the latest values.

For your information: 5:40 PM UK time correspond to 12:47 PM New York time.

Now, that we have defined our three arguments, let’s execute the line of code below:

The following line of code is calling Yahoo finance API

For a recap, the line of code above is calling Yahoo finance API and requesting to get data for the last 22 hours, with an interval of 15 minutes.

And here is the output:

Output released using the code above.

The price has been updated instantly; I compared the data with the current values, on official websites and we matching.

Boom!

As you can see, you have an update released each second. For instance, if you look at the output above, the latest data provided are given for 5:40 PM and 03 seconds. If you re-run your kernel, the data will be updated again.

Mission accomplished.

Below you can get a 10 minutes tutorial video on how to get cryptocurrency data with further explanation and test it by yourselves at home:

Full Python Tutorial

And here the final output using Python and Plotly:

Final output: Live graph being updated over time.

I hope you enjoy the content and if you have any comment or want further details, feel free to let me know in the comment section.

Filed Under: Machine Learning

Primary Sidebar

Stay Ahead: The Latest Tech News and Innovations

Cryptocurrency Market Updates: What’s Happening Now

Emerging Trends in Artificial Intelligence: What to Watch For

Top Cloud Computing Services to Secure Your Data

The Future of Mobile Technology: Recent Advancements and Predictions

Footer

  • Privacy Policy
  • Terms and Conditions

Copyright © 2025 NEO Share

Terms and Conditions - Privacy Policy