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

      Processing Time
      General Discussion • • rezhak21

      4
      0
      Votes
      4
      Posts
      1480
      Views

      R

      @support ok, thank you!

    • S

      Stocks strategy
      Strategy help • • spancham

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

    • T

      Calculation time exceeded on submission
      Support • • TheFlyingDutchman

      4
      1
      Votes
      4
      Posts
      1012
      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.

    • magenta.grimer

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

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

      BTC and Crypto contest
      Support • • anthony_m

      4
      0
      Votes
      4
      Posts
      1341
      Views

      A

      @support Ok, I see, thanks

    • M

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

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

    • S

      Pairs trading with states iterations
      Strategy help • • spancham

      4
      0
      Votes
      4
      Posts
      1080
      Views

      S

      @support
      Cool, thanks very much! 👍

    • O

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

      4
      0
      Votes
      4
      Posts
      1163
      Views

      O

      @support Thx for ur reply

    • A

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

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

    • R

      example not accepted as submission
      Support • • rezhak21

      4
      1
      Votes
      4
      Posts
      1123
      Views

      support

      @rezhak21 Rules are defined at: https://quantiacs.com/contest and more details for the current contests (submission time till end of May) can be found at: https://quantiacs.com/contest/15

      For Futures the in sample period starts on January 1st 2006, for the BTC Futures on January 1st, 2014

    • A

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

      4
      0
      Votes
      4
      Posts
      1337
      Views

      support

      @captain-nidoran Fixed, sorry for issue

    • O

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

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

    • N

      SMA Example
      Support • • Nikos84

      4
      0
      Votes
      4
      Posts
      647
      Views

      N

      @support Thank you!

    • S

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

      3
      0
      Votes
      3
      Posts
      1732
      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
      3318
      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

    • D

      progress check froze
      Strategy help • • dark.pidgeot

      3
      0
      Votes
      3
      Posts
      2979
      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
      2657
      Views

      D

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

    • L

      Error message when enter JupyterLab
      Support • • lemonpie

      3
      0
      Votes
      3
      Posts
      374
      Views

      L

      @support Thanks. Works fine now.

    • illustrious.felice

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

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

    • illustrious.felice

      Technique to reduce max_drawdown
      Strategy help • • illustrious.felice

      3
      0
      Votes
      3
      Posts
      1689
      Views

      illustrious.felice

      @magenta-kabuto Thank you very much for your advice. I will research to apply your suggestions to the algorithm

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