openqdata 0.3.0__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.
Files changed (75) hide show
  1. openqdata/README.md +5 -0
  2. openqdata/__init__.py +15 -0
  3. openqdata/arbfree/README.md +5 -0
  4. openqdata/arbfree/__init__.py +9 -0
  5. openqdata/arbfree/arbfree.py +1494 -0
  6. openqdata/arbfree/sanos.py +316 -0
  7. openqdata/arbfree/sanos_tools.py +958 -0
  8. openqdata/arbfree/tridiag.py +85 -0
  9. openqdata/benchmark/README.md +5 -0
  10. openqdata/benchmark/__init__.py +4 -0
  11. openqdata/biz_calendar.py +506 -0
  12. openqdata/cli.py +91 -0
  13. openqdata/env.py +112 -0
  14. openqdata/fred/README.md +5 -0
  15. openqdata/fred/__init__.py +14 -0
  16. openqdata/fred/client.py +57 -0
  17. openqdata/fred/rates.py +162 -0
  18. openqdata/massive/README.md +5 -0
  19. openqdata/massive/__init__.py +15 -0
  20. openqdata/massive/client.py +1183 -0
  21. openqdata/massive/expiries.py +242 -0
  22. openqdata/massive/options/README.md +5 -0
  23. openqdata/massive/options/__init__.py +6 -0
  24. openqdata/massive/options/contracts.py +610 -0
  25. openqdata/massive/processing.py +447 -0
  26. openqdata/massive/testing/README.md +5 -0
  27. openqdata/massive/testing/__init__.py +8 -0
  28. openqdata/massive/testing/generate.py +61 -0
  29. openqdata/massive/testing/scope.py +8 -0
  30. openqdata/massive/tickers/README.md +5 -0
  31. openqdata/massive/tickers/__init__.py +5 -0
  32. openqdata/massive/tickers/basics.py +66 -0
  33. openqdata/massive/tickers/data.py +362 -0
  34. openqdata/massive/tickers/filtered_history.py +260 -0
  35. openqdata/massive/trade_conds.py +324 -0
  36. openqdata/models/README.md +5 -0
  37. openqdata/models/__init__.py +4 -0
  38. openqdata/pool.py +34 -0
  39. openqdata/tickers/README.md +5 -0
  40. openqdata/tickers/__init__.py +13 -0
  41. openqdata/tickers/ticker_calendar.py +370 -0
  42. openqdata/utils/README.md +3 -0
  43. openqdata/utils/__init__.py +35 -0
  44. openqdata/utils/cvxpy.py +47 -0
  45. openqdata/utils/pd.py +125 -0
  46. openqdata/utils/pl.py +114 -0
  47. openqdata/vixdata/README.md +5 -0
  48. openqdata/vixdata/__init__.py +6 -0
  49. openqdata/vixdata/cboe.py +119 -0
  50. openqdata/vixdata/client.py +44 -0
  51. openqdata/vixdata/formula.py +132 -0
  52. openqdata/widb/README.md +5 -0
  53. openqdata/widb/__init__.py +25 -0
  54. openqdata/widb/arbfree.py +581 -0
  55. openqdata/widb/bad.py +69 -0
  56. openqdata/widb/client.py +517 -0
  57. openqdata/widb/connection.py +72 -0
  58. openqdata/widb/day.py +1098 -0
  59. openqdata/widb/fitstats.py +328 -0
  60. openqdata/widb/options_filter.py +338 -0
  61. openqdata/widb/sanos.py +96 -0
  62. openqdata/widb/testing/README.md +5 -0
  63. openqdata/widb/testing/__init__.py +0 -0
  64. openqdata/widb/testing/generate.py +45 -0
  65. openqdata/widb/testing/scope.py +8 -0
  66. openqdata/widb/timeseries.py +434 -0
  67. openqdata/yahoo/README.md +5 -0
  68. openqdata/yahoo/__init__.py +8 -0
  69. openqdata/yahoo/client.py +229 -0
  70. openqdata-0.3.0.dist-info/METADATA +103 -0
  71. openqdata-0.3.0.dist-info/RECORD +75 -0
  72. openqdata-0.3.0.dist-info/WHEEL +5 -0
  73. openqdata-0.3.0.dist-info/licenses/LICENSE +131 -0
  74. openqdata-0.3.0.dist-info/licenses/NOTICE +1 -0
  75. openqdata-0.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,316 @@
