Strategies Module

Functions:

random_strategy(data[, buys_qty, sells_qty, ...])

Creates a random buy and sell tag in a column of a dataframe.

random_strategy(data: DataFrame, buys_qty: int = 10, sells_qty: int = 10, new_actions_col: str = 'actions', labels: dict = None, fill: str = None)[source]

Creates a random buy and sell tag in a column of a dataframe.

Parameters:
  • data (pd.DataFrame) – A dataframe.

  • buys_qty (int) – Buy tags quantity. Default is 10.

  • sells_qty (int) – Sells tags quantity. Default is 10.

  • new_actions_col (str) – Name of the new column with the buy and sell tags. Defaults to ‘actions’

  • labels (dict) – Tags for each action. Default is {‘buy’: 1, ‘sell’: -1}.

  • fill (str) – Optional, fills nans with some string.

Returns:

pd.DataFrame