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
    • A

      Correlation fails although Sharpe ratio > 1
      Support • • agent.hitmonlee

      4
      0
      Votes
      4
      Posts
      546
      Views

      A

      Thanks for the answer!

      I still think something is wrong with this correlation checker. I even used this function to randomize the weights a few times, and I got the same correlation error:

      def add_random_noise(weights, noise_level=0.01): noise = np.random.uniform(-noise_level, noise_level, size=weights.shape) return weights + noise

      I am pretty sure it's impossible to have 90% correlation in this case.

    • D

      Kelly criterion
      Support • • dark.pidgeot

      4
      0
      Votes
      4
      Posts
      717
      Views

      support

      @dark-pidgeot Yes, of course. Please note that we do not implement leverage, and the sum of the absolute values of the weights has to be equal or smaller than 1. If it is larger, they will be rescaled down.

    • R

      Processing Time
      General Discussion • • rezhak21

      4
      0
      Votes
      4
      Posts
      1476
      Views

      R

      @support ok, thank you!

    • T

      Calculation time exceeded on submission
      Support • • TheFlyingDutchman

      4
      1
      Votes
      4
      Posts
      1005
      Views

      V

      @theflyingdutchman Hello,

      Another option is to rewrite your strategy for a single-pass version before submitting it. This approach will significantly speed up the calculations. However, it's important to note that the actual statistical values can only be tracked after submitting the strategy to the competition.

      For example:
      https://github.com/quantiacs/strategy-ml-crypto-long-short/blob/master/strategy.ipynb

      To adapt this strategy for a single-pass version, follow these steps:

      Comment out or delete the line where qnbt.backtest_ml is used. Insert the following code: import xarray as xr import qnt.ta as qnta import qnt.data as qndata import qnt.output as qnout import qnt.stats as qnstats retrain_interval = 3*365 + 1 data = qndata.stocks.load_ndx_data(tail=retrain_interval) models = train_model(data) weights = predict(models, data) In a new cell, insert code to save the weights: qnout.write(weights)

      To view the strategy's statistics, use the following code in a new cell:

      # Calculate stats stats = qnstats.calc_stat(data, weights) display(stats.to_pandas().tail()) # Graph performance = stats.to_pandas()["equity"] import qnt.graph as qngraph qngraph.make_plot_filled(performance.index, performance, name="PnL (Equity)", type="log")

      The qnbt.backtest_ml function is a unique tool for evaluating machine learning strategies, which stands out from what is offered on other platforms. It allows users to set retraining intervals and analyze statistical metrics of the strategy, as opposed to the traditional evaluation of the machine learning model. This provides a deeper understanding of the strategy's effectiveness under various market conditions.

    • nosaai

      AttributeError: module 'qnt.data' has no attribute 'stocks_load_spx_data'
      Support • • nosaai

      4
      0
      Votes
      4
      Posts
      2456
      Views

      nosaai

      @vyacheslav_b Apologies for the late response. Thanks for the assistance, all is now well. Cheers

    • O

      Can I use astronomical data as features for my machine learning model?
      Support • • omohyoid

      4
      0
      Votes
      4
      Posts
      1159
      Views

      O

      @support Thx for ur reply

    • S

      Stocks strategy
      Strategy help • • spancham

      4
      0
      Votes
      4
      Posts
      1058
      Views

      support

      @sheikh Hi, when it comes to stocks and historical simulations, the biggest issue is dealing with survivorship bias. The stock universe must include also stocks which have been delisted and we need to define trading rules which allow for trading instruments which make sense at each point in time. This week we are announing a new contest which is preparing the ground for stocks.

    • M

      Why we need to limit the time to process the strategy ?
      Support • • multi_byte.wildebeest

      4
      0
      Votes
      4
      Posts
      736
      Views

      support

      @multi_byte-wildebeest Hi, these limitations refer to the processing time per point in time, not for the full strategy.

      If it takes 10 minutes per historical day, and the simulation has to take into account 250 days for let us say 10 years, the multi-pass simulation would process 6 days per hour, 144 days per real day, that means 2 weeks of processing time for the full submission, it is a lot of time.

    • magenta.grimer

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

      4
      0
      Votes
      4
      Posts
      1060
      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.

    • A

      Jupyter/Jupyter Lab are not working for code editing/running
      Support • • AlgoQuant

      4
      0
      Votes
      4
      Posts
      1330
      Views

      support

      @captain-nidoran Fixed, sorry for issue

    • S

      Pairs trading with states iterations
      Strategy help • • spancham

      4
      0
      Votes
      4
      Posts
      1077
      Views

      S

      @support
      Cool, thanks very much! 👍

    • N

      SMA Example
      Support • • Nikos84

      4
      0
      Votes
      4
      Posts
      642
      Views

      N

      @support Thank you!

    • O

      How long will the submission of a strategy take?
      Support • • omohyoid

      4
      0
      Votes
      4
      Posts
      651
      Views

      support

      Dear @quani42,

      Your submissions are in the queue and will be processed. Also, all submissions that are sent to the contest before the deadline will be eligible to take part in it.

      Regards

    • magenta.grimer

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

      3
      0
      Votes
      3
      Posts
      633
      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.

    • S

      Is there a way to submit a strategy via the API?
      Strategy help • • Svyable

      3
      0
      Votes
      3
      Posts
      1712
      Views

      support

      @svyable Hi,
      sorry for late answer, no we don't provide that option, but we will think about adding it in future.

    • C

      Os period is not updated
      Strategy help • • CommanderAngle

      3
      1
      Votes
      3
      Posts
      3314
      Views

      support

      @commanderangle Dear commanderangle,

      Your strategies are processed in a correct manner, but the reason why you see 0 out-of-sample score is due to the fact that your strategies generate zero weights for all assets for out-of-sample time period. You can check your weights for any strategy by downloading them. There is a download button in the submission logs section.

      Regards

    • L

      Error message when enter JupyterLab
      Support • • lemonpie

      3
      0
      Votes
      3
      Posts
      373
      Views

      L

      @support Thanks. Works fine now.

    • D

      progress check froze
      Strategy help • • dark.pidgeot

      3
      0
      Votes
      3
      Posts
      2971
      Views

      D

      @support Hello,

      got it, thanks for the reply,

    • D

      Errors when I save the isssus parameters of my optimization in the json file
      Strategy help • • dark.pidgeot

      3
      1
      Votes
      3
      Posts
      2651
      Views

      D

      @support Thank you for your advise, it's ok

    • illustrious.felice

      Please create the program "Quantiacs Tips"
      Strategy help • • illustrious.felice

      3
      0
      Votes
      3
      Posts
      1943
      Views

      illustrious.felice

      @support Thank you for your feedback. I also hope Quantiacs updates new strategy examples on how to use technical analysis (besides sma, trix_ema, atr_lwma,...), and strategies on using ML/DL models effectively (not an example that strategy forward-looking),...

      Hopefully in the future Quantiacs will release new data sets such as news, sentiment, macro, options,... Create new contests that allow merging strategies to build portfolios,...

      Hopefully, Quantiacs will continue to grow. Sincere thanks to Quantiacs for creating extremely high-quality contests.

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