1
+ """
2
+ SANOS
3
+ =====
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import math
9
+ import warnings as warnings
10
+ from dataclasses import asdict, dataclass
11
+
12
+ import cvxpy as cp
13
+ import numpy as np
14
+ from cdxcore.bs import bs
15
+ from cdxcore.err import verify_inp
16
+ from cdxcore.verbose import Context
17
+ from cdxcore.version import version
18
+
19
+ from openqdata.arbfree import IMPOSE_FLOOR_ON_DENSITY
20
+ from openqdata.arbfree.sanos_tools import (
21
+ SanosLPSolver,
22
+ SanosPricer,
23
+ warn_and_fix_density,
24
+ )
25
+ from openqdata.biz_calendar import DAYS_PER_YEAR, ONE_MINUTE
26
+
27
+
28
+ @version("0.41", dependencies=[SanosPricer])
29
+ @dataclass(frozen=True)
30
+ class SanosFitter:
31
+ """
32
+ A utility class which generates a "closest" arbitrage-free market using
33
+ the ideas from the paper https://arxiv.org/pdf/2601.11209.
34
+ """
35
+ smoothness : float|None = None # Whether to impose SANOS smoothness.
36
+ timeout_seconds : float|None = 60.*5. #: Time limit for the optimization solver, in seconds. This is passed to the CVXPY solver options as "time_limit".
37
+
38
+ min_dlv : float = 0.01 #: Minimum local volatility to impose in the fit.
39
+ max_dlv : float = 50. #: Maximum local volatility to impose in the fit.
40
+ min_density_vol : float|None = 1E-4 # Minimum local volatility to impose in the fit.
41
+ min_density_cap : float|None = 1E-5 # Maximum density floor. Only used if :attr:`IMPOSE_FLOOR_ON_DENSITY` is set to True; otherwise 0.
42
+
43
+ # protected variables do not alter the ID of this field (because they start with '_')
44
+ _debug_verbose_cvxpy : set[str]|None = None
45
+ _eps_price : float = 1E-6
46
+ _eps_density : float = 1E-7
47
+ _min_density : float = 1E-5
48
+ _eps_dlv_box : float = 1E-6
49
+ _dlv_mode : bool = True
50
+ _raise_on_eps : bool = True
51
+
52
+ def __post_init__(self):
53
+ verify_inp( self.timeout_seconds is None or self.timeout_seconds >= 0., lambda : f"'timeout_seconds' must be positive or None, but found {self.timeout_seconds}" )
54
+ verify_inp( self.smoothness is None or self.smoothness >= 0., lambda : f"'smoothness' must be positive or None, but found {self.smoothness:.4g}")
55
+
56
+ def __str__(self) -> str:
57
+ """ Very compact but still readable summary """
58
+ return\
59
+ f"sanos,{f'sth={self.smoothness:.2g},' if self.smoothness is not None else ''}"+\
60
+ f"{',midv='+str(self.min_dlv) if self.min_dlv is not None else ''}{',mxdv='+str(self.max_dlv) if self.max_dlv is not None else ''}{',mindv='+str(self.min_density_vol) if self.min_density_vol is not None else ''}"+\
61
+ ("" if self.min_density_vol is None else f",mdv={self.min_density_vol:.4g}") +\
62
+ ("" if self.min_density_cap is None else f",mdc={self.min_density_cap:.4g}")
63
+
64
+ def __unique_hash__( self, unique_hash, debug_trace ) -> str:
65
+ """ Overwrite hash function to ignore non-functional parameters. Note that unique_hash already ignored protected variables """
66
+ r = asdict(self)
67
+ r.pop("timeout_seconds", None)
68
+ return unique_hash(r, debug_trace=debug_trace)
69
+
70
+ def __call__(self,
71
+ expiries : np.ndarray,
72
+ strikes : list[np.ndarray],
73
+ mids : list[np.ndarray],
74
+ xstrikes : list[np.ndarray],*,
75
+ weights : list[np.ndarray]|None = None,
76
+ vols : np.ndarray|float|None = None, # forward volatilities per expiry, used for the strike expansion step. If a float is provided, it is used for all expiries. If None, it is estimated from the data as the median of the implied vols.
77
+ message_context: str|callable[[], str] | None = None,
78
+ verbose : Context = Context.all ) -> SanosPricer:
79
+ """
80
+ Fit SANOS to the market data provided following https://arxiv.org/pdf/2601.11209.
81
+
82
+ This function performs an L1 closest fit of the SANOS model to the mid prices of the options
83
+ and returns with :class:`SanosPricer` an arbitrage-free surface option pricer.
84
+
85
+ This function is usually very fast, but it can get stuck when the overall surface is close to arbitrage in areas which have very little
86
+ room to adjust.
87
+
88
+ Parameters
89
+ ----------
90
+ expiries : :class:``numpy.ndarray`
91
+ Increasing array of expiries (in years).
92
+ strikes : list[:class:``numpy.ndarray`]
93
+ List of strike arrays, one per expiry. Each strike array must be strictly increasing and positive.
94
+ mids : list[:class:``numpy.ndarray`]
95
+ List of mid price arrays, one per expiry.
96
+ xstrikes : list[:class:``numpy.ndarray`]
97
+ List of model strikes for which to calibrate a SANOS density for.
98
+ weights : list[:class:``numpy.ndarray``]|None
99
+ List of weight arrays for the ``mids``, used to weight the fit to the mid prices. If None, all weights are set to 1.
100
+ vols : :class:``numpy.ndarray`` | float | None, default ``None``
101
+ Volatilities per expiry used when ``smoothness`` is not None.
102
+ If left to ``None``, the function will compute an approximate mid-atm volatility from the provided bid and ask prices per expiry.
103
+ message_context : str | callable[[], str] | None, default None
104
+ Optional context to prepend to error and warning messages.
105
+ This can be a string or a callable which returns a string, e.g. a ``lambda``
106
+ which returns a string with dynamic information such as the current expiry being processed. If None, no context is prepended.
107
+ verbose : :class:`Context`, default ``Context.all``
108
+ Verbose context for logging.
109
+
110
+ Returns
111
+ -------
112
+ Fitted model: :class:`SanosPricer`
113
+ """
114
+ def message(with_cols : bool = True) -> str:
115
+ if message_context is None:
116
+ return ""
117
+ if callable(message_context):
118
+ msg = message_context()
119
+ else:
120
+ msg = str(message_context)
121
+ if msg == "":
122
+ return ""
123
+ msg = msg[0].upper() + msg[1:]
124
+ if not with_cols:
125
+ return msg
126
+ return msg + ": "
127
+
128
+ T = len(expiries)
129
+
130
+ verify_inp( len(strikes) == T, lambda : f"{message()}Expected number of strike arrays {T} to match number of expiries {len(expiries)}" )
131
+ verify_inp( len(mids) == T, lambda : f"{message()}Expected number of mids arrays {T} to match number of expiries {len(expiries)}" )
132
+ verify_inp( weights is None or len(weights) == T, lambda : f"{message()}Expected number of weights arrays {T} to match number of expiries {len(expiries)}" )
133
+ verify_inp( expiries[0] > 0. and (len(expiries)==1 or np.min(np.diff(expiries)) > 0.), lambda : f"{message()}Expiries must be positive and strictly increasing, but found {expiries}" )
134
+
135
+ def make_variances():
136
+ if vols is None:
137
+ atm_calls = []
138
+ for t in range(T):
139
+ ixs = np.argsort( strikes[t] )
140
+ atm_calls.append( np.interp( 1., strikes[t][ixs], mids[t][ixs] ) )
141
+ atm_calls = np.asarray(atm_calls)
142
+ atm_vols = bs.implied( k=np.ones_like(atm_calls), prices=atm_calls, sqrtT=np.sqrt(expiries), eps=self._eps_price )
143
+ variances = expiries * (atm_vols**2)
144
+ dts = np.diff(expiries, prepend=0.)
145
+ fwd_vars = np.maximum(0.001**2, np.diff(variances, prepend=0.) / dts ) * dts
146
+ variances = np.cumsum(fwd_vars)
147
+ del atm_calls, atm_vols, dts, fwd_vars
148
+ elif isinstance( vols, np.ndarray ):
149
+ verify_inp( vols.shape == expiries.shape, lambda : f"{message()}If 'vols' is a numpy array, it must have the same shape as 'expiries', but found {vols.shape} and {expiries.shape}" )
150
+ verify_inp( np.all(vols > 0.), lambda : f"{message()}All volatilities must be positive, but found {vols}" )
151
+ variances = expiries * (vols**2)
152
+ verify_inp( variances[0] > 0. and (len(variances)==1 or np.min(np.diff(variances)) > 0.), lambda : f"{message()}Variances derived from 'vols' must be positive and strictly increasing, but found {variances}" )
153
+ else:
154
+ variances = expiries * (float(vols)**2)
155
+ verify_inp(vols > 0., lambda : f"{message()}Volatility must be positive, but found {vols}" )
156
+ return variances
157
+ variances = make_variances()
158
+ del vols
159
+
160
+ tme = verbose.timer()
161
+ variables = []
162
+ constraints = []
163
+ objective = 0.
164
+ xdensities = []
165
+ CXs = []
166
+ dCts = []
167
+
168
+ for t, expiry in enumerate(expiries):
169
+ def local_message():
170
+ msg = message(False)
171
+ ext = f"expiry #{t} {expiry*DAYS_PER_YEAR:.1f}d"
172
+ if msg == "":
173
+ msg = ext[0].upper() + ext[1:]
174
+ else:
175
+ msg += " " + ext
176
+ return msg
177
+
178
+ strikes_t = strikes[t]
179
+ mids_t = mids[t]
180
+ xstrikes_t = xstrikes[t]
181
+ weights_t = weights[t] if not weights is None else None
182
+
183
+ verify_inp( len(strikes_t) > 1 and strikes_t[0] > 0. and np.min( np.diff(strikes_t) ) > 0., f"{local_message()}: 'strikes' must be positive and increasing.")
184
+ verify_inp( len(xstrikes_t ) > 1 and xstrikes_t[0] > 0. and np.min( np.diff(xstrikes_t) ) > 0., f"{local_message()}: 'xstrikes' must be positive and increasing.")
185
+ verify_inp( strikes_t.shape == mids_t.shape, f"{local_message()}: 'strikes' and 'mids' must have the same shape, found {strikes_t.shape} and {mids_t.shape}")
186
+ if not weights_t is None: verify_inp( strikes_t.shape == weights_t.shape, f"{local_message()}: 'strikes' and 'weights' must have the same shape, found {strikes_t.shape} and {weights_t.shape}")
187
+
188
+ if t>0:
189
+ assert strikes_t[0] <= strikes[t-1][0], f"{local_message()}: 'strikes' must be increasing across expiries, but found {strikes[t-1][0]:.4g} and {strikes_t[0]:.4g} for current and previous expiry."
190
+ assert strikes_t[-1] >= strikes[t-1][-1], f"{local_message()}: 'strikes' must be increasing across expiries, but found {strikes[t-1][-1]:.4g} and {strikes_t[-1]:.4g} for current and previous expiry."
191
+
192
+ q_t = cp.Variable(len(xstrikes_t), bounds=[0.,1.])#nonneg=True)
193
+ constraints += [ cp.sum( q_t ) == 1.,
194
+ q_t @ xstrikes_t == 1.,
195
+ q_t <= 1.
196
+ ]
197
+ if not self.min_density_vol is None:
198
+ bscalls = bs.price( k=xstrikes_t, vol=self.min_density_vol, sqrtT=math.sqrt(expiry), eps=self._eps_price )
199
+ bsdensity = np.diff( np.diff( bscalls, prepend=1. ) / np.diff(xstrikes_t, prepend=0.), append=0. )
200
+ bsdensity = np.clip( bsdensity, a_min=0., a_max=None if self.min_density_cap is None else self.min_density_cap / float(len(xstrikes_t)) )
201
+ constraints += [ q_t >= bsdensity ]
202
+ del bscalls, bsdensity
203
+
204
+ # martingale
205
+ Cm = np.maximum( 0., xstrikes_t[None,:] - xstrikes_t[1:-1,None] ) @ q_t # internal model prices
206
+ if t>0:
207
+ assert xstrikes[t-1].shape == xdensities[t-1].shape, f"Internal error {message()}: shape mismatch between previous and current mstrikes, {xstrikes[t-1].shape} vs {xdensities[t-1].shape}"
208
+ Cm1 = np.maximum( 0., xstrikes[t-1][None,:] - xstrikes_t[1:-1,None] ) @ xdensities[t-1]
209
+ constraints += [ Cm >= Cm1 ]
210
+ else:
211
+ Cm1 = np.maximum( 0., 1. - xstrikes_t[1:-1] ) # internal model prices, previous density is dirac at 1
212
+ dCt = Cm - Cm1
213
+ dCts.append(dCt)
214
+
215
+ # dlv constraints
216
+ # dC = 1/2 * dlvsq * x^2 * dt * K^2 / (1/2 (k^+ - k^-)) q
217
+ box = xstrikes_t[1:-1]**2 * ( expiries[t] - ( expiries[t-1] if t>0 else 0. ) ) / ( xstrikes_t[2:] - xstrikes_t[:-2])
218
+ constraints += [ dCt >= cp.multiply( box * (self.min_dlv**2), q_t[1:-1] ) ]
219
+ constraints += [ dCt <= cp.multiply( box * (self.max_dlv**2), q_t[1:-1] ) ]
220
+ del box, Cm1, dCt
221
+
222
+ # fit
223
+ def call( spots, strikes ):
224
+ if self.smoothness is None or self.smoothness == 0. or expiry < ONE_MINUTE:
225
+ return np.maximum( 0., spots - strikes )
226
+ vol = math.sqrt( variances[t] / expiry * self.smoothness )
227
+ assert np.isfinite(vol), f"Internal error: {message()}infinite vol"
228
+ return bs.price( k=strikes/spots, vol=vol, sqrtT=math.sqrt(expiry), eps=self._eps_price )*spots
229
+
230
+ CX = call( spots=xstrikes_t[None,:], strikes=strikes_t[:,None] )
231
+ fits_t = CX @ q_t # market prices according to the model (with smoothness)
232
+ err_t = cp.abs(fits_t-mids_t)
233
+ err_t = err_t if weights_t is None else cp.multiply( weights_t, err_t )
234
+ objective += cp.sum( err_t )
235
+
236
+ xdensities.append(q_t)
237
+ CXs.append(CX)
238
+
239
+ with verbose.write_t(lambda : f"Fitting {'linear' if self.smoothness is None else f'{self.smoothness:.2f}-smooth'} SANOS surface... ", end=''):
240
+ success, status, fell_back = SanosLPSolver(timeout_seconds=self.timeout_seconds,
241
+ _debug_verbose_cvxpy=self._debug_verbose_cvxpy)(
242
+ objective=objective,
243
+ variables=variables,
244
+ constraints=constraints,
245
+ message_context=lambda : message(False),
246
+ verbose=verbose )
247
+ if fell_back:
248
+ verbose.write(lambda : f"had to fall back to a slower solver... ", head=False, end='' )
249
+
250
+ if not success:
251
+ if status in ["infeasible", "infeasible_inaccurate"]:
252
+ raise RuntimeError(f"{message()}Cannot find no-arbitrage surface close to mid-points: problem infeasible?? [This should not happen. Please contact the authors with an example.]")
253
+ if status in ["unbounded", "unbounded_inaccurate", "infeasible_or_unbounded"]:
254
+ raise RuntimeError(f"{message()}Cannot find no-arbitrage surface close to mid-points: problem unbounded? [This should not happen. Please contact the authors with an example.]")
255
+ if status == "user_limit":
256
+ raise RuntimeError(f"{message()}Cannot find no-arbitrage surface close to mid-points: reached timeout {self.timeout_seconds} and/or iteration limit.")
257
+ raise RuntimeError(f"{message()}Cannot find no-arbitrage surface close to mid-points: solver returned status '{status}'.")
258
+
259
+ if status != "optimal":
260
+ verbose.write(lambda : f"solver returned '{status}' -- proceeding anyway... ", head=False, end='' )
261
+
262
+ fits = []
263
+ xdensities = [ q.value for q in xdensities ]
264
+ for t in range(T):
265
+ expiry = expiries[t]
266
+ strikes_t = strikes[t]
267
+ xstrikes_t = xstrikes[t]
268
+ CX = CXs[t]
269
+ q_t = xdensities[t]
270
+ if np.min(q_t) < -self._eps_density or abs( np.sum( q_t )-1. ) > self._eps_density or abs( q_t@xstrikes_t - 1. ) > self._eps_density:
271
+ warnings.warn(f"{message()}Warning: no-arbitrage density does not satisfy basic properties after optimization: min {q_t.min():.3e}, sum {q_t.sum():.6f}, integral {q_t@xstrikes_t:.6f} -- attempting fix.")
272
+ q_t = warn_and_fix_density( xstrikes_t, q_t, eps=self._eps_density, message = lambda : f"{message()}expiry {expiry*DAYS_PER_YEAR:.2f}d: surface density after optimization" )
273
+
274
+ # debug conditions on dC_t
275
+ box = xstrikes_t[1:-1]**2 * ( expiries[t] - ( expiries[t-1] if t>0 else 0. ) ) / ( xstrikes_t[2:] - xstrikes_t[:-2])
276
+ q_box = box * q_t[1:-1]
277
+ dCt = dCts[t].value
278
+ lower = dCt - np.maximum((self.min_dlv**2)*q_box, 0.) # must be >= 0
279
+ upper = (self.max_dlv**2)*q_box - dCt # must be >= 0
280
+ if not np.all(lower >= -self._eps_dlv_box - np.abs(dCt)*self._eps_dlv_box):
281
+ index = np.arange((len(lower)))[lower < -self._eps_dlv_box - np.abs(dCt)*self._eps_dlv_box][:4]
282
+ msg = f"{message()}expiry {expiry*DAYS_PER_YEAR:.2f}d: dC_t[{index}] {dCt[index]} below min dlv constraint {np.maximum((self.min_dlv**2)*q_box, 0.)[index]} difference {lower[index]} [tolerance {self._eps_dlv_box} -> {(+self._eps_dlv_box + np.abs(dCt)*self._eps_dlv_box)[index]}]"
283
+ warnings.warn(msg)
284
+ assert not self._raise_on_eps or np.all(lower >= -self._eps_dlv_box - np.abs(dCt)*self._eps_dlv_box), msg
285
+
286
+ if not np.all(upper >= -self._eps_dlv_box - np.abs(dCt)*self._eps_dlv_box):
287
+ index = np.arange((len(upper)))[upper < -self._eps_dlv_box - np.abs(dCt)*self._eps_dlv_box][:4]
288
+ msg = f"{message()}expiry {expiry*DAYS_PER_YEAR:.2f}d: dC_t[{index}] {dCt[index]} above max dlv constraint {((self.max_dlv**2)*q_box+1E-6)[index]} difference {upper[index]} [tolerance {self._eps_dlv_box} -> {(self._eps_dlv_box + np.abs(dCt)*self._eps_dlv_box)[index]}]"
289
+ warnings.warn(msg)
290
+ assert not self._raise_on_eps or np.all(upper >= -self._eps_dlv_box - np.abs(dCt)*self._eps_dlv_box), msg
291
+
292
+ # zero out some density
293
+ floor = max( self._min_density / float(len(q_t)), self._eps_density ) if IMPOSE_FLOOR_ON_DENSITY else 0.
294
+ is_zero = q_t < floor
295
+ if np.any(is_zero):
296
+ q_t[is_zero] = 0.
297
+
298
+ q_t = warn_and_fix_density( xstrikes_t, q_t, eps=self._eps_density, message = lambda : f"{message()} expiry {expiry*DAYS_PER_YEAR:.2f}d: surface density" )
299
+ xdensities[t] = q_t
300
+ fit_t = CX @ q_t
301
+ assert fit_t.shape == strikes_t.shape, f"Internal error: {message()}Shape of fit_t {fit_t.shape} does not match shape of strikes_t {strikes_t.shape}"
302
+ fits.append( fit_t )
303
+
304
+ verbose.write(lambda : f"done. This took {tme}.", head=False )
305
+
306
+ return SanosPricer( smoothness=self.smoothness,
307
+ expiries=expiries,
308
+ variances=variances,
309
+ xstrikes=xstrikes,
310
+ xdensities=xdensities,
311
+ min_dlv=self.min_dlv,
312
+ max_dlv=self.max_dlv,)
313
+
314
+
315
+
316
+