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

      Colab new error 'EntryPoints' object has no attribute 'get'
      Support • • gjhernandezp

      5
      0
      Votes
      5
      Posts
      876
      Views

      support

      @gjhernandezp Thank you for sharing your solution!

    • illustrious.felice

      IndentationError: unindent does not match any outer indentation level
      Support • • illustrious.felice

      5
      0
      Votes
      5
      Posts
      338
      Views

      support

      @illustrious-felice Hi, just insist and test other ideas, it is not easy but you will manage!

    • illustrious.felice

      Strategy trades illiquid instruments
      Support • • illustrious.felice

      5
      0
      Votes
      5
      Posts
      1974
      Views

      V

      @illustrious-felice Hello. The reason you're still seeing a large number of tickers (e.g., around 300) even after applying the filter is that the "best" instrument by Sharpe ratio changes over time. The rank_assets_by function returns a time-dependent mask, selecting the top N assets at each time step. So the total number of unique assets that were selected at any point in time may be much larger than top_assets.

      This is expected behavior.

      To illustrate this more clearly, let's consider a minimal working example that selects only 1 top asset at each point in time and shows all the intermediate steps:

      import qnt.data as qndata import qnt.ta as qnta import qnt.stats as qnstats import qnt.output as qnout import qnt.filter as qnfilter import xarray as xr import pandas as pd top_assets = 1 data = qndata.stocks.load_spx_data(min_date="2005-06-01") weights = data.sel(field="is_liquid") stats_per_asset = qnstats.calc_stat(data, weights, per_asset=True) sharpe_ratio = stats_per_asset.sel(field="sharpe_ratio") asset_filter = qnfilter.rank_assets_by(data, sharpe_ratio, top_assets, ascending=False) weights = weights * asset_filter stats = qnstats.calc_stat(data, weights.sel(time=slice("2005-06-01", None))) display(asset_filter.to_pandas().tail()) display(stats.to_pandas().tail()) display(sharpe_ratio.to_pandas().tail()) display(weights.to_pandas().tail())

      If you want to see which asset was the best on specific dates, you can do something like this:

      dates = ["2015-01-15", "2020-01-15", "2025-01-15"] records = [] for date_str in dates: best_mask = asset_filter.sel(time=date_str) assets = best_mask.where(best_mask > 0, drop=True).asset.values srs = sharpe_ratio.sel(time=date_str, asset=assets).values for a, s in zip(assets, srs): records.append({"time": date_str, "asset": a.item(), "sharpe_ratio": float(s)}) df = pd.DataFrame(records).set_index("time") display(df) asset sharpe_ratio time 2025-05-22 NYS:HRL 1.084683 2025-05-22 NAS:KDP 1.093528 2025-05-22 NAS:AAPL 0.968039

      Or simply for a single date:

      date = "2020-05-22" best_mask = asset_filter.sel(time=date) best_assets = best_mask.where(best_mask > 0, drop=True).asset best_sr = sharpe_ratio.sel(time=date, asset=best_assets) print(best_sr.to_pandas())

      This shows clearly that only one asset is selected at each time step, but over the full time range, many different assets can appear in the top list depending on how their Sharpe ratios change.

    • L

      Windows or Linux?
      Strategy help • • laudis

      4
      0
      Votes
      4
      Posts
      439
      Views

      L

      Thanks !

    • V

      Example strategy for Q19
      Support • • vg2001

      4
      0
      Votes
      4
      Posts
      375
      Views

      support

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

    • nosaai

      Local Development with Notifications
      Support • • nosaai

      4
      0
      Votes
      4
      Posts
      518
      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'
    • nosaai

      Local Development Problems
      General Discussion • • nosaai

      4
      1
      Votes
      4
      Posts
      792
      Views

      V

      @nosaai Hello

      Spyder should be run under conda environment

      conda activate qntdev conda install spyder spyder

      an alternative way is to clone the library from https://github.com/quantiacs/toolbox
      and develop strategies inside qnt. But I recommend using the approach from the documentation.

    • E

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

      4
      1
      Votes
      4
      Posts
      531
      Views

      support

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

    • A

      Taking long time and no status update
      Support • • anshul96go

      4
      0
      Votes
      4
      Posts
      581
      Views

      support

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

    • D

      Kelly criterion
      Support • • dark.pidgeot

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

    • P

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

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

    • M

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

      4
      1
      Votes
      4
      Posts
      2302
      Views

      V

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

    • B

      Accessing both market and index data in strategy()
      Support • • buyers_are_back

      4
      0
      Votes
      4
      Posts
      477
      Views

      V

      @buyers_are_back Hello.
      Here is a new example of stock prediction using index data.
      I recommend using the single-pass version.
      https://quantiacs.com/documentation/en/data/indexes.html

    • R

      referral program
      General Discussion • • rezhak21

      4
      0
      Votes
      4
      Posts
      444
      Views

      R

      @support I see, need to push them to submit then....

    • illustrious.felice

      RuntimeError: expand(torch.DoubleTensor{[694, 6]}, size=[694]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
      Strategy help • • illustrious.felice

      4
      0
      Votes
      4
      Posts
      1348
      Views

      illustrious.felice

      @support Thank you so much. I have resolved this error

    • magenta.grimer

      Help !
      Support • • magenta.grimer

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

    • N

      How to submit stateful long short
      Strategy help • • newbiequant96

      4
      0
      Votes
      4
      Posts
      2742
      Views

      support

      @newbiequant96 Hi, the template is a "working code" still to be finalized and published among the templates in the account area, however the logic behind is strictly multi-pass and a conversion to single pass is not really so straightforward.

    • A

      Expected Time to Run Strategy
      Support • • anshul96go

      4
      0
      Votes
      4
      Posts
      1195
      Views

      A

      @support Got it, thanks a lot!

    • X

      allocations and orders
      General Discussion • • xiaolan

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

    • S

      Cryptocurrency algos issues
      Support • • Sheikh

      4
      1
      Votes
      4
      Posts
      869
      Views

      S

      @support
      Thanks.
      You guys are the best!🏆

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