atradebot.strategies package

Submodules

atradebot.strategies.arima module

atradebot.strategies.gpt module

atradebot.strategies.llama3 module

atradebot.strategies.simple module

atradebot.strategies.strategy module

class atradebot.strategies.strategy.Strategy

Bases: ABC

abstractmethod generate_allocation(date: date, portfolio)

Generate allocation for a specific date and portfolio.

Parameters:
  • date (datetime.date) – The date for which allocation needs to be generated.

  • portfolio (object) – The portfolio for which allocation needs to be generated.

Raises:

NotImplementedError – This method must be implemented by subclasses.

abstractmethod predict(present_date: date, future_days: int, stock: str)

Predict the stock price for a given future date.

Parameters:
  • present_date (datetime.date) – The present date for which the prediction is made.

  • future_days (int) – The number of days in the future for which the prediction is made.

  • stock (str) – The stock symbol for which the prediction is made.

Raises:

NotImplementedError – This is an abstract method that must be implemented in a subclass.

class atradebot.strategies.strategy.StrategyConfig(past_date: date = datetime.date(2023, 5, 1), present_date: date = datetime.date(2023, 12, 10), inference_days: int = 10, future_days: int = 10, train_days: int = 1095, newsapi: str = 'dataset', strategy: str = 'SimpleStrategy', run_trade: bool = False, cash: int = 10000)

Bases: object

A dataclass representing the configuration for a trading strategy.

data

The historical data for trading.

Type:

pandas.DataFrame

past_date

The starting date for historical data.

Type:

datetime.date

present_date

The current date for trading.

Type:

datetime.date

stocks

The list of stocks to trade.

Type:

list

inference_days

Number of days to consider for inference.

Type:

int

future_days

Number of days to predict into the future.

Type:

int

train_days

Number of days to train the model. history-data used in arima and strategies that train as it goes [Rolling Forecast]

Type:

int

cash

Initial amount of capital for trading.

Type:

int

newsapi

API to use for news data.

Type:

str

strategy

The trading strategy to use.

Type:

str

cash: int = 10000
future_days: int = 10
inference_days: int = 10
newsapi: str = 'dataset'
past_date: date = datetime.date(2023, 5, 1)
present_date: date = datetime.date(2023, 12, 10)
run_trade: bool = False
strategy: str = 'SimpleStrategy'
train_days: int = 1095

Module contents