investfly.api.StrategyApiClient

Client for trading-strategy CRUD, deployment state, and backtests.

class StrategyApiClient:

Create and manage configuration or Python trading strategies.

StrategyApiClient(restApiClient: investfly.api.RestApiClient.RestApiClient)

Create a strategy client backed by an authenticated transport.

def listStrategies( self) -> List[investfly.models.strategy.TradingStrategyModel]:

Return strategies owned by the authenticated user.

def getStrategy( self, strategyId: int) -> investfly.models.strategy.TradingStrategyModel:

Return one strategy by numeric id.

def getStrategyDeployment(self, strategyId: int) -> Optional[Dict[str, Any]]:

Return current deployment metadata, or None when the strategy is not deployed.

Create a SCRIPT or CONFIG strategy from a complete strategy model.

def deleteStrategy(self, strategyId: int) -> investfly.models.common.Message:

Delete an undeployed strategy.

def updateStrategyCode(self, strategyId: int, code: str) -> str:

Replace and validate the Python source of a SCRIPT strategy.

def updateStrategyConfig(self, strategyId: int, config: Any) -> Any:

Replace the configuration of a CONFIG strategy.

def startBacktest(self, strategyId: int) -> investfly.models.common.Message:

Queue a backtest for a strategy.

def stopBacktest(self, strategyId: int) -> investfly.models.common.Message:

Request cancellation of a queued or running backtest.

def getBacktestResult( self, strategyId: int) -> investfly.models.strategy.BacktestResult:

Return the latest backtest result for a strategy.