@support But alpha should not be between 0 and 1 and 2(n+1) is larger than one, is maybe 2/(n+1)?
Best posts made by gjhernandezp
-
RE: Alpha Default Value of EMA function
-
RE: Colab new error 'EntryPoints' object has no attribute 'get'
It seems that is a problem with the newer 0.20.2 version of xarray in Coab because I have the same problem running the Xarray Turorial from http://gallery.pangeo.io/repos/pangeo-data/pangeo-tutorial-gallery/xarray.html#Table-of-contents
I added to before any other cell
!pip uninstall xarray -y
!pip install xarray==0.19.0And is working now.
Latest posts made by gjhernandezp
-
Local Development Error Ubuntu : AttributeError: module 'collections' has no attribute 'Iterable'
File ~/anaconda3/envs/qntdev/lib/python3.10/site-packages/progressbar/bar.py:50
46 except Exception:
47 pass
---> 50 class ProgressBarBase(collections.Iterable, ProgressBarMixinBase):
51 pass
54 class DefaultFdMixin(ProgressBarMixinBase):AttributeError: module 'collections' has no attribute 'Iterable'
-
Three questions about the qnbt.backtest_ml used in Machine Learning on a Rolling Basis example.
The questions are about the qnbt.backtest_ml used in Machine Learning on a Rolling Basis example from https://quantiacs.com/documentation/en/examples/q18_machine_learning_on_a_rolling_basis.html
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 = "stocks_nasdaq100", # competition type
lookback_period = 365, # how many calendar days are needed by the predict function to generate the output
start_date = "2005-01-01", # backtest start date
analyze = True,
build_plots = True # do you need the chart?
)Questions
-
It seems that the models are trained in the train_period of the final data and that trained models are used in all the chunks of data, is that correct ?
-
Is the re-training after every retrain_interval done with incremental learning of the type that the fitting that partial_fit does (see following link) ?
- How can i provide qnbt.backtest_ml with and already trained model have the model trained with incremental learning every retrain_interval (would train_period = 0 and have train_model retruning the trained models work for this)
-
-
RE: Alpha Default Value of EMA function
@support But alpha should not be between 0 and 1 and 2(n+1) is larger than one, is maybe 2/(n+1)?
-
RE: Colab new error 'EntryPoints' object has no attribute 'get'
It seems that is a problem with the newer 0.20.2 version of xarray in Coab because I have the same problem running the Xarray Turorial from http://gallery.pangeo.io/repos/pangeo-data/pangeo-tutorial-gallery/xarray.html#Table-of-contents
I added to before any other cell
!pip uninstall xarray -y
!pip install xarray==0.19.0And is working now.
-
Colab new error 'EntryPoints' object has no attribute 'get'
I was running strategies from Colab whitout any problem but now I am getting this error even in the example form
- https://quantiacs.com/documentation/en/user_guide/local_development.html#google-colab-support
- https://quantiacs.com/documentation/en/_static/colab.ipynb
=================
import xarray as xr
import qnt.stats as qnstats
import qnt.data as qndata
import qnt.output as qnout
import qnt.ta as qnta
import qnt.backtester as qnbt
import qnt.graph as qngraphdef load_data(period):
return qndata.stocks.load_ndx_data(tail=period)def strategy(data):
close = data.sel(field="close")
is_liquid = data.sel(field="is_liquid")
sma_slow = qnta.sma(close, 200).isel(time=-1)
sma_fast = qnta.sma(close, 20).isel(time=-1)
weights = xr.where(sma_slow < sma_fast, 1, -1)
weights = weights * is_liquid
return weightsweights = qnbt.backtest(
competition_type = "stocks_nasdaq100",
load_data = load_data,
lookback_period = 365*4,
start_date = "2006-01-01",
strategy = strategy,
analyze = True,
build_plots = True
)===============
Run last pass...
Load data...AttributeError Traceback (most recent call last)
<ipython-input-5-ef8fa45745b7> in <module>
32 strategy = strategy,
33 analyze = True,
---> 34 build_plots = True
35 )9 frames
/usr/local/lib/python3.7/dist-packages/xarray/backends/plugins.py in list_engines()
103 @functools.lru_cache(maxsize=1)
104 def list_engines():
--> 105 entrypoints = entry_points().get("xarray.backends", ())
106 return build_engines(entrypoints)
107AttributeError: 'EntryPoints' object has no attribute 'get'
-
External information
Can we use external information like: fundamentals, news or twits from Yahoo Finance, Google Finance, Twitter, Stocktwits using scraper or librareis https://pypi.org/project/yfinance/ or https://github.com/Aljgutier/Pyquant ?