Navigation

    Quantiacs Community

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

    Trend following strategy BUG

    Strategy help
    2
    3
    208
    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.
    • magenta.grimer
      magenta.grimer last edited by

      Hi!

      Trend based strategy yields

      ValueError                                Traceback (most recent call last)
      <ipython-input-8-2c74c3293472> in <module>
           72     lookback_period=5 * 365,
           73     start_date='2006-01-01',
      ---> 74     strategy=strategy
           75 )
      
      ~/book/qnt/backtester.py in backtest(competition_type, strategy, load_data, lookback_period, test_period, start_date, window, step, analyze, build_plots, collect_all_states)
           86     log_info("Load data for cleanup...")
           87     data = qndata.load_data_by_type(competition_type, assets=result.asset.values.tolist(), tail=60)
      ---> 88     result = qnout.clean(result, data)
           89     result.name = competition_type
           90     log_info("Write result...")
      
      ~/book/qnt/output.py in clean(output, data, kind, debug)
           61         if single_day:
           62             output = output.drop(ds.TIME, errors='ignore')
      ---> 63             output = xr.concat([output], pd.Index([data.coords[ds.TIME].values.max()], name=ds.TIME))
           64         else:
           65             log_info("ffill if the current price is None...")
      
      /usr/local/lib/python3.7/site-packages/numpy/core/_methods.py in _amax(a, axis, out, keepdims, initial, where)
           37 def _amax(a, axis=None, out=None, keepdims=False,
           38           initial=_NoValue, where=True):
      ---> 39     return umr_maximum(a, axis, None, out, keepdims, initial, where)
           40 
           41 def _amin(a, axis=None, out=None, keepdims=False,
      
      ValueError: zero-size array to reduction operation maximum which has no identity
      
      magenta.grimer 1 Reply Last reply Reply Quote 0
      • magenta.grimer
        magenta.grimer @magenta.grimer last edited by

        @magenta-grimer trend following strategy created on 27 nov 2020

        support 1 Reply Last reply Reply Quote 1
        • support
          support @magenta.grimer last edited by

          @magenta-grimer

          Hello.

          I confirm this bug.
          It is fixed now.
          If you clone this template again, it will work ok.

          Thank you very much for your report.

          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