Sign up with your email address to be the first to know about new publications

Power BI and Bitcoin Price

In this notebook, you will extract information about the current Bitcoin price in the Binance exchange and send it to a Power BI dataset.

You can download the notebook from this link. In the following posts, we will add Azure Function instead of Jupyter Notebooks.

In this demo, you will extract the Bitcoin Price using the API from cryptocurrency exchange Binance (1) Power BI Rest API with Jupyter Notebooks (2) to finally publish the information into a Power BI dashboard (3).

End Goal: display real time information in Power BI.

In [ ]:
#Import Libraries
import requests
import json
from IPython.display import HTML
from time import sleep
from urllib.request import urlopen
from datetime import datetime, timedelta
Get Information from the Binance Exchange using the API

Binance API can be find in

In [3]:
BinanceResponse = requests.get('').json()

BinanceConvert = json.dumps(BinanceResponse)
BinanceData = json.loads(BinanceConvert)

{'symbol': 'BTCUSDT', 'price': '3959.72000000'}
Creating & Setting up the Power BI Push Url

Create a dataset with the following columns:

  1. Timestamp (Datetime)
  2. Price (Number)

Copy the dataset endpoint.

#Paste the report end point copied above
Power_BI_Endpoint = ''
#Repeat for ever
while True:
    # The timestamp needs to be formatted correctly
    now = datetime.strftime(, "%Y-%m-%dT%H:%M:%SZ")
    # Acquire data from the exchange
    BinanceResponse = requests.get('').json()

    # Get values from Json response
    BinanceConvert = json.dumps(BinanceResponse)
    BinanceData = json.loads(BinanceConvert)
    #Format request Json body
    Rows = '[{{ "Timestamp": "{0}", "Price": "{1}" }}]'.format(now, Binanceprice)
    # make HTTP POST request to Power BI REST API
    import urllib.request as ur
    req =, Rows)
    # Wait 1 second
Creating Dashboard and streaming real time information
  1. Create Dashboard
  2. Add Tile




2 Responses
  • Sandrix
    10 . 01 . 2019

    Good post! Very interesting for beginers.

    • David Alzamendi
      22 . 01 . 2019

      Thank you!

Do you want to leave a comment?

Your email address will not be published. Required fields are marked *