Navigation

    Quantiacs Community

    • Register
    • Login
    • Search
    • Categories
    • News
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Additional Data for Bitcoin

    Request New Features
    2
    7
    687
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      antinomy last edited by

      Hello,

      in addition to the usual price data there are many informations about Bitcoin (and other cryptos) available. I would find it great if you could add historical data for hashrate, difficulty, market cap and so on.
      As an example here is a free dataset on Quandl I'm currently experimenting with.

      Could you provide a dataset like that on the platform?

      Regards

      support 1 Reply Last reply Reply Quote 1
      • support
        support @antinomy last edited by

        @antinomy Hello, thanks for the input, yes, we will add these data to our lists of tasks and notify you as soon as they are implemented

        A 1 Reply Last reply Reply Quote 0
        • A
          antinomy @support last edited by

          @support
          Cool, thanks!

          1 Reply Last reply Reply Quote 0
          • A
            antinomy last edited by

            @support I see you added data from blockchain.com. That's great, thanks!

            For anyone who wants to check it out

            import qnt.data as qndata
            import pandas as pd
            
            # to get an overview of the datasets:
            bchain_datasets = qndata.blockchaincom_load_list()
            pd.DataFrame(bchain_datasets).set_index('id')
            
            # access data, e.g. hash rate (use the 'id' field for the request):
            hash_rate = qndata.blockchaincom_load_data('hash-rate', tail=365)
            

            (If you develop locally make sure you have the latest qnt library, as of now it would be
            conda install quantiacs-source::qnt=0.0.262)

            support 1 Reply Last reply Reply Quote 1
            • support
              support @antinomy last edited by

              @antinomy Thanks, they are going to be part of the new contest.

              A 1 Reply Last reply Reply Quote 0
              • A
                antinomy @support last edited by

                @support I'm having trouble using blockchain data with the backtester.
                An example code:

                import qnt.backtester as qnbt
                import qnt.data as qndata
                import numpy as np
                import xarray as xr
                
                
                def load_data(period):
                    crypto = qndata.cryptofutures.load_data(tail=period)
                    hr = qndata.blockchaincom_load_data('hash-rate', tail=period)
                
                    return {
                        'crypto': crypto,
                        'hr': hr
                    }, crypto.time.values
                
                
                def build_data_for_one_step(data, max_date: np.datetime64, lookback_period: int):
                    min_date = max_date - np.timedelta64(lookback_period, "D")
                    return {
                        "crypto": data["crypto"].sel(time=slice(min_date, max_date)),
                        "hr": data["hr"].sel(time=slice(min_date, max_date)),
                    }
                
                def strategy(data):
                    return xr.ones_like(data['crypto'].sel(field='close').isel(time=-1))
                
                weights = qnbt.backtest(
                    strategy=strategy,
                    competition_type="cryptofutures",
                    load_data=load_data,
                    lookback_period=500,
                    start_date='2014-01-01',
                    window=build_data_for_one_step,
                )
                
                

                This raises a HTTP error 500 when the backtester tries to run the first pass:

                [...]

                Run first pass...
                Load data...

                100% (17072 of 17072) |##################| Elapsed Time: 0:00:00 Time: 0:00:00
                ERROR:root:download error: blockchain.com/data?id=hash-rate
                Traceback (most recent call last):
                File "/root/book/qnt/data/common.py", line 79, in request_with_retry
                with urllib.request.urlopen(req, timeout=TIMEOUT) as response:
                File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
                return opener.open(url, data, timeout)
                File "/usr/local/lib/python3.7/urllib/request.py", line 531, in open
                response = meth(req, response)
                File "/usr/local/lib/python3.7/urllib/request.py", line 641, in http_response
                'http', request, response, code, msg, hdrs)
                File "/usr/local/lib/python3.7/urllib/request.py", line 569, in error
                return self._call_chain(*args)
                File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
                result = func(*args)
                File "/usr/local/lib/python3.7/urllib/request.py", line 649, in http_error_default
                raise HTTPError(req.full_url, code, msg, hdrs, fp)
                urllib.error.HTTPError: HTTP Error 500: Internal Server Error
                ERROR:root:download error: blockchain.com/data?id=hash-rate

                1 Reply Last reply Reply Quote 0
                • A
                  antinomy last edited by

                  @support It's working now, thanks!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB | Contributors
                  • Documentation
                  • About
                  • Career
                  • My account
                  • Privacy policy
                  • Terms and Conditions
                  • Cookies policy
                  Home
                  Copyright © 2014 - 2021 Quantiacs LLC.
                  Powered by NodeBB | Contributors