Comments (2)
@ranaroussi qs.stats.sharpe() works fine but i cant make a full report probably due to "drawdown"
ValueError Traceback (most recent call last)
<ipython-input-76-d9a4a8ed1010> in <module>
5 returns = net_worth.pct_change().iloc[1:]
6 returns.iloc[3] = -0.01
----> 7 qs.reports.full(returns)
8 qs.reports.html(returns, output='a2c_quantstats.html')
~/.local/lib/python3.6/site-packages/quantstats/reports.py in full(returns, benchmark, rf, grayscale, figsize, display, compounded)
212
213 dd = _stats.to_drawdown_series(returns)
--> 214 dd_info = _stats.drawdown_details(dd).sort_values(
215 by='max drawdown', ascending=True)[:5]
216
~/.local/lib/python3.6/site-packages/quantstats/stats.py in drawdown_details(drawdown)
558 return _pd.concat(_dfs, axis=1)
559
--> 560 return _drawdown_details(drawdown)
561
562
~/.local/lib/python3.6/site-packages/quantstats/stats.py in _drawdown_details(drawdown)
534 dd = drawdown[starts[i]:ends[i]]
535 clean_dd = -remove_outliers(-dd, .99)
--> 536 data.append((starts[i], dd.idxmin(), ends[i],
537 (ends[i] - starts[i]).days,
538 dd.min() * 100, clean_dd.min() * 100))
~/.local/lib/python3.6/site-packages/pandas/core/series.py in idxmin(self, axis, skipna, *args, **kwargs)
2037 """
2038 skipna = nv.validate_argmin_with_skipna(skipna, args, kwargs)
-> 2039 i = nanops.nanargmin(com.values_from_object(self), skipna=skipna)
2040 if i == -1:
2041 return np.nan
~/.local/lib/python3.6/site-packages/pandas/core/nanops.py in _f(*args, **kwargs)
67 try:
68 with np.errstate(invalid="ignore"):
---> 69 return f(*args, **kwargs)
70 except ValueError as e:
71 # we want to transform an object array
~/.local/lib/python3.6/site-packages/pandas/core/nanops.py in nanargmin(values, axis, skipna, mask)
904 values, True, fill_value_typ="+inf", mask=mask
905 )
--> 906 result = values.argmin(axis)
907 result = _maybe_arg_null_out(result, axis, mask, skipna)
908 return result
ValueError: attempt to get argmin of an empty sequence
from quantstats.
Similar issue
qs.reports.full(returns=returns)
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?9def156d-e85f-4c2e-9aff-66aa19d6ca90)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
c:\dev\Python\Mastermind\mastermind\training\Reinforcement_learning\Reinforcement_Learning_with_gym_anytrading.ipynb Cell 27 in <cell line: 6>()
[3](vscode-notebook-cell:/c%3A/dev/Python/Mastermind/mastermind/training/Reinforcement_learning/Reinforcement_Learning_with_gym_anytrading.ipynb#X50sZmlsZQ%3D%3D?line=2) net_worth = pd.Series(multi_env.history['total_profit'], index=df.index[test_frame_bound[0]+1:test_frame_bound[1]], name='Net Worth')
[4](vscode-notebook-cell:/c%3A/dev/Python/Mastermind/mastermind/training/Reinforcement_learning/Reinforcement_Learning_with_gym_anytrading.ipynb#X50sZmlsZQ%3D%3D?line=3) returns = net_worth.pct_change().dropna()
----> [6](vscode-notebook-cell:/c%3A/dev/Python/Mastermind/mastermind/training/Reinforcement_learning/Reinforcement_Learning_with_gym_anytrading.ipynb#X50sZmlsZQ%3D%3D?line=5) qs.reports.full(returns=returns)
File c:\ProgramData\Anaconda3\lib\site-packages\quantstats\reports.py:278, in full(returns, benchmark, rf, grayscale, figsize, display, compounded, periods_per_year, match_dates)
275 returns, benchmark = _match_dates(returns, benchmark)
277 dd = _stats.to_drawdown_series(returns)
--> 278 col = _stats.drawdown_details(dd).columns[4]
279 dd_info = _stats.drawdown_details(dd).sort_values(by = col,
280 ascending = True)[:5]
282 if not dd_info.empty:
File c:\ProgramData\Anaconda3\lib\site-packages\quantstats\stats.py:820, in drawdown_details(drawdown)
817 _dfs[col] = _drawdown_details(drawdown[col])
818 return _pd.concat(_dfs, axis=1)
--> 820 return _drawdown_details(drawdown)
File c:\ProgramData\Anaconda3\lib\site-packages\quantstats\stats.py:796, in drawdown_details.<locals>._drawdown_details(drawdown)
794 dd = drawdown[starts[i]:ends[i]]
795 clean_dd = -remove_outliers(-dd, .99)
--> 796 data.append((starts[i], dd.idxmin(), ends[i],
797 (ends[i] - starts[i]).days,
...
-> 1142 result = values.argmin(axis) # type: ignore[var-annotated]
1143 result = _maybe_arg_null_out(result, axis, mask, skipna)
1144 return result
ValueError: attempt to get argmin of an empty sequence
from quantstats.
Related Issues (20)
- Risk Of Ruin Formula HOT 2
- The order of 'Strategy' and 'Benchmark' Columns in the Report
- Advice on format of loading data from csv HOT 2
- positions versus return
- Problems with time dependent risk free rate
- Error - win_year / periods_per_year not passed to CAGR function HOT 2
- stats.py FutureWarning with DataFrame.prod HOT 1
- Futures Data (CME, EUREX, etc) HOT 1
- qs.reports.metrics() and qs.reports.full() give different results using same data HOT 1
- reports break
- NaN Handling HOT 1
- CAGR is not accurate - need to update to take the HOT 5
- Quantstats.reports.metrics would be nice to have last date stats for Drawdown HOT 1
- Plots don't display when using matplotlib backend qt HOT 1
- Is this project **ABANDONED** ? HOT 1
- Asset Wise Transaction List - Profit Loss Account
- Incompatibility with AWS Lambda
- TypeError: unsupported operand type(s) for +: 'float' and 'str' HOT 3
- Warings about pd.to_timedelta
- 'TypeError: super(type, obj): obj must be an instance or subtype of type' in the super() function of reports.html HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantstats.