Navigation

    Quantiacs Community

    • Register
    • Login
    • Search
    • Categories
    • News
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Popular
    Log in to post
    • All categories
    • Support
    •      Request New Features
    • Strategy help
    • General Discussion
    • News and Feature Releases
    • All Topics
    • New Topics
    • Watched Topics
    • Unreplied Topics
    • All Time
    • Day
    • Week
    • Month
    • P

      Holding period, execution simulation, feedback from live Quantiacs trading?
      General Discussion • • Penrose-Moore

      4
      0
      Votes
      4
      Posts
      690
      Views

      P

      @support yes coarse heuristics work well as long as you are conservative. For shorter term models I have started using minute bars despite the computational hit, because it helps in a lot of other ways.

      I may enter this contest, I am pretty rusty on predictive modelling and I am not sure I can do a good job using just daily prices, there is not a lot of data. I used to work at a CTA and I feel like we wasted a lot of man years using only prices, hoping better models would acheive more alpha. in the end the sharpe is similar to the S&P but uncorrelated, but you have gotten there with some simpler models and enjoyed life.

      I have some other questions about the platform and the contest that I will post here.

      Best
      P.M.

    • L

      Windows or Linux?
      Strategy help • • laudis

      4
      0
      Votes
      4
      Posts
      612
      Views

      L

      Thanks !

    • V

      Example strategy for Q19
      Support • • vg2001

      4
      0
      Votes
      4
      Posts
      517
      Views

      support

      @vg2001 Hello, the Q19 is a replica of the Q18, you ccan use the same examples.

    • magenta.grimer

      Help !
      Support • • magenta.grimer

      4
      0
      Votes
      4
      Posts
      511
      Views

      A

      @magenta-grimer There are 2 things you might want to change:

      1: the lookback_period is 365 but you want a 400-day SMA. This will only produce NaNs, so the boolean array sma20 < sma20_crypto will be False everywhere resulting in -1 weights. 2*365 as lookback does the trick for these settings.

      2: Bitcoin is trading 24/7, futures aren't. Better use crypto.time.values instead of futures.time.values for the output of load_data.

      There might be something else that I didn't catch but the resulting sharpe is at least close to what would be expected (1.109 with 5 and 385)

    • magenta.grimer

      Optimizer for simple MA crypto strategy
      Strategy help • • magenta.grimer

      4
      0
      Votes
      4
      Posts
      786
      Views

      A

      There is a way to use the optimizer with a (stateful) mulit pass algo, but depending on the total number of changed parameters it can take a very long time. However, if it runs on a local computer with many workers this can still be useful.

      We could run the backtester with the multi pass algo to get all the weights for the test period and pass these weights to the optimizer.
      There's just one problem with this: you can't pass changed parameters to the strategy using the backtester.
      In order to solve this I created a nested function where the outer function takes the changed parameters from the optimizer. The inner function is the actual multi pass strategy and doesn't define the params but just uses the ones from the outer function. Still within the outer function we run the backtester with one set of params, get the weights it returns and return them to the optimizer.

      The time it takes to run the optimization would roughly be
      (time for 1 multi pass backtest) x (total number of parameter changes) / (number of workers that are able to run)
      So if one multi pass takes 1 minute, you want to optimize 10 parameter changes and can run 5 workers it would take about 2 minutes.

      Here's an example based on the one above with 2 parameter changes and 2 workers:

      import qnt.data as qndata import qnt.ta as qnta import qnt.optimizer as qnop import qnt.backtester as qnbt import xarray as xr def load_data(period): """Loads the BTC Futures data for the BTC Futures contest""" return qndata.cryptofutures.load_data(tail=period, dims=("time", "field", "asset")) def multi_pass_strategy(data, ma_slow_param=50, ma_fast_param=10): """The outer function gets called by the optimizer with changed params, the inner function gets passed to the backtester.""" def strategy(data, state): # The state isn't used in this example, this is just to show that it can be used while optimizing. if state is None: state = 0 state += 1 close = data.sel(field="close") ma_slow = qnta.lwma(close, ma_slow_param).isel(time=-1) ma_fast = qnta.lwma(close, ma_fast_param).isel(time=-1) weights = xr.zeros_like(close.isel(time=-1)) weights[:] = 1 if ma_fast > ma_slow else -1 return weights, state """The backtester returns all weights for the test period which will then be returned to the optimizer""" weights, state = qnbt.backtest( strategy=strategy, competition_type="cryptofutures", load_data=load_data, lookback_period=700, start_date='2014-01-01', build_plots=False, ) return weights data = qndata.cryptofutures.load_data(min_date='2014-01-01') result = qnop.optimize_strategy( data, multi_pass_strategy, qnop.full_range_args_generator( ma_slow_param=range(50, 60, 5), # min, max, step # ma_fast_param=range(5, 100, 5) # min, max, step ), workers=2 # you can set more workers on your PC ) print("---") print("Best iteration:") print(result['best_iteration']) qnop.build_plot(result)

      There might be more efficient ways to do this, so if anyone has one feel free to post it here.

    • M

      Printing training performance of neural network models
      Support • • multi_byte.wildebeest

      4
      1
      Votes
      4
      Posts
      2559
      Views

      V

      @multi_byte-wildebeest Hello. I don't use machine learning models in trading.

    • nosaai

      Local Development with Notifications
      Support • • nosaai

      4
      0
      Votes
      4
      Posts
      705
      Views

      A

      It's safe to ignore these notices but if they bother you, you can set the variables together with your API key using the defaults and the messages go away:

      import os os.environ['API_KEY'] = 'YOUR-API-KEY' os.environ['DATA_BASE_URL'] = 'https://data-api.quantiacs.io/' os.environ['CACHE_RETENTION'] = '7' os.environ['CACHE_DIR'] = 'data-cache'
    • S

      Pairs trading with states iterations
      Strategy help • • spancham

      4
      0
      Votes
      4
      Posts
      841
      Views

      S

      @support
      Cool, thanks very much! 👍

    • cespadilla

      Question about the Q17 Machine Learning Example Algo
      Strategy help • • cespadilla

      4
      1
      Votes
      4
      Posts
      1062
      Views

      V

      @cespadilla Hello.

      The reason is in "train_model" function.

      def train_model(data): asset_name_all = data.coords['asset'].values features_all = get_features(data) target_all = get_target_classes(data) models = dict() 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') target_for_learn_df, feature_for_learn_df = xr.align(target_cur, features_cur, join='inner') if len(features_cur.time) < 10: continue model = get_model() try: model.fit(feature_for_learn_df.values, target_for_learn_df) models[asset_name] = model except: logging.exception('model training failed') return models

      If there are less than 10 features for training the model, then the model is not created (if len(features_cur.time) < 10).

      This condition makes sense. I would not remove it.

      The second thing that can affect is the retraining interval of the model ("retrain_interval").

      weights = qnbt.backtest_ml( train=train_model, predict=predict_weights, train_period=2 *365, # the data length for training in calendar days retrain_interval=10 *365, # how often we have to retrain models (calendar days) retrain_interval_after_submit=1, # how often retrain models after submission during evaluation (calendar days) predict_each_day=False, # 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='crypto_daily_long_short', # competition type lookback_period=365, # how many calendar days are needed by the predict function to generate the output start_date='2014-01-01', # backtest start date analyze = True, build_plots=True # do you need the chart? )
    • E

      Improving Quantiacs: Aligning Developer Objectives with the ones of Quantiacs
      General Discussion • developers improvement quantiacs rankings risk • • EDDIEE

      4
      3
      Votes
      4
      Posts
      1130
      Views

      N

      @eddiee Hi, Mr. Eddie.

      I am new to building strategies using ML/DL on Quantiacs and am very impressed with the OS performance of your ML strategies. I hope you can give me your contact (mail, limkedin,...) so I can learn from your experience in building an ML/DL strategy.

      Sincerely thank.

    • X

      allocations and orders
      General Discussion • • xiaolan

      4
      0
      Votes
      4
      Posts
      660
      Views

      support

      @xiaolan Yes, allocations are translate to orders internally, it is enough to check the variation in the allocations and transform it into number of contracts bought/sold. When we designed the toolbox the goal was to simplify development as much as possible for the users.

    • E

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

      4
      1
      Votes
      4
      Posts
      681
      Views

      support

      @theflyingdutchman Hello, before the end of the week the update will be ready, sorry for the delay

    • C

      How to change 'iopub_data_rate_limit'
      Support • • cyan.gloom

      3
      0
      Votes
      3
      Posts
      889
      Views

      C

      @support
      Thanks !

    • R

      Limit to submission number
      General Discussion • • rezhak21

      3
      0
      Votes
      3
      Posts
      547
      Views

      R

      @support thanks, yes....

    • J

      Local SSH development
      General Discussion • • Joshua408

      3
      0
      Votes
      3
      Posts
      472
      Views

      support

      @joshua408 We allow development on our cloud or local development on user's machines. No need to open any port.

    • E

      Q19 Contest
      General Discussion • • EDDIEE

      3
      0
      Votes
      3
      Posts
      1388
      Views

      support

      @eddiee Dear Eddiee, yes, the rules and the universe are the same. We will need some more time to extend the universe and the data set, so we decided to run a new contest with the same rules.

      Please note that according to the rules at https://quantiacs.com/contest/19

      A Trading System will be deemed to be a “unique“ Trading System if it was not submitted by the same user to a previous Contest and it was not published by the Sponsor itself and it was not submitted by another user to a previous Contest or to the current Contest. The Sponsor will run on submissions a correlation filter and will have to right to disqualify submissions which are not deemed to be unique.

      So re-submitting the same system will result into a system which is not eligible for a prize.

    • magenta.grimer

      Can't apply optimizer to another simple strategy!
      Strategy help • • magenta.grimer

      3
      0
      Votes
      3
      Posts
      476
      Views

      support

      @magenta-grimer

      Hello.

      Remove .isel(time=-1).

      ma_slow = close.rolling(time=parameter1).mean() #.isel(time=-1) ma_fast = close.rolling(time=parameter2).mean()#.isel(time=-1)

      It selects the last day, you need an entire series.

      Regards.

    • magenta.grimer

      Trend following strategy BUG
      Strategy help • • magenta.grimer

      3
      0
      Votes
      3
      Posts
      582
      Views

      support

      @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.

    • A

      Bollinger Bands
      Strategy help • • anthony_m

      3
      0
      Votes
      3
      Posts
      1478
      Views

      A

      @antinomy wow, thank you so much, this is awesome!

    • M

      Technical indicators
      Strategy help • • maxime

      3
      0
      Votes
      3
      Posts
      444
      Views

      M

      @support Thank you, yes, this is what I was looking for

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