Skip to main content

Strategy lifecycle control

Strategies are identified by name. All strategies that are visible to the user are shown in the Photon strategies menu. There may be other strategies that are not visible to the user.

Strategies persist between starts and stops of the Strategy Engine. Note that in the development environment, strategies are automatically unloaded and removed each time the system restarts, but they persist in the production environment.

Lifecycle

A diagram of the strategy lifecycle

Strategies are uploaded to the server in a multi-step process. Strategy status changes reflect progress in the process.

StatusDescription
PreparingThe strategy file is being hashed and prepared for upload
LoadingThe strategy file is being transferred to the server
StoppedThe strategy has been transferred and verified and is ready to be started
RunningThe strategy has been started
ErrorAn error occurred uploading the strategy or starting it

Strategy actions

  • Start.

    Strategies that are in Stopped status are ready to be started. If the strategy starts successfully, the status changes to Running. Running strategies remain running until stopped, either from the Strategy Control View or by stopping the Strategy Engine.

  • Stop.

    Strategies that are in Running status can be stopped. Strategies stay running until they end themselves, are manually stopped, or the Strategy Engine is stopped.

  • Clear Events

    Strategies may generate events while running. Events are used to communicate the progress and status of a running strategy. When you Run strategies from Photon, Strategy Events are viewable from the Strategy View.

    The sample strategy provided with the source code generates events based on start, stop, and market data it receives.

    Strategy Events may be cleared all at once from a running strategy with the Clear Events action.