MCPcopy Create free account
hub / github.com/kernc/backtesting.py / run

Method run

backtesting/lib.py:546–559  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

544 super().__init__(data, *args, **kwargs)
545
546 def run(self, **kwargs) -> pd.Series:
547 with patch(self, '_data', self.__data):
548 result = super().run(**kwargs)
549
550 trades: pd.DataFrame = result['_trades']
551 trades['Size'] *= self._fractional_unit
552 trades[['EntryPrice', 'ExitPrice', 'TP', 'SL']] /= self._fractional_unit
553
554 indicators = result['_strategy']._indicators
555 for indicator in indicators:
556 if indicator._opts['overlay']:
557 indicator /= self._fractional_unit
558
559 return result
560
561
562# Prevent pdoc3 documenting __init__ signature of Strategy subclasses

Callers 1

Calls 2

patchFunction · 0.85
runMethod · 0.45

Tested by 1