Navigation

    Quantiacs Community

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

    datatype for weights seems changed recently

    Support
    2
    3
    254
    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
      angusslq last edited by

      weights = qnbt.backtest(
          competition_type="stocks_s&p500",
          load_data=load_data,
          lookback_period=350,
          start_date="2006-01-01",
          strategy=strategy,
          window=window,
          analyze=True,
          check_correlation=False
      )
      
      

      In the old days, i can write using as below as per documentation

      qnout.write(weights)
      

      Since some days ago, the above doesn't work, i need to change to

      qnout.write(weights[0])
      

      to make it work again, does it expect? @support

      S 1 Reply Last reply Reply Quote 0
      • S
        stefanm @angusslq last edited by stefanm

        @angusslq Hi,

        The qnbt.backtest function you used can return only weights (as xarray.DataArray structure), or tuple (weights, state). It depends on your strategy() function, whether it has additional arguments (beside "data") or not. The "state" doesn't affect your weights if it hasn't been used in the strategy you passed, and in this case, the state is most likely None.

        Anyway, it's not necessary to call write() function from qnt.output module after calculating weights using qnt.backtester, since the backtest() function already calls write() function, so the weights have been written automatically.

        A 1 Reply Last reply Reply Quote 0
        • A
          angusslq @stefanm last edited by

          @stefanm Thank you for the details

          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