Sizer 参考#

FixedSize *** ** ** **

class backtrader.sizers.FixedSize(*args, **kwargs)#

This sizer simply returns a fixed size for any operation. Size can be controlled by number of tranches that a system wishes to use to scale into trades by specifying the tranches parameter.

Params:
  • stake (default: 1)

  • tranches (default: 1)

FixedReverser *** ** ** ** ** **

class backtrader.sizers.FixedReverser(*args, **kwargs)#

This sizer returns the needes fixed size to reverse an open position or the fixed size to open one

  • To open a position: return the param stake

  • To reverse a position: return 2 * stake

Params:
  • stake (default: 1)

PercentSizer#

class backtrader.sizers.PercentSizer(*args, **kwargs)#

This sizer return percents of available cash

Params:
  • percents (default: 20)

AllInSizer#

class backtrader.sizers.AllInSizer(*args, **kwargs)#

This sizer return all available cash of broker

Params:
  • percents (default: 100)