@run-out said in How to create pyfolio round trip tearsheet?:
Hi @run-out I tried the QuantStats repo with your strategy, but I had an error:
Traceback (most recent call last):
File "main.py", line 14, in <module>
File "/Users/benjamincherion/Desktop/backtesting-cryptos/backtest.py", line 66, in backtest
File "/Users/benjamincherion/Library/Python/3.7/lib/python/site-packages/quantstats/stats.py", line 234, in sharpe
returns = _utils._prepare_returns(returns, rf, periods)
File "/Users/benjamincherion/Library/Python/3.7/lib/python/site-packages/quantstats/utils.py", line 200, in _prepare_returns
elif data.min() >= 0 and data.max() > 1:
AttributeError: 'dict' object has no attribute 'min'
the output of your strategy (to inject in QuantStats) is the following one:
datetime.datetime(2020, 4, 29, 0, 0): (100000.0, 100000.0),
datetime.datetime(2020, 4, 29, 4, 0): (100000.0, 100000.0),
datetime.datetime(2020, 8, 1, 0, 0): (811.8994327605933, 110828.6750226959)
is it possible to provide an example ?
Thanks a lot !
@ab_trader Not sure if this is an issue since I did this a long time ago.... But when i was putting in stocks for an asx200 analysis going back a long time, some of the stocks didn't have data either at the beginning or the end. I had to at the time use pandas to fill in the beginning and ends with zeros before passing this into backtrader. Again, I was pretty green with backtrader then so not sure if this practice is necessary or not.
@Martin-Bouhier said in ZigZag based on Close Prices:
Hi Martin, I would suspect that you're either not using the same input data (ie. a moving average or smoother that is smaller and finer in the Metastock formula) or that the "percentage" input involves specifying a retracement perhaps before it counts as a peak or valley in that zig zag routine. Also I'm curious to know what the 5 in the "reversal" params specifies.
I don't like that python version. If there are repeated values at a peak, for example such as 200, 201, 201, 199, then it's possible for the code to entirely miss a peak.
@Pedro-Ivo-Paulo-da-Conceição said in Issues in run a strategy:
i'm new here and learning how to use this lib.
I would recommend you to start with the Quickstart Guide and samples in the Docs in this case, not with the fancy complex solutions of advanced coders.
In real life orders are executed by certain rules, bt simulates real life at its best. I've already gave you a link to types of orders, here is another link to Docs - Orders - Creation/Execution. You can choose type of order which will give you desirable results.
Just to provide an example,
strategy1 = cerebro.run()
st = strategy1
# To return something back from the strategy -
df = st.params.results # Will return your df back.
st.params.midmaperiod # will return back 20 and so on.
@Eduardo-De-La-Garza said in Get Highest and Lowest value of first 15 Minutes data:
Can you explain that line of code? When would they not be different?Thanks!
One minute date, checking for new date at the beginning of the day. :)
@soulmachine said in How to use two CommissionInfo inside a strategy?:
Since data has only one name, so it's not possible to apply multiple commission fees?
You're probably right. AFAIK a single commission could be specified per data name or default. As @run-out correctly mentioned - you may develop your custom commission scheme.