OlympusTrader.alpha package

Submodules

OlympusTrader.alpha.base_alpha module

class OlympusTrader.alpha.base_alpha.AlphaResults(insight: Insight | None = None, success: bool = True, message: str = None, alpha: str = None)

Bases: object

### Alpha Results This class is used to store the results of the Alpha.

alpha: str

Name of the executor.

insight: Insight

Insight generated by the alpha.

message: str

Message indicating the result of the alpha.

success: bool

Boolean value indicating if the executor was ran successful or not.

class OlympusTrader.alpha.base_alpha.BaseAlpha(strategy: BaseStrategy, name: str, version: str = '1.0', baseConfidenceModifierField: str | None = None, allowed_assets: set[str] | None = None)

Bases: ABC

### Abstract class for alpha implementations. Used to generate insights based on the strategy.

ALLOWED_ASSETS: set[str] | None = {}

Set of allowed assets for the executor

NAME: str

Name of the alpha model.

STRATEGY: BaseStrategy

Reference to the strategy instance.

TA: List[dict] = []

List of technical analysis needed for the alpha model.

VERSION: str

Version of the alpha model.

baseConfidenceModifierField: str | None = None

Field to modify base confidence.

abstractmethod generateInsights(symbol: str) AlphaResults

Generate insights based on the alpha model.

get_asset(symbol: str) IAsset
get_baseConfidenceModifier(symbol: str)
get_history(symbol: str) DataFrame
get_latest_bar(symbol: str) DataFrame
get_latest_quote(asset: IAsset) IQuote
get_previos_bar(symbol: str) DataFrame
abstractmethod init(asset: IAsset)

Initialize the alpha model for each assets. variables, data, etc. in the state of the Strategy.

isAllowedAsset(symbol: str) bool

Check if the asset is allowed

registerAlpha()
returnResults(insight: Insight | None = None, success: bool = True, message: str = None) AlphaResults
abstractmethod start()

Initialize the alpha model once at the start. data, etc. in the state of the Strategy.

OlympusTrader.alpha.ema_price_crossover module

class OlympusTrader.alpha.ema_price_crossover.EMAPriceCrossoverAlpha(strategy, atrPeriod: int = 14, emaPeriod: int = 14, baseConfidenceModifierField=None, **kwargs)

Bases: BaseAlpha

### EMA Crossover Alpha This alpha model generates insights based on EMA Crossover.

Parameters:
  • (BaseStrategy) (strategy) – The strategy instance

  • (int) (emaPeriod) – The period for the ATR indicator

  • (int) – The period for the EMA indicator

  • (str) (baseConfidenceModifierField) – The field to use for modifying the base confidence

Author:

@isaac-diaby

atrColumn: str
create_insight(order_side: IOrderSide, symbol: str, latestBar, previousBar, latestIATR, latestBarIEMA, baseConfidence: float)
emaColumn: str
generateInsights(symbol)

Generate insights based on the alpha model.

init(asset)

Initialize the alpha model for each assets. variables, data, etc. in the state of the Strategy.

is_long_signal(latestBar, previousBar, latestIATR, latestBarIEMA, previousBarIATR, previousBarIEMA)
is_short_signal(latestBar, previousBar, latestIATR, latestBarIEMA, previousBarIATR, previousBarIEMA, symbol)
start()

Initialize the alpha model once at the start. data, etc. in the state of the Strategy.

OlympusTrader.alpha.rsi_divergance_alpha module

class OlympusTrader.alpha.rsi_divergance_alpha.RSIDiverganceAlpha(strategy, local_window=36, divergance_window=50, atrPeriod=14, rsiPeriod=14, baseConfidenceModifierField=None, useQuoteEntry=False, **kwargs)

Bases: BaseAlpha

### RSI Divergance Alpha This alpha model generates insights based on RSI Divergance.

Parameters:
  • (BaseStrategy) (strategy) – The strategy instance

  • (int) (rsiPeriod) – The window to consider for local swing points

  • (int) – The window to consider for divergance

  • (int) – The period for the ATR indicator

  • (int) – The period for the RSI indicator

  • (str) (baseConfidenceModifierField) – The field to use for modifying the base confidence

Author:

@isaac-diaby

atrColumn: str
computeLocalSwingPoints(symbol: str)
computeRSIDivergance(symbol: str)
divergance_window: int
generateInsights(symbol)

Generate insights based on the alpha model.

init(asset)

Initialize the alpha model for each assets. variables, data, etc. in the state of the Strategy.

local_window: int
rsiColumn: str
start()

Initialize the alpha model once at the start. data, etc. in the state of the Strategy.

use_quote_entry: bool

OlympusTrader.alpha.test_entry module

class OlympusTrader.alpha.test_entry.TestEntryAlpha(strategy, atrPeriod=14, limitEntries=False, maxSpawn=1, baseConfidenceModifierField=None, **kwargs)

Bases: BaseAlpha

### Test Entry Alpha This alpha model generates insights if there is no other insight. This is intended for testing purposes.

Parameters:
  • (BaseStrategy) (strategy) – The strategy instance

  • (int) (maxSpawn) – The period for the ATR indicator

  • (bool) (limitEntries) – Whether to limit entries

  • (int) – The maximum number of insights that can spawn at the same time

  • (str) (baseConfidenceModifierField) – The field to use for modifying the base confidence

Author:

@isaac-diaby

atrColumn: str
generateInsights(symbol)

Generate insights based on the alpha model.

init(asset)

Initialize the alpha model for each assets. variables, data, etc. in the state of the Strategy.

limitEntry: bool
maxSpawn: int
start()

Initialize the alpha model once at the start. data, etc. in the state of the Strategy.

Module contents