Skip to content

Commit 493ba19

Browse files
committed
DOC: Pretty-print default buy size value
1 parent 4fe02d5 commit 493ba19

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

backtesting/backtesting.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,12 @@ def next(self):
188188
super().next()
189189
"""
190190

191+
class __FULL_EUITY(float):
192+
def __repr__(self): return '.9999'
193+
_FULL_EUITY = __FULL_EUITY(1 - sys.float_info.epsilon)
194+
191195
def buy(self, *,
192-
size: float = 1 - sys.float_info.epsilon,
196+
size: float = _FULL_EUITY,
193197
limit: float = None,
194198
stop: float = None,
195199
sl: float = None,
@@ -204,7 +208,7 @@ def buy(self, *,
204208
return self._broker.new_order(size, limit, stop, sl, tp)
205209

206210
def sell(self, *,
207-
size: float = 1 - sys.float_info.epsilon,
211+
size: float = _FULL_EUITY,
208212
limit: float = None,
209213
stop: float = None,
210214
sl: float = None,

0 commit comments

Comments
 (0)