backtrader-next 2.3.2__py3-none-any.whl → 2.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -216,10 +216,10 @@ class Eq(bt.Analyzer):
216
216
  s.loc['Duration'] = s.End - s.Start
217
217
 
218
218
  s.loc['Equity Start [$]'] = equity[0]
219
- s.loc['Equity Final [$]'] = equity[-1]
220
- s.loc['Equity Peak [$]'] = equity.max()
221
- s.loc['Commissions [$]'] = commissions
222
- s.loc['Cum Return [%]'] = np.round((equity[-1] - equity[0]) / equity[0] * 100, 4)
219
+ s.loc['Equity Final [$]'] = round(equity[-1], 4)
220
+ s.loc['Equity Peak [$]'] = round(equity.max(), 4)
221
+ s.loc['Commissions [$]'] = round(commissions, 4)
222
+ s.loc['Cum Return [%]'] = round((equity[-1] - equity[0]) / equity[0] * 100, 4)
223
223
  # c = ohlc_data.Close.values
224
224
  # s.loc['Buy & Hold Return [%]'] = (c[-1] - c[0]) / c[0] * 100 # long-only return
225
225
 
@@ -239,25 +239,25 @@ class Eq(bt.Analyzer):
239
239
  # Use abs() to handle negative equity ratios (losses) and apply sign back
240
240
  equity_ratio = equity[-1]/equity[0]
241
241
  cagr_value = (abs(equity_ratio) ** (1/num_years) - 1) * np.sign(equity_ratio) if equity_ratio != 0 else 0
242
- s.loc['CAGR [%]'] = np.round(cagr_value, 4) * 100
242
+ s.loc['CAGR [%]'] = round(cagr_value, 4) * 100
243
243
 
244
244
  # Sharpe Ratio using arithmetic mean of returns to align with standard definition.
245
245
  # See: https://en.wikipedia.org/wiki/Sharpe_ratio
246
246
  mean_daily_return = day_returns.mean()
247
247
  annualized_mean_return = mean_daily_return * annual_trading_days
