SYMBOL INDEX (300 symbols across 13 files) FILE: backtesting/__init__.py function Pool (line 75) | def Pool(processes=None, initializer=None, initargs=()): FILE: backtesting/_plotting.py function set_bokeh_output (line 63) | def set_bokeh_output(notebook=False): function _windos_safe_filename (line 73) | def _windos_safe_filename(filename): function _bokeh_reset (line 79) | def _bokeh_reset(filename=None): function _add_popcon (line 90) | def _add_popcon(): function _watermark (line 94) | def _watermark(fig: _figure): function colorgen (line 102) | def colorgen(): function lightness (line 106) | def lightness(color, lightness=.94): function _maybe_resample_data (line 117) | def _maybe_resample_data(resample_rule, df, indicators, equity_data, tra... function plot (line 190) | def plot(*, results: pd.Series, function plot_heatmaps (line 721) | def plot_heatmaps(heatmap: pd.Series, agg: Union[Callable, str], ncols: ... FILE: backtesting/_stats.py function compute_drawdown_duration_peaks (line 14) | def compute_drawdown_duration_peaks(dd: pd.Series): function geometric_mean (line 30) | def geometric_mean(returns: pd.Series) -> float: function compute_stats (line 37) | def compute_stats( class _Stats (line 192) | class _Stats(pd.Series): method __repr__ (line 193) | def __repr__(self): function dummy_stats (line 203) | def dummy_stats(): FILE: backtesting/_util.py function _tqdm (line 22) | def _tqdm(seq, **_): function try_ (line 26) | def try_(lazy_func, default=None, exception=Exception): function patch (line 34) | def patch(obj, attr, newvalue): function _as_str (line 47) | def _as_str(value) -> str: function _as_list (line 62) | def _as_list(value) -> List: function _batch (line 68) | def _batch(seq): function _data_period (line 75) | def _data_period(index) -> Union[pd.Timedelta, Number]: function _strategy_indicators (line 81) | def _strategy_indicators(strategy): function _indicator_warmup_nbars (line 87) | def _indicator_warmup_nbars(strategy): class _Array (line 96) | class _Array(np.ndarray): method __new__ (line 101) | def __new__(cls, array, *, name=None, **kwargs): method __array_finalize__ (line 107) | def __array_finalize__(self, obj): method __reduce__ (line 114) | def __reduce__(self): method __setstate__ (line 118) | def __setstate__(self, state): method __bool__ (line 122) | def __bool__(self): method __float__ (line 128) | def __float__(self): method to_series (line 134) | def to_series(self): method s (line 139) | def s(self) -> pd.Series: method df (line 145) | def df(self) -> pd.DataFrame: class _Indicator (line 152) | class _Indicator(_Array): class _Data (line 156) | class _Data: method __init__ (line 163) | def __init__(self, df: pd.DataFrame): method __getitem__ (line 171) | def __getitem__(self, item): method __getattr__ (line 174) | def __getattr__(self, item): method _set_length (line 180) | def _set_length(self, length): method _update (line 184) | def _update(self): method __repr__ (line 191) | def __repr__(self): method __len__ (line 197) | def __len__(self): method df (line 201) | def df(self) -> pd.DataFrame: method pip (line 207) | def pip(self) -> float: method __get_array (line 213) | def __get_array(self, key) -> _Array: method Open (line 220) | def Open(self) -> _Array: method High (line 224) | def High(self) -> _Array: method Low (line 228) | def Low(self) -> _Array: method Close (line 232) | def Close(self) -> _Array: method Volume (line 236) | def Volume(self) -> _Array: method index (line 240) | def index(self) -> pd.DatetimeIndex: method __getstate__ (line 244) | def __getstate__(self): method __setstate__ (line 247) | def __setstate__(self, state): class SharedMemory (line 254) | class SharedMemory(_mpshm.SharedMemory): method __init__ (line 258) | def __init__(self, *args, track: bool = True, **kwargs): method unlink (line 266) | def unlink(self): class SharedMemoryManager (line 273) | class SharedMemoryManager: method __init__ (line 278) | def __init__(self, create=False) -> None: method SharedMemory (line 282) | def SharedMemory(self, *, name=None, create=False, size=0, track=True): method __enter__ (line 290) | def __enter__(self): method __exit__ (line 293) | def __exit__(self, *args, **kwargs): method arr2shm (line 304) | def arr2shm(self, vals): method df2shm (line 315) | def df2shm(self, df): method shm2s (line 322) | def shm2s(shm, shape, dtype) -> pd.Series: method shm2df (line 330) | def shm2df(data_shm): FILE: backtesting/backtesting.py class Strategy (line 41) | class Strategy(metaclass=ABCMeta): method __init__ (line 49) | def __init__(self, broker, data, params): method __repr__ (line 55) | def __repr__(self): method __str__ (line 58) | def __str__(self): method _check_params (line 65) | def _check_params(self, params): method I (line 77) | def I(self, # noqa: E743 method init (line 185) | def init(self): method next (line 200) | def next(self): class __FULL_EQUITY (line 215) | class __FULL_EQUITY(float): # noqa: N801 method __repr__ (line 216) | def __repr__(self): return '.9999' # noqa: E704 method buy (line 219) | def buy(self, *, method sell (line 242) | def sell(self, *, method equity (line 274) | def equity(self) -> float: method data (line 279) | def data(self) -> _Data: method position (line 308) | def position(self) -> 'Position': method orders (line 313) | def orders(self) -> 'Tuple[Order, ...]': method trades (line 318) | def trades(self) -> 'Tuple[Trade, ...]': method closed_trades (line 323) | def closed_trades(self) -> 'Tuple[Trade, ...]': class Position (line 328) | class Position: method __init__ (line 338) | def __init__(self, broker: '_Broker'): method __bool__ (line 341) | def __bool__(self): method size (line 345) | def size(self) -> float: method pl (line 350) | def pl(self) -> float: method pl_pct (line 355) | def pl_pct(self) -> float: method is_long (line 361) | def is_long(self) -> bool: method is_short (line 366) | def is_short(self) -> bool: method close (line 370) | def close(self, portion: float = 1.): method __repr__ (line 377) | def __repr__(self): class _OutOfMoneyError (line 381) | class _OutOfMoneyError(Exception): class Order (line 385) | class Order: method __init__ (line 400) | def __init__(self, broker: '_Broker', method _replace (line 418) | def _replace(self, **kwargs): method __repr__ (line 423) | def __repr__(self): method cancel (line 435) | def cancel(self): method size (line 450) | def size(self) -> float: method limit (line 461) | def limit(self) -> Optional[float]: method stop (line 472) | def stop(self) -> Optional[float]: method sl (line 482) | def sl(self) -> Optional[float]: method tp (line 491) | def tp(self) -> Optional[float]: method parent_trade (line 500) | def parent_trade(self): method tag (line 504) | def tag(self): method is_long (line 516) | def is_long(self): method is_short (line 521) | def is_short(self): method is_contingent (line 526) | def is_contingent(self): class Trade (line 542) | class Trade: method __init__ (line 547) | def __init__(self, broker: '_Broker', size: int, entry_price: float, e... method __repr__ (line 559) | def __repr__(self): method _replace (line 564) | def _replace(self, **kwargs): method _copy (line 569) | def _copy(self, **kwargs): method close (line 572) | def close(self, portion: float = 1.): method size (line 583) | def size(self): method entry_price (line 588) | def entry_price(self) -> float: method exit_price (line 593) | def exit_price(self) -> Optional[float]: method entry_bar (line 598) | def entry_bar(self) -> int: method exit_bar (line 603) | def exit_bar(self) -> Optional[int]: method tag (line 611) | def tag(self): method _sl_order (line 624) | def _sl_order(self): method _tp_order (line 628) | def _tp_order(self): method entry_time (line 634) | def entry_time(self) -> Union[pd.Timestamp, int]: method exit_time (line 639) | def exit_time(self) -> Optional[Union[pd.Timestamp, int]]: method is_long (line 646) | def is_long(self): method is_short (line 651) | def is_short(self): method pl (line 656) | def pl(self): method pl_pct (line 665) | def pl_pct(self): method value (line 675) | def value(self): method sl (line 683) | def sl(self): method sl (line 694) | def sl(self, price: float): method tp (line 698) | def tp(self): method tp (line 709) | def tp(self, price: float): method __set_contingent (line 712) | def __set_contingent(self, type, price): class _Broker (line 725) | class _Broker: method __init__ (line 726) | def __init__(self, *, data, cash, spread, commission, margin, method _commission_func (line 758) | def _commission_func(self, order_size, price): method __repr__ (line 761) | def __repr__(self): method new_order (line 764) | def new_order(self, method last_price (line 815) | def last_price(self) -> float: method _adjusted_price (line 819) | def _adjusted_price(self, size=None, price=None) -> float: method equity (line 827) | def equity(self) -> float: method margin_available (line 831) | def margin_available(self) -> float: method next (line 836) | def next(self): method _process_orders (line 853) | def _process_orders(self): method _reduce_trade (line 1030) | def _reduce_trade(self, trade: Trade, price: float, size: float, time_... method _close_trade (line 1052) | def _close_trade(self, trade: Trade, price: float, time_index: int): method _open_trade (line 1070) | def _open_trade(self, price: float, size: int, class Backtest (line 1083) | class Backtest: method __init__ (line 1167) | def __init__(self, method run (line 1243) | def run(self, **kwargs) -> pd.Series: method optimize (line 1358) | def optimize(self, *, method _mp_task (line 1619) | def _mp_task(arg): method plot (line 1630) | def plot(self, *, results: pd.Series = None, filename=None, plot_width... FILE: backtesting/lib.py function barssince (line 73) | def barssince(condition: Sequence[bool], default=np.inf) -> int: function cross (line 84) | def cross(series1: Sequence, series2: Sequence) -> bool: function crossover (line 96) | def crossover(series1: Sequence, series2: Sequence) -> bool: function plot_heatmaps (line 118) | def plot_heatmaps(heatmap: pd.Series, function quantile (line 150) | def quantile(series: Sequence, quantile: Union[None, float] = None): function compute_stats (line 174) | def compute_stats( function resample_apply (line 207) | def resample_apply(rule: str, function random_ohlc_data (line 338) | def random_ohlc_data(example_data: pd.DataFrame, *, class SignalStrategy (line 375) | class SignalStrategy(Strategy): method set_signal (line 400) | def set_signal(self, entry_size: Sequence[float], method next (line 427) | def next(self): class TrailingStrategy (line 447) | class TrailingStrategy(Strategy): method init (line 462) | def init(self): method set_atr_periods (line 466) | def set_atr_periods(self, periods: int = 100): method set_trailing_sl (line 476) | def set_trailing_sl(self, n_atr: float = 6): method set_trailing_pct (line 483) | def set_trailing_pct(self, pct: float = .05): method next (line 496) | def next(self): class FractionalBacktest (line 509) | class FractionalBacktest(Backtest): method __init__ (line 525) | def __init__(self, method run (line 546) | def run(self, **kwargs) -> pd.Series: class MultiBacktest (line 568) | class MultiBacktest: method __init__ (line 581) | def __init__(self, df_list, strategy_cls, **kwargs): method run (line 586) | def run(self, **kwargs): method _mp_task_run (line 607) | def _mp_task_run(args): method optimize (line 618) | def optimize(self, **kwargs) -> pd.DataFrame: FILE: backtesting/test/__init__.py function _read_file (line 8) | def _read_file(filename): function SMA (line 25) | def SMA(arr: pd.Series, n: int) -> pd.Series: FILE: backtesting/test/_test.py function _tempfile (line 40) | def _tempfile(): function chdir (line 48) | def chdir(path): class SmaCross (line 57) | class SmaCross(Strategy): method init (line 62) | def init(self): method next (line 66) | def next(self): class _S (line 75) | class _S(Strategy): method init (line 76) | def init(self): class TestBacktest (line 80) | class TestBacktest(TestCase): method test_run (line 81) | def test_run(self): method test_run_invalid_param (line 85) | def test_run_invalid_param(self): method test_run_speed (line 89) | def test_run_speed(self): method test_data_missing_columns (line 96) | def test_data_missing_columns(self): method test_data_nan_columns (line 102) | def test_data_nan_columns(self): method test_data_extra_columns (line 108) | def test_data_extra_columns(self): method test_data_invalid (line 124) | def test_data_invalid(self): method test_assertions (line 130) | def test_assertions(self): method test_broker_params (line 229) | def test_broker_params(self): method test_spread_commission (line 234) | def test_spread_commission(self): method test_commissions (line 265) | def test_commissions(self): method test_dont_overwrite_data (line 286) | def test_dont_overwrite_data(self): method test_strategy_abstract (line 294) | def test_strategy_abstract(self): method test_strategy_str (line 300) | def test_strategy_str(self): method test_compute_drawdown (line 305) | def test_compute_drawdown(self): method test_compute_stats (line 311) | def test_compute_stats(self): method test_compute_stats_bordercase (line 376) | def test_compute_stats_bordercase(self): method test_trade_enter_hit_sl_on_same_day (line 409) | def test_trade_enter_hit_sl_on_same_day(self): method test_stop_price_between_sl_tp (line 427) | def test_stop_price_between_sl_tp(self): method test_position_close_portion (line 436) | def test_position_close_portion(self): method test_close_orders_from_last_strategy_iteration (line 451) | def test_close_orders_from_last_strategy_iteration(self): method test_check_adjusted_price_when_placing_order (line 463) | def test_check_adjusted_price_when_placing_order(self): class TestStrategy (line 471) | class TestStrategy(TestCase): method _Backtest (line 473) | def _Backtest(strategy_coroutine, data=SHORT_DATA, **kwargs): method test_position (line 483) | def test_position(self): method test_broker_hedging (line 505) | def test_broker_hedging(self): method test_broker_exclusive_orders (line 516) | def test_broker_exclusive_orders(self): method test_trade_multiple_close (line 528) | def test_trade_multiple_close(self): method test_close_trade_leaves_needsize_0 (line 539) | def test_close_trade_leaves_needsize_0(self): method test_stop_limit_order_price_is_stop_price (line 549) | def test_stop_limit_order_price_is_stop_price(self): method test_autoclose_trades_on_finish (line 558) | def test_autoclose_trades_on_finish(self): method test_order_tag (line 565) | def test_order_tag(self): class TestOptimize (line 578) | class TestOptimize(TestCase): method test_optimize (line 579) | def test_optimize(self): method test_method_sambo (line 608) | def test_method_sambo(self): method test_max_tries (line 625) | def test_max_tries(self): method test_optimize_invalid_param (line 642) | def test_optimize_invalid_param(self): method test_optimize_no_trades (line 647) | def test_optimize_no_trades(self): method test_optimize_speed (line 652) | def test_optimize_speed(self): class TestPlot (line 662) | class TestPlot(TestCase): method test_plot_before_run (line 663) | def test_plot_before_run(self): method test_file_size (line 667) | def test_file_size(self): method test_params (line 674) | def test_params(self): method test_hide_legend (line 693) | def test_hide_legend(self): method test_resolutions (line 701) | def test_resolutions(self): method test_range_axis (line 710) | def test_range_axis(self): method test_preview (line 726) | def test_preview(self): method test_wellknown (line 744) | def test_wellknown(self): method test_resample (line 774) | def test_resample(self): method test_indicator_name (line 790) | def test_indicator_name(self): method test_indicator_color (line 821) | def test_indicator_color(self): method test_indicator_scatter (line 838) | def test_indicator_scatter(self): class TestLib (line 855) | class TestLib(TestCase): method test_barssince (line 856) | def test_barssince(self): method test_cross (line 861) | def test_cross(self): method test_crossover (line 866) | def test_crossover(self): method test_quantile (line 873) | def test_quantile(self): method test_resample_apply (line 877) | def test_resample_apply(self): method test_plot_heatmaps (line 898) | def test_plot_heatmaps(self): method test_random_ohlc_data (line 912) | def test_random_ohlc_data(self): method test_compute_stats (line 919) | def test_compute_stats(self): method test_SignalStrategy (line 931) | def test_SignalStrategy(self): method test_TrailingStrategy (line 941) | def test_TrailingStrategy(self): method test_FractionalBacktest (line 958) | def test_FractionalBacktest(self): method test_MultiBacktest (line 968) | def test_MultiBacktest(self): class TestUtil (line 986) | class TestUtil(TestCase): method test_as_str (line 987) | def test_as_str(self): method test_patch (line 1007) | def test_patch(self): method test_pandas_accessors (line 1016) | def test_pandas_accessors(self): method test_indicators_picklable (line 1032) | def test_indicators_picklable(self): class TestDocs (line 1040) | class TestDocs(TestCase): method test_examples (line 1045) | def test_examples(self): method test_backtest_run_docstring_contains_stats_keys (line 1055) | def test_backtest_run_docstring_contains_stats_keys(self): method test_readme_contains_stats_keys (line 1060) | def test_readme_contains_stats_keys(self): class TestRegressions (line 1069) | class TestRegressions(TestCase): method test_gh_521 (line 1070) | def test_gh_521(self): method test_stats_annualized (line 1082) | def test_stats_annualized(self): method test_cancel_orders (line 1087) | def test_cancel_orders(self): method test_trade_on_close_closes_trades_on_close (line 1098) | def test_trade_on_close_closes_trades_on_close(self): method test_trades_dates_match_prices (line 1133) | def test_trades_dates_match_prices(self): method test_sl_always_before_tp (line 1139) | def test_sl_always_before_tp(self): method test_stop_entry_and_tp_in_same_bar (line 1153) | def test_stop_entry_and_tp_in_same_bar(self): method test_optimize_datetime_index_with_timezone (line 1164) | def test_optimize_datetime_index_with_timezone(self): method test_sl_tp_values_in_trades_df (line 1170) | def test_sl_tp_values_in_trades_df(self): FILE: doc/examples/Multiple Time Frames.py function SMA (line 40) | def SMA(array, n): function RSI (line 45) | def RSI(array, n): class System (line 74) | class System(Strategy): method init (line 79) | def init(self): method next (line 95) | def next(self): FILE: doc/examples/Parameter Heatmap & Optimization.py class Sma4Cross (line 45) | class Sma4Cross(Strategy): method init (line 51) | def init(self): method next (line 57) | def next(self): FILE: doc/examples/Quick Start User Guide.py function SMA (line 64) | def SMA(values, n): class SmaCross (line 94) | class SmaCross(Strategy): method init (line 100) | def init(self): method next (line 105) | def next(self): FILE: doc/examples/Strategies Library.py class SmaCross (line 53) | class SmaCross(SignalStrategy, method init (line 58) | def init(self): FILE: doc/examples/Trading with Machine Learning.py function BBANDS (line 45) | def BBANDS(data, n_lookback, n_std): function get_X (line 98) | def get_X(data): function get_y (line 103) | def get_y(data): function get_clean_Xy (line 112) | def get_clean_Xy(df): class MLTrainOnceStrategy (line 164) | class MLTrainOnceStrategy(Strategy): method init (line 167) | def init(self): method next (line 182) | def next(self): class MLWalkForwardStrategy (line 235) | class MLWalkForwardStrategy(MLTrainOnceStrategy): method next (line 236) | def next(self):