Navigation

    Quantiacs Community

    • Register
    • Login
    • Search
    • Categories
    • News
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. EDDIEE
    E
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 18
    • Best 5
    • Groups 0
    • Blog

    EDDIEE

    @EDDIEE

    5
    Reputation
    9
    Profile views
    18
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    EDDIEE Follow

    Best posts made by EDDIEE

    • Q17 Neural Networks Algo Template; is there an error in train_model()?

      In the function "train_model()" the for-loop "for asset_name in asset_name_all:" finishes before the model-optimization. So basically the optimized LSTM neural network is always based on the last asset. This can't be on purpose, can it?

      best
      eduard

      def train_model(data):
      """
      train the LSTM network
      """

      asset_name_all = data.coords['asset'].values
      
      features_all = get_features(data)
      target_all = get_target_classes(data)
      
      model = get_model()
      
      for asset_name in asset_name_all:
          
          # drop missing values:
          target_cur = target_all.sel(asset=asset_name).dropna('time', 'any')
          features_cur = features_all.sel(asset=asset_name).dropna('time', 'any')
      
          # align features and targets:
          target_for_learn_df, feature_for_learn_df = xr.align(target_cur, features_cur, join='inner')
          
      criterion = nn.MSELoss() # define loss function
      
      optimiser = optim.LBFGS(model.parameters(), lr=0.08) # we use an LBFGS solver as optimiser
      epochs = 1 #how many epochs 
      for i in range(epochs):
              def closure(): # reevaluates the model and returns the loss (forward pass)
                  optimiser.zero_grad()
                  
                  #input tensor
                  in_ = torch.zeros(1,len(feature_for_learn_df.values))
                  in_[0,:]=torch.tensor(np.array(feature_for_learn_df.values))
                  
                  #output
                  out = model(in_)
                  
                  #target tensor
                  target = torch.zeros(1,len(target_for_learn_df.values))
                  target[0,:]=torch.tensor(np.array(target_for_learn_df.values))
                  
                  #evaluate loss
                  loss = criterion(out, target)
                  loss.backward()
                  
                  return loss
              optimiser.step(closure) #updates weights
              
      return model
      posted in Strategy help
      E
      EDDIEE
    • Q17 Machine learning - RidgeRegression (Long/Short); there is an error in the code

      The loop "for asset_name in asset_name_all:" creates a model for each asset, but the individual models are never saved. At the end, the model for the last asset is returned and all the predictions are created based on this last model (asset 'XRP').

      def train_model(data):
      """Create and train the models working on an asset-by-asset basis."""

      asset_name_all = data.coords['asset'].values
      
      data = data.sel(time=slice('2013-05-01',None)) # cut the noisy data head before 2013-05-01
      
      features_all = get_features(data)
      target_all = get_target_classes(data)
      
      model = create_model()
      
      for asset_name in asset_name_all:
          
          # drop missing values:
          target_cur = target_all.sel(asset=asset_name).dropna('time', 'any')
          features_cur = features_all.sel(asset=asset_name).dropna('time', 'any')
      
          # align features and targets:
          target_for_learn_df, feature_for_learn_df = xr.align(target_cur, features_cur, join='inner')
      
          if len(features_cur.time) < 10:
              # not enough points for training
              continue
      
          
          
          try:
              model.fit(feature_for_learn_df.values, target_for_learn_df)
          except KeyboardInterrupt as e:
              raise e
          except:
              logging.exception('model training failed')
      
      return model
      posted in Strategy help
      E
      EDDIEE
    • RE: Local Development Error "No module named 'qnt'"

      Thanks for your support, I really appreciate, together we are better! 🙂

      This is how I solved the step four issue:

      84d48667-ba93-4ee2-8e09-413d97179593-image.png

      Kind Regards
      Eddie

      posted in Support
      E
      EDDIEE
    • Q17 Contest: When will you update the performance of the strategies?

      The last day shown ist currenty August 2th.
      Best
      Eddie

      posted in Support
      E
      EDDIEE
    • Local Development Error "No module named 'qnt'"

      Hi guys, local development doesn't work.
      I followed all the steps for installing local development.

      I run "conda activate qntdev"
      Then I create a Jupyter Notebook in this folder:
      "C:\Users\baiti\anaconda3\envs\qntdev"

      But when I run this Notebook I get always the error: "No module named 'qnt'"

      Can you help me out?

      Best
      Eddie

      posted in Support
      E
      EDDIEE

    Latest posts made by EDDIEE

    • Q19 Contest

      Dear Quantiacs Team,
      I have some questions on the Q19 Contest.

      Are the rules and the stocks universe exactly the same as in the Q18 contest? If yes, why?

      Can I use the codes from the Q18 contest for the search of investment strategies or are code adjustments necessary?

      Best
      Eddie

      posted in General Discussion
      E
      EDDIEE
    • RE: Calculation time exceeded

      I have numerous submissions with "calculation time exceeded".
      Just to be on the safe side, do I have to actively resubmit those strategies or is it not necessary?

      posted in Request New Features
      E
      EDDIEE
    • RE: Q18 testing

      @support Thanks a lot!

      posted in Support
      E
      EDDIEE
    • Why is the "is_liquid" dataset flawed?

      Dear Quantiacs Team, why is the "is_liquid" dataset flawed?
      Especially in the first years, the sum of liquid assets just drops to zero (for one day!) several times. Some investment strategies, I backtested, are screwed up by this issue. These strategies have a certain time dependency and are just reset to zero from one day to another.

      bfa0b912-045b-40aa-b18b-1720bbe6ea99-image.png

      posted in Strategy help
      E
      EDDIEE
    • How does "qnbt.backtest_ml" really work?

      Specifically, I am interested in the exact time period of the first train period.

      In this example, the train period equals 4x365 days and the backtest starts at 2006-01-01.
      Does is it mean that the first train period spans from 2006-01-01 to 2009-12-31?
      So the first four years of the backtest periods are actually in-sample predictions?

      When the model is retrained every 5x365th day, is the train period always 4x365 days long (rolling window)? Is it possible to implement the expanding window approach for model retraining?

      weights = qnbt.backtest_ml(
      train=train_model,
      predict=predict,
      train_period=4x365, # the data length for training in calendar days
      retrain_interval=5x365, # how often we have to retrain models (calendar days)
      retrain_interval_after_submit=50, # how often retrain models after submission during evaluation (calendar days)
      predict_each_day=True, # Is it necessary to call prediction for every day during backtesting?
      competition_type='stocks_nasdaq100', # competition type
      lookback_period=365, # how many calendar days are needed by the predict function to generate the output
      start_date='2006-01-01', # backtest start date
      build_plots=True # do you need the chart?
      )

      posted in Strategy help
      E
      EDDIEE
    • RE: Q18 testing

      I have a different issue with testing and submitting.

      I tested my strategy (Ridge Regression, random state = 18) with multi-pass backtesting using qnbt.backtest_ml. The Sharpe Ratio is 1.13, there is no forward looking, because the Sharpe Ratio is the same when predict_each_day is set to True.

      Now comes the problem: I submitted this strategy (written in multi-pass backtesting format) and this strategy always gets rejected, because the Sharpe Ratio is drastically smaller 1 (exactly
      0.49).

      Why is there such a big difference in the Sharpe Ratio?

      weights = qnbt.backtest_ml(
      train=train_model,
      predict=predict,
      train_period=4x365, # the data length for training in calendar days
      retrain_interval=5x365, # how often we have to retrain models (calendar days)
      retrain_interval_after_submit=50, # how often retrain models after submission during evaluation (calendar days)
      predict_each_day=True, # Is it necessary to call prediction for every day during backtesting?
      # Set it to true if you suspect that get_features is looking forward.
      competition_type='stocks_nasdaq100', # competition type
      lookback_period=365, # how many calendar days are needed by the predict function to generate the output
      start_date='2006-01-01', # backtest start date
      build_plots=True # do you need the chart?
      )

      posted in Support
      E
      EDDIEE
    • Q17 Contest: When will you update the performance of the strategies?

      The last day shown ist currenty August 2th.
      Best
      Eddie

      posted in Support
      E
      EDDIEE
    • RE: Strategy Optimization in local development environment is not working

      @vyacheslav_b said in Strategy Optimization in local development environment is not working:

      result = qnop.optimize_strategy(
      data,
      single_pass_strategy,
      qnop.full_range_args_generator(
      wma_period=range(10, 20, 5), # min, max, step
      roc_period=range(5, 15, 5) # min, max, step
      ),
      workers=1 # you can set more workers when you run this code on your local PC to speed it up
      )

      I tried other ranges, it still doesn't work, any ideas? 🙂

      5fff3686-5c1d-4b74-b479-d9a786c479d1-image.png

      posted in Support
      E
      EDDIEE
    • Strategy Optimization in local development environment is not working

      Dear Support Team, I can not replicate the optimization example in the local development environment. My code just got stuck in the first iteration, I waited 8 hours and absolutely nothing happened. Do you have any idea?
      Best
      Eddie

      125cf23b-3984-4891-bf6d-aa772c246d8a-image.png

      posted in Support
      E
      EDDIEE
    • RE: Local Development Error "No module named 'qnt'"

      Hello friends,

      how can I update my local development to the Q18 contest? Loading nasdaq data doesn't work.

      Best
      Eddie

      d5d6e054-58ea-4573-b8e6-9b1a3025deae-image.png

      posted in Support
      E
      EDDIEE
    • Documentation
    • About
    • Career
    • My account
    • Privacy policy
    • Terms and Conditions
    • Cookies policy
    Home
    Copyright © 2014 - 2021 Quantiacs LLC.
    Powered by NodeBB | Contributors