248
- s.loc['Sharpe Ratio'] = sharpe = np.round((annualized_mean_return * 100 - risk_free_rate * 100) / (
248
+ s.loc['Sharpe Ratio'] = sharpe = round((annualized_mean_return * 100 - risk_free_rate * 100) / (
249
249
  volatility if volatility != 0 else np.nan), 4)
250
250
 
251
251
  # Smart Sharpe Ratio
252
252
  skew = day_returns.skew()
253
253
  kurt = day_returns.kurt() # Excess kurtosis
254
- s.loc['Skew'] = np.round(skew, 4)
255
- s.loc['Kurtosis'] = np.round(kurt, 4)
254
+ s.loc['Skew'] = round(skew, 4)
255
+ s.loc['Kurtosis'] = round(kurt, 4)
256
256
  # Smart Sharpe Ratio is a modification of the Sharpe Ratio that accounts for skewness
257
257
  # and kurtosis of the returns distribution. It is defined as:
258
258
  # Smart Sharpe Ratio = Sharpe Ratio * (1 + (Skewness / 6) * Sharpe Ratio - (Kurtosis / 24) * (Sharpe Ratio ** 2))
259
259
  # See: https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/smart-sharpe-ratio
260
- s.loc['Smart Sharpe Ratio'] = np.round(sharpe * (1 + (skew / 6) * sharpe - (kurt / 24) * (sharpe ** 2)), 4)
260
+ s.loc['Smart Sharpe Ratio'] = round(sharpe * (1 + (skew / 6) * sharpe - (kurt / 24) * (sharpe ** 2)), 4)
261
261
 
262
262
  # Our Sortino mismatches `empyrical.sortino_ratio()` because they use arithmetic mean return
263
263
  _downside_returns = day_returns.clip(-np.inf, 0)
@@ -267,7 +267,7 @@ class Eq(bt.Analyzer):
267
267
  s.loc['Sortino Ratio'] = round(sortino_ratio, 4) if not np.isnan(sortino_ratio) else np.nan
268
268
 
269
269
  # s.loc['VWR Ratio'] = calc_vwr(eq_days=equity_df['Equity'].resample('D').last().dropna().to_numpy())
270
- s.loc['VWR Ratio'] = np.round(calc_vwr(eq_days=day_eq.to_numpy()), 4)
270
+ s.loc['VWR Ratio'] = round(calc_vwr(eq_days=day_eq.to_numpy()), 4)
271
271
  max_dd = -np.nan_to_num(dd_df.max())
272
272
  s.loc['Calmar Ratio'] = round((annualized_return * 100) / abs(max_dd), 4) if max_dd != 0 else np.nan
273
273
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: backtrader_next
3
- Version: 2.3.2
3
+ Version: 2.3.3
4
4
  Summary: Live Trading and backtesting platform in Python
5
5
  Project-URL: Homepage, https://github.com/smalinin/backtrader_next
6
6
  Project-URL: Source, https://github.com/smalinin/backtrader_next
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (G
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Requires-Python: >=3.11
15
- Requires-Dist: bn-lightweight-charts>=1.1.0
15
+ Requires-Dist: bn-lightweight-charts>=1.2.0
16
16
  Requires-Dist: numba>=0.61.2
17
17
  Requires-Dist: numpy<2.3,>=2.0
18
18
  Requires-Dist: pandas>=2.2.3
@@ -34,7 +34,7 @@ backtrader_next/analyzers/__init__.py,sha256=krHAQhnqyHj0MKGyTIDNqXqqVUTX7dnQeAB
34
34
  backtrader_next/analyzers/annualreturn.py,sha256=iIuQAE0nacVEPMyc1JUqIsfkWOG_8kwW104FlXvYd0s,2784
35
35
  backtrader_next/analyzers/calmar.py,sha256=eyfIxodGigJ_BgAhDKC8R9SctGsdUMK9K0WagFVviTM,3826
36
36
  backtrader_next/analyzers/drawdown.py,sha256=cHE5_SMuxYQN7WXDQ9SOyEWZcXRWUV_1QJuqHUcKV1w,6523
37
- backtrader_next/analyzers/eq.py,sha256=SKd-0jNiBXTnelocjewaH-bGoe5WfG-OWYrH4fiSiho,15245
37
+ backtrader_next/analyzers/eq.py,sha256=DS5_Lm8sYO5rI7EV5EJo5u7xWrKfqCky5YoJ8UVd7-0,15254
38
38
  backtrader_next/analyzers/leverage.py,sha256=XjEp6AvSJuALYyIFCLX9U1nZohJ9KmOQmHTxIT4myLY,2402
39
39
  backtrader_next/analyzers/logreturnsrolling.py,sha256=DJimm1ywT2moXVgu27zB-hOrtyA5s1hkQ_et5PYlCwU,5025
40
40
  backtrader_next/analyzers/periodstats.py,sha256=-i1_wTtsLn-pBNDBpYQSdyx-2zxFmsGhaczTSgW9N0g,3570
@@ -201,7 +201,7 @@ backtrader_next/utils/dateintern.py,sha256=VcFWhMw_NazuVMHSvSueNgMxRqiEgu5YmRnz5
201
201
  backtrader_next/utils/flushfile.py,sha256=ekrNdFCs0j4HwRRxho-Fnl0XZBCrpd0uHyq02kV2wjE,1588
202
202
  backtrader_next/utils/ordereddefaultdict.py,sha256=8y7FDnqI1mTcr1NwVfgqsaK-42XwC76Mu_iYRVvLmLM,2091
203
203
  backtrader_next/utils/py3.py,sha256=hSoodWo9-eUXzUCcLoQWPtTR51QxD-m01QzZNcuK9A8,2416
204
- backtrader_next-2.3.2.dist-info/METADATA,sha256=T8JKMw-2yA7FnwYIIQRuLNgVTfwgQweS6RH3Yx76nac,11359
205
- backtrader_next-2.3.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
206
- backtrader_next-2.3.2.dist-info/licenses/LICENSE,sha256=4cCtcomD2KVzNeUs8QZPGv_R1FQXPYzr0-2LSnK0hwQ,35121
207
- backtrader_next-2.3.2.dist-info/RECORD,,
204
+ backtrader_next-2.3.3.dist-info/METADATA,sha256=BySivorjZRIIJRH0AFtLHdj1cgZ4meI-Zvjb0f1MZug,11359
205
+ backtrader_next-2.3.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
206
+ backtrader_next-2.3.3.dist-info/licenses/LICENSE,sha256=4cCtcomD2KVzNeUs8QZPGv_R1FQXPYzr0-2LSnK0hwQ,35121
207
+ backtrader_next-2.3.3.dist-info/RECORD,,