Navigation

    Quantiacs Community

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

    Error Q20 output missing when submitting

    Strategy help
    4
    11
    1074
    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.
    • T
      TheFlyingDutchman last edited by

      Hello,

      I do keep getting an error when submitting a strategy in the Q20 competition. The output is missing. The write output line is include in my strategy. But it seems unable to write the weights.
      See also the value error below.
      What should i do to fix this? Thanks for the help!

      Best regards


      ValueError Traceback (most recent call last)
      <ipython-input-1-3ef89a333fa7> in <module>
      119 weights = qnout.clean(weights, data, "stocks_nasdaq100")
      120
      --> 121 stats = qnstats.calc_stat(data, weights.sel(time=slice("2006-01-01", None)))
      122 display(stats.to_pandas().tail())
      123 plot_performance(stats)

      /usr/local/lib/python3.7/site-packages/qnt/stats.py in calc_stat(data, portfolio_history, slippage_factor, roll_slippage_factor, min_periods, max_periods, per_asset, points_per_year)
      686 roll_slippage_factor = get_default_slippage(data)
      687
      --> 688 missed_dates = find_missed_dates(portfolio_history, data)
      689 if len(missed_dates) > 0:
      690 log_err("WARNING: some dates are missed in the portfolio_history")

      /usr/local/lib/python3.7/site-packages/qnt/stats.py in find_missed_dates(output, data)
      550 out_ts = np.sort(output.coords[ds.TIME].values)
      551
      --> 552 min_out_ts = min(out_ts)
      553
      554 data_ts = data.where(data.time >= min_out_ts)

      ValueError: min() arg is an empty sequence

      support V 2 Replies Last reply Reply Quote 1
      • support
        support @TheFlyingDutchman last edited by

        @theflyingdutchman Hi, it looks like you are getting some corner case. Can you send some more detail?

        T 1 Reply Last reply Reply Quote 0
        • T
          TheFlyingDutchman @support last edited by

          @support The number of the strategy submit attempt that is filterde out is # 14149002. What additional info should I send?

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

            @theflyingdutchman ok, thanks, we are checking the logs. It looks ok when run in a standard notebook container. Maybe it meets some corner case we did not think about when implementing submission filter. As soon as we find the reason, we will let you know. Sorry for the problem.

            T 1 Reply Last reply Reply Quote 0
            • T
              TheFlyingDutchman @support last edited by

              @support ok, thanks. Unfortunately I run into an error in the submitting process with another strategy as well. Could you please look into submit Number # 14265154? The precheck and backtest show no errors, but after submit the strategy shows inverted SR and weights. I am not sure whether this is related to the otter submit issue. Thanks for investigating these issues.

              support 1 Reply Last reply Reply Quote 0
              • V
                Vyacheslav_B @TheFlyingDutchman last edited by

                @theflyingdutchman

                Hello. try to execute in a separate cell the code which saves weights. This should help.
                As far as I understand, this can happen when there is no data for the first day.
                The cell where the error occurs will be ignored and the next one will be executed.

                qnout.check(weights, data, "stocks_nasdaq100")
                qnout.write(weights)
                
                T 1 Reply Last reply Reply Quote 1
                • support
                  support @TheFlyingDutchman last edited by

                  @theflyingdutchman hi, did you check for potential forward looking? For example using global means of indicators which are looking into the future?

                  Note that trades are taken at the OPEN, and you cannot use for example the CLOSE price of the same day.

                  In this case, you could see a result in the notebook but another one after submission, as the backtester used after submission will remove by brute force future data and produce a result which does not look into the future.

                  1 Reply Last reply Reply Quote 0
                  • T
                    TheFlyingDutchman @Vyacheslav_B last edited by

                    @vyacheslav_b The proposed solution worked, I was able to submit the strategy. Thanks for your help.

                    @support The strategy was still declined since there is no fundamental data before 1-1-2013. This strategy worked with fundamental data. Number is # 14333092. Wouldn't it be fair to shorten the required trade period for strategies based on fundamental data for Q20? Otherwise I won't be able to submit.

                    support V 2 Replies Last reply Reply Quote 0
                    • support
                      support @TheFlyingDutchman last edited by

                      @theflyingdutchman ok, thanks for the hint. It is the first contest using fundamental data, sorry for the issue.

                      We will see, but probably it is too late for changing the rules.

                      One pragmatic solution would be to use a "base" strategy until 2013, without fundamental data, until 2013, in a way that the Sharpe ratio is still larger than 1. Is it doable?

                      1 Reply Last reply Reply Quote 0
                      • V
                        Vyacheslav_B @TheFlyingDutchman last edited by

                        @theflyingdutchman

                        it can help you. See topic 3) Not enough bid information.

                        https://github.com/quantiacs/strategy-q20-nasdaq100-quick-start/blob/master/strategy.ipynb

                        def get_enough_bid_for(data_, weights_):
                            time_traded = weights_.time[abs(weights_).fillna(0).sum('asset') > 0]
                            is_strategy_traded = len(time_traded)
                            if is_strategy_traded:
                                return xr.where(weights_.time < time_traded.min(), data_.sel(field="is_liquid"), weights_)
                            return weights_
                        
                        
                        weights_new = get_enough_bid_for(data, weights)
                        weights_new = weights_new.sel(time=slice("2006-01-01",None))
                        
                        1 Reply Last reply Reply Quote 0
                        • O
                          orange.salmon last edited by

                          This post is deleted!
                          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