Bitcoin Magazine Pro API

The latest enhancement to elevate the Bitcoin Magazine Pro experience for Pro users - seamless access to a wealth of insightful data directly from our platform.

Whether you're part of a research team, a trader, or a casual Bitcoin enthusiast interested in exploring the intricate details of Bitcoin performance, our API is tailored to meet your needs.

If you're new to using API services, explore our tutorial on how to quickly begin accessing data from the Bitcoin Magazine Pro API.

Making an API Request

Our API supports two methods for authorizing requests: using the API key as part of the header and embedding the API key into the URL. While both methods are supported, we strongly recommend utilizing the header method for its enhanced security features.

Header Authorization:

When making requests, you can include your API key as part of the header. This method is preferred due to its security benefits. By transmitting the API key via the header, you ensure that sensitive information is not exposed in the URL, reducing the risk of interception or unauthorized access. Additionally, headers are commonly used for authentication purposes in web applications, making this method more aligned with standard security practices.

To include your API key in the header, add the following header to your requests:

Authorization: Bearer your_api_key

URL Parameter:

Alternatively, you can embed your API key directly into the URL. While this method is supported, it is not recommended due to the inherent security risks associated with transmitting sensitive information in the URL. By including your API key in the URL, you expose it to potential interception, unauthorized access, and other security threats. As a result, we strongly advise against using this method for making requests.

Example URL with embedded API key:

https://api.bitcoinmagazinepro.com/metrics?key=your_api_key

Available Metrics

To retrieve a list of available metrics supported by our API, you can utilize the following endpoint:

https://api.bitcoinmagazinepro.com/metrics

Appending `?hourly=1` to the above endpoint would return only hourly metrics, example:

https://api.bitcoinmagazinepro.com/metrics?hourly=1

The returned response will include the names of each available metric.

Example code:

        import requests

        def fetch_metrics(api_key):
            url = "https://api.bitcoinmagazinepro.com/metrics"
            headers = {'Authorization': f'Bearer {api_key}'}
        
            try:
                response = requests.get(url, headers=headers)
                response.raise_for_status()  # Raise an exception for 4xx or 5xx errors
                data = response.json()
                return data
            except requests.exceptions.RequestException as e:
                print(f"Error fetching data: {e}")
                return None
        
        # Replace 'YOUR_API_KEY' with your actual API key
        api_key = 'YOUR_API_KEY'
        
        metric_data = fetch_metrics(api_key)
        if metric_data:
            print("Metrics data:")
            print(metric_data)
        

Fetching data for a specific metric

Once you have identified the desired metric from the list of available metrics, you can retrieve its data using the following endpoint:

https://api.bitcoinmagazinepro.com/metrics/{metric_name}

Replace {metric_name} with the name of the desired metric.

This endpoint allows you to fetch historical data for a specific metric. By specifying the desired metric in the endpoint URL, you can retrieve relevant data points over a specified time period.

Example code:

        import io
        import pandas as pd
        import requests

        def fetch_metric_data(api_key, metric_name):
            url = f"https://api.bitcoinmagazinepro.com/metrics/{metric_name}"
            headers = {'Authorization': f'Bearer {api_key}'}
        
            try:
                response = requests.get(url, headers=headers)
                response.raise_for_status()  # Raise an exception for 4xx or 5xx errors
                data = response.json()
                return data
            except requests.exceptions.RequestException as e:
                print(f"Error fetching data: {e}")
                return None
        
        # Replace 'YOUR_API_KEY' with your actual API key
        api_key = 'YOUR_API_KEY'
        metric_name = '200wma-heatmap'
        
        metric_data = fetch_metric_data(api_key, metric_name)
        if metric_data:
            print(f"\nData for metric '{metric_name}':", end="\n\n")
            # Load the data into a pandas DataFrame
            df = pd.read_csv(
                io.StringIO(metric_data),
                index_col=0,
            )
            print(df)
        

Hourly Data

The following metrics are available with hourly data, simply add &hourly=1 to the end of your request URL.

Metric
fr-average
fr-binance
fr-bitfinex
fr-bitmex
fr-bybit
fr-okx
golden-ratio
200wma-heatmap
investor-tool
pi-cycle-top
profitable-days