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

      Expected Time to Run Strategy
      Support • • anshul96go

      4
      0
      Votes
      4
      Posts
      1310
      Views

      A

      @support Got it, thanks a lot!

    • S

      Pairs trading with states iterations
      Strategy help • • spancham

      4
      0
      Votes
      4
      Posts
      739
      Views

      S

      @support
      Cool, thanks very much! 👍

    • C

      Different dataset locally and in jupiterLab
      Support • • cross_platform.zebra

      4
      0
      Votes
      4
      Posts
      393
      Views

      support

      @cross_platform-zebra Hi, there is no other limitation regarding local development. It is already configured to be exactly the same datasets for Nasdaq100 stocks, and returns the same statistics for trading system running locally or online.

    • J

      Fundamental Data: Periodic indicators & Instant indicators
      Strategy help • • johback

      4
      1
      Votes
      4
      Posts
      1065
      Views

      V

      @johback

      Hello

      More examples are here https://github.com/quantiacs/toolbox/blob/main/qnt/tests/test_fundamental_data.py

      This is a simple example.

      import qnt.data as qndata import datetime as dt import qnt.data.secgov_indicators import qnt.data as qndata import qnt.stats as qns assets = qndata.stocks.load_ndx_list(tail=dt.timedelta(days=5 * 365)) assets_names = [i["id"] for i in assets] data = qndata.stocks.load_ndx_data(tail=dt.timedelta(days=5 * 365), dims=("time", "field", "asset"), assets=assets_names, forward_order=True) facts_names = ['operating_expense'] # 'assets', 'liabilities', 'ivestment_short_term' and other fundamental_data = qnt.data.secgov_load_indicators(assets, time_coord=data.time, standard_indicators=facts_names) # Operating expenses include marketing, noncapitalized R&D, # travel and entertainment, office supply, rent, salary, cogs... weights = fundamental_data.sel(field='operating_expense') is_liquid = data.sel(field="is_liquid") weights = weights * is_liquid # calc stats stats = qns.calc_stat(data, weights.sel(time=slice("2006-01-01", None))) 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")
    • S

      Cryptocurrency algos issues
      Support • • Sheikh

      4
      1
      Votes
      4
      Posts
      933
      Views

      S

      @support
      Thanks.
      You guys are the best!🏆

    • P

      Xarray Value Error
      Strategy help • • pink.seel

      4
      0
      Votes
      4
      Posts
      550
      Views

      support

      @pink-seel Super that you found it, please do not hesitate to ask for support!

    • T

      Calculation time exceeded on submission
      Support • • TheFlyingDutchman

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

    • E

      Q17 Machine learning - RidgeRegression (Long/Short); there is an error in the code
      Strategy help • • EDDIEE

      4
      1
      Votes
      4
      Posts
      877
      Views

      E

      @support

      This is a possible fix, but no gurantee. You have to adjust also the prediction function.

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

      models = dict()

      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) models[asset_name] = model except KeyboardInterrupt as e: raise e except: logging.exception('model training failed')

      return models

    • cespadilla

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

      4
      1
      Votes
      4
      Posts
      826
      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? )
    • X

      allocations and orders
      General Discussion • • xiaolan

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

    • N

      SMA Example
      Support • • Nikos84

      4
      0
      Votes
      4
      Posts
      453
      Views

      N

      @support Thank you!

    • magenta.grimer

      Help !
      Support • • magenta.grimer

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

    • V

      Example strategy for Q19
      Support • • vg2001

      4
      0
      Votes
      4
      Posts
      418
      Views

      support

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

    • R

      Processing Time
      General Discussion • • rezhak21

      4
      0
      Votes
      4
      Posts
      947
      Views

      R

      @support ok, thank you!

    • nosaai

      Local Development with Notifications
      Support • • nosaai

      4
      0
      Votes
      4
      Posts
      597
      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'
    • M

      training, predicting and backtesting Neural Network
      Support • • magenta.kabuto

      4
      0
      Votes
      4
      Posts
      399
      Views

      support

      @magenta-kabuto The weights generated are simply the daily allocations to the various assets.

    • E

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

      4
      1
      Votes
      4
      Posts
      579
      Views

      support

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

    • O

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

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

    • A

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

      4
      0
      Votes
      4
      Posts
      917
      Views

      support

      @captain-nidoran Fixed, sorry for issue

    • A

      Taking long time and no status update
      Support • • anshul96go

      4
      0
      Votes
      4
      Posts
      684
      Views

      support

      @anshul96go Sorry for the late answer, we missed it somehow. Yes, all submissions sent before deadline will be processed and accepted.

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