OlympusTrader.insight.executors.new package

Submodules

OlympusTrader.insight.executors.new.cancelAllOppositeSide module

class OlympusTrader.insight.executors.new.cancelAllOppositeSide.CancelAllOppositeSidetExecutor(strategy, **kwargs)

Bases: BaseExecutor

### Executor for Cancel All Opposite Side This executor is used to cancel all opposite side Insights generated for the insight symbol. This is done by setting the market changed flag to True for all opposite side insights and closing or cancelling the trades insights.

Parameters:

(BaseStrategy) (strategy) – The strategy instance

Author:

@isaac-diaby

run(insight)

Run the executor.

OlympusTrader.insight.executors.new.dynamicQuantityToRisk module

class OlympusTrader.insight.executors.new.dynamicQuantityToRisk.DynamicQuantityToRiskExecutor(strategy, maximum_costbasis: float = 200000.0, minimum_costbasis: float = 1000.0, **kwargs)

Bases: BaseExecutor

### Executor for Dynamic Quantity to Risk This executor uses risks a percentage of the account balance to determine the quantity to trade.

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

  • (float) (minimum_costbasis) – The maximum cost basis for the trade. Default is 200,000.

  • (float) – The minimum cost basis for the trade. Default is 1,000.

#### How it works: When a new insight is generated, the executor calculates the quantity to trade based on the percentage of the account balance which is a percentage of insight.confidence * RISK.

Note: limit price and stop loss levels must be set in the insight before using this executor.

Author:

@isaac-diaby

maximum_costbasis: float
minimum_costbasis: float
run(insight)

Run the executor.

OlympusTrader.insight.executors.new.fullAccountQuantiityToRisk module

class OlympusTrader.insight.executors.new.fullAccountQuantiityToRisk.FullAccountQuantityToRiskExecutor(strategy, **kwargs)

Bases: BaseExecutor

### Executor for Full Account Quantity to Risk This executor uses the full account cash balance to determine the quantity to trade.

Parameters:

(BaseStrategy) (strategy) – The strategy instance

#### How it works: When a new insight is generated, the executor calculates the quantity to trade based on the account balance.

Note: limit price ust be set in the insight before using this executor.

Author:

@isaac-diaby

run(insight)

Run the executor.

OlympusTrader.insight.executors.new.marketOrderEntryPrice module

class OlympusTrader.insight.executors.new.marketOrderEntryPrice.MarketOrderEntryPriceExecutor(strategy, **kwargs)

Bases: BaseExecutor

### Executor for Market Order Entry Price This executor is used to set the entry price for market orders. The entry price is set to the current close price of the asset. Get price from latest bar if limit price is not set.

Parameters:

(BaseStrategy) (strategy) – The strategy instance

Note: This is only applicable for insights that are set to market orders and have no limit price set. If a limit is set, executor passes the insight to the next executor.

Author:

@isaac-diaby

run(insight)

Run the executor.

OlympusTrader.insight.executors.new.minimumRiskToReward module

class OlympusTrader.insight.executors.new.minimumRiskToReward.MinimumRiskToRewardExecutor(strategy, minimumRR=None, **kwargs)

Bases: BaseExecutor

### Executor for Minimum Risk to Reward Ratio This executor is used reject insights that do not meet the minimum risk to reward ratio (RRR).

This will update your strategy instance with the minimum risk to reward ratio required. (STRATEGY.minRewardRiskRatio), if not already set.

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

  • (float) (minimumRR) – The minimum risk to reward ratio required. Default is 2.0

Note: You will need to have already set the limit price, stop loss and take profit levels in the insight before using this executor.

Author:

@isaac-diaby

run(insight)

Run the executor.

OlympusTrader.insight.executors.new.percentageDCALevels module

class OlympusTrader.insight.executors.new.percentageDCALevels.PercentageDCALevels(strategy, includes: list[str], dcaPercentage: float = 0.01, dcalevels: int = 5, **kwargs)

Bases: BaseExecutor

### Executor for Adding DCA Levels This executor is used to add DCA levels to a new insight that already had a desired quantity.

It will append the DCA levels as childens to the insight based on the DCA percentage and levels set in the alpha. The child insights will have the same TP as the parent insight bur will alter the SL below / above the last DCA level. The children insight strategyType will be set to the alpha name with a suffix of “_CHILD”.

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

  • (list[str]) (includes) – The alphas to include

  • (float) (dcaPercentage) – The percentage to space the DCA levels

  • (int) (dcalevels) – The number of DCA levels to add

Author:

@isaac-diaby

calculate_dca_quantities(total_quantity, price_levels)

Calculate the quantity to buy at each DCA level using the Inverse Price Proportionality method.

Parameters:
  • total_quantity – Total desired quantity to accumulate.

  • price_levels – List of prices at each DCA level.

Returns:

List of quantities to buy at each level.

calculate_drawdowns(entry_prices, quantities, stop_loss_price)

Calculate the expected drawdown at each DCA level.

Parameters:
  • entry_prices – List of entry prices at each DCA level.

  • quantities – List of quantities bought at each DCA level.

  • stop_loss_price – The stop loss price.

Returns:

List of drawdowns for each level and total drawdown up to each level.

dcaPercentage: float
dcalevels: int
includes: list[str]

alpha to include

run(insight)

Run the executor.

OlympusTrader.insight.executors.new.rejectExpiredInsight module

class OlympusTrader.insight.executors.new.rejectExpiredInsight.RejectExpiredInsightExecutor(strategy, **kwargs)

Bases: BaseExecutor

### Executor for Rejecting Expired Insights This executor is used to reject insights that have expired.

Parameters:

(BaseStrategy) (strategy) –

The strategy instance

Author:

@isaac-diaby

run(insight)

Run the executor.

Module contents