backtrader-next 2.2.1__py3-none-any.whl → 2.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.
- backtrader_next/order.py +11 -10
- backtrader_next/version.py +1 -1
- {backtrader_next-2.2.1.dist-info → backtrader_next-2.3.0.dist-info}/METADATA +1 -1
- {backtrader_next-2.2.1.dist-info → backtrader_next-2.3.0.dist-info}/RECORD +6 -6
- {backtrader_next-2.2.1.dist-info → backtrader_next-2.3.0.dist-info}/WHEEL +0 -0
- {backtrader_next-2.2.1.dist-info → backtrader_next-2.3.0.dist-info}/licenses/LICENSE +0 -0
backtrader_next/order.py
CHANGED
|
@@ -245,6 +245,7 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
245
245
|
('simulated', False),
|
|
246
246
|
# To support historical order evaluation
|
|
247
247
|
('histnotify', False),
|
|
248
|
+
('restored', False),
|
|
248
249
|
)
|
|
249
250
|
|
|
250
251
|
DAY = datetime.timedelta() # constant for DAY order identification
|
|
@@ -273,7 +274,6 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
273
274
|
'Canceled', 'Expired', 'Margin', 'Rejected',
|
|
274
275
|
]
|
|
275
276
|
|
|
276
|
-
# refbasis = itertools.count(1) # for a unique identifier per order
|
|
277
277
|
refbasis = Counter(1) # for a unique identifier per order
|
|
278
278
|
|
|
279
279
|
def _getplimit(self):
|
|
@@ -283,18 +283,18 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
283
283
|
self._plimit = val
|
|
284
284
|
|
|
285
285
|
plimit = property(_getplimit, _setplimit)
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
@property
|
|
288
288
|
def owner(self):
|
|
289
289
|
if self._owner_classname and not self.p.owner:
|
|
290
290
|
class_name = self._owner_classname
|
|
291
|
-
for s in self.broker.cerebro.
|
|
291
|
+
for s in self.broker.cerebro.runningstrats:
|
|
292
292
|
if s.__class__.__name__ == class_name:
|
|
293
293
|
self.p.owner = s
|
|
294
294
|
self._owner_classname = None
|
|
295
295
|
break
|
|
296
296
|
return self.p.owner
|
|
297
|
-
|
|
297
|
+
|
|
298
298
|
@owner.setter
|
|
299
299
|
def owner(self, value):
|
|
300
300
|
self.p.owner = value
|
|
@@ -340,7 +340,6 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
340
340
|
self.triggered = False
|
|
341
341
|
self.parent_ref = None
|
|
342
342
|
self._owner_classname = None
|
|
343
|
-
self._restored = False
|
|
344
343
|
|
|
345
344
|
self._active = self.parent is None
|
|
346
345
|
self.status = Order.Created
|
|
@@ -355,10 +354,10 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
355
354
|
|
|
356
355
|
# Set a reference price if price is not set using
|
|
357
356
|
# the close price
|
|
358
|
-
pclose = self.data.close[0] if not self.p.simulated and not self.
|
|
357
|
+
pclose = self.data.close[0] if not self.p.simulated and not self.p.restored else self.price
|
|
359
358
|
price = pclose if not self.price and not self.pricelimit else self.price
|
|
360
359
|
|
|
361
|
-
dcreated = self.data.datetime[0] if not self.p.simulated and not self.
|
|
360
|
+
dcreated = self.data.datetime[0] if not self.p.simulated and not self.p.restored else 0.0
|
|
362
361
|
self.created = OrderData(dt=dcreated,
|
|
363
362
|
size=self.size,
|
|
364
363
|
price=price,
|
|
@@ -400,7 +399,7 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
400
399
|
else: # assume float
|
|
401
400
|
valid = self.data.datetime[0] + self.valid
|
|
402
401
|
|
|
403
|
-
if not self.p.simulated and not self.
|
|
402
|
+
if not self.p.simulated and not self.p.restored:
|
|
404
403
|
# provisional end-of-session
|
|
405
404
|
# get next session end
|
|
406
405
|
dtime = self.data.datetime.datetime(0)
|
|
@@ -420,7 +419,7 @@ class OrderBase(with_metaclass(MetaParams, object)):
|
|
|
420
419
|
@classmethod
|
|
421
420
|
def last_ref(cls):
|
|
422
421
|
return cls.refbasis.get_current()
|
|
423
|
-
|
|
422
|
+
|
|
424
423
|
@classmethod
|
|
425
424
|
def reset_ref(cls, start=1):
|
|
426
425
|
cls.refbasis.reset(start)
|
|
@@ -704,7 +703,9 @@ class Order(OrderBase):
|
|
|
704
703
|
@classmethod
|
|
705
704
|
def from_dict(cls, params, odict):
|
|
706
705
|
'''Loads the order data from a dictionary representation'''
|
|
707
|
-
odict['
|
|
706
|
+
odict['_owner_classname'] = params['_owner_classname']
|
|
707
|
+
del params['_owner_classname']
|
|
708
|
+
params['restored'] = True
|
|
708
709
|
ordtype = odict.get('ordtype', None)
|
|
709
710
|
ord = None
|
|
710
711
|
if ordtype is None:
|
backtrader_next/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: backtrader_next
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
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
|
|
@@ -17,7 +17,7 @@ backtrader_next/lineseries.py,sha256=-aNlK6FiOm47-cfyH3oIUDI3awsyEmbyAyAg_o-rETA
|
|
|
17
17
|
backtrader_next/mathsupport.py,sha256=jc2fTjaf3dWzQ4ZV-ypvVPrHnKnoJbrWLHd-pIhdQ2w,1923
|
|
18
18
|
backtrader_next/metabase.py,sha256=1g18zfwPOQQlL0MVEYI2pQ-W-FQvfJpG071a_Xbn-N4,11136
|
|
19
19
|
backtrader_next/observer.py,sha256=xlR7JCYgEcZuwpgLbORPVccRD6cA5RhlkXAfKjVQjdY,2255
|
|
20
|
-
backtrader_next/order.py,sha256=
|
|
20
|
+
backtrader_next/order.py,sha256=mGQ2Yn4OpaE4Ymo6lPHOv9Lz3S70NpCmK3Mo_Hsb6ak,26880
|
|
21
21
|
backtrader_next/position.py,sha256=odBPNNkWVRHZnNY03SqP0TSlhP1I8xoCMHJCuS2rH7E,7445
|
|
22
22
|
backtrader_next/resamplerfilter.py,sha256=z0hqTqbj4nj7gWQPR9qtBk9Iqz8wcqgF3iqL04cMJdA,26141
|
|
23
23
|
backtrader_next/signal.py,sha256=WwhQUu9L35209K3NEv343dvd57-gBGow1yN9VbmvqPM,1899
|
|
@@ -28,7 +28,7 @@ backtrader_next/talib.py,sha256=Q9t2V-jgp-7I9vvPg2BuCJi73GOa7B2LfMrAygPi2nc,9100
|
|
|
28
28
|
backtrader_next/timer.py,sha256=WrY5dpyXpGUOEeOtr_3pjiOldQyiUcXQTBpl8Jd2QCY,7578
|
|
29
29
|
backtrader_next/trade.py,sha256=3AABrbLCxsMubZfenHyONKDCY6j3e-d7bk0ejQPvD8g,11633
|
|
30
30
|
backtrader_next/tradingcal.py,sha256=X4VQ0dojoKgWoOVTd8aYTyvZYiFZV1TALrQ9sWzb9Rg,9903
|
|
31
|
-
backtrader_next/version.py,sha256=
|
|
31
|
+
backtrader_next/version.py,sha256=MaEEapK-sfrwBLSsbRuTguWyaPjf0aMozFb7euvlZEs,1105
|
|
32
32
|
backtrader_next/writer.py,sha256=eDyz3xRsDp1i8WIZrXou6MZ80QHpYBzkf_DAqPGOcAw,7712
|
|
33
33
|
backtrader_next/analyzers/__init__.py,sha256=krHAQhnqyHj0MKGyTIDNqXqqVUTX7dnQeAB1eRwcD9I,1568
|
|
34
34
|
backtrader_next/analyzers/annualreturn.py,sha256=iIuQAE0nacVEPMyc1JUqIsfkWOG_8kwW104FlXvYd0s,2784
|
|
@@ -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.
|
|
205
|
-
backtrader_next-2.
|
|
206
|
-
backtrader_next-2.
|
|
207
|
-
backtrader_next-2.
|
|
204
|
+
backtrader_next-2.3.0.dist-info/METADATA,sha256=mO6QvNmRdZwkZZE2YyxjAA5-hjzbTA2vI4DAUvp213Q,11359
|
|
205
|
+
backtrader_next-2.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
206
|
+
backtrader_next-2.3.0.dist-info/licenses/LICENSE,sha256=4cCtcomD2KVzNeUs8QZPGv_R1FQXPYzr0-2LSnK0hwQ,35121
|
|
207
|
+
backtrader_next-2.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|