turtle_trading.position_sizing.algorithms package

Submodules

turtle_trading.position_sizing.algorithms.get_n module

The underlying volatility of an asset.

class turtle_trading.position_sizing.algorithms.get_n.N(dataframe: DataFrameLoader, date: date | None = None)

Bases: object

This class represents the process for calculating N.

Parameters:
  • dataframe – A DataFrameLoader object.

  • date – Optional, a datetime.date object.

get_n() float

Calculate N.

get_pdn() float

Calculate the previous day’s N.

turtle_trading.position_sizing.algorithms.get_n.getn(dataframe: DataFrameLoader, date: date | None = None)

A shortcut function for class: N.

Parameters:
  • dataframe – A DataFrameLoader object.

  • date – Optional, a datetime.date object.

Returns:

N of an asset in the given time date.

turtle_trading.position_sizing.algorithms.get_unit_size module

Volatility adjusted position units.

class turtle_trading.position_sizing.algorithms.get_unit_size.Unit(dataframe: DataFrameLoader, account: float, n: float | None = None, date: date | None = None)

Bases: object

this class represents the process for calculating unit size

dollar_volatility_adjustment() float

calculating the dollar volatility of the asset

get_unit_size() float

calculating unit size

turtle_trading.position_sizing.algorithms.get_unit_size.getunits(dataframe: DataFrameLoader, account: float, n: float | None = None, date: date | None = None)

A shortcut function for class: Unit.

Parameters:
  • dataframe – A DataFrameLoader object.

  • account

  • n

  • date

Returns:

N of an asset in the given time date.

Module contents