Available translations

Conceptual Context - Episode, Strategy, Position, Strategy Stages

foundations.png
Summary: Track the properties within each of the major concepts handled by the trading bot, such as episodes, strategies, positions, strategy stages, and exchange orders.
Episodes, strategies, positions, strategy stages, exchange orders, and other concepts may be seen as different contexts too, although not of the temporal kind.
For instance, you may want to know what the ROI is in the context of the episode—that is, the ROI after several positions have passed—or the ROI of the current position only.
In other words, many properties such as performance metrics—like ROI, or profit loss—or market data—like the begin and end datetimes or any of these concepts—exist in more than one conceptual context.
The following pages describe each of these major conceptual contexts, which, in turn, may exist in more than one temporal context.
Trading Episode
Foundations->Node->Trading Episode->Definition
trading-episode.png
Episode is the object that handles the information corresponding to the whole run of the trading bot—beginning to end—between the specified initial datetime and final datetime, in the time range parameter of the trading session.
Foundations->Node->Trading Episode->Content
In other words, episode is the context framed between the datetimes that make up the whole trading session, as per the session's configuration. As such, an episode keeps track of—and accumulates—the results of all positions entered throughout a complete run of a trading session.
In this section of the hierarchy, you have access to:
  • running balances and overall performance metrics denominated in both the base and quoted assets;
  • counters, such as the number of positions taken, orders placed, hits, fails, and so on;
  • statistics, such as performance metrics consolidating both assets, number of days in the episode, or user-defined statistics;
  • the distance to certain events, such as the number of candles to the last take position event, or the last create order event;
  • rates describing each candle in the episode, such as the open, close, min and max rates.
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Strategy
Foundations->Node->Strategy->Definition
strategy.png
The strategy section of the trading engine keeps track of information relating to the trading strategies that are triggered-on, during the time they remain open.
Foundations->Node->Strategy->Content
The strategy node is available both in the current context and the last context, that is, you may retrieve information of the strategy that was last triggered or the one currently open.
A strategy is open from the instant it is triggered-on until the instant it is triggered-off. Therefore, this section of the data structure features information spaning those periods only.
This section provides all the basic details about the strategy, which is particularly useful when the trading system features multiple strategies. It also provides information about the context, that is, what is going on with the market at the time strategies are triggered-on and off.
Most interestingly, the strategy section provides information such as which situation was responsible for triggering the strategy. This may be particularly useful in complex strategies in which the trigger on event may be defined by multiple situations.
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Position
Foundations->Node->Position->Definition
position.png
Position is the section of the data structure that keeps track of information within the scope of each position, and during the time a position is open.
Foundations->Node->Position->Content
The position node is available both in the current context and the last context, that is, you may retrieve information of the position that was last opened or the one currently open.
A position is open from the instant the take position event is triggered until the instant the close stage is closed. Therefore, this section of the data structure features information spaning those periods only.
In this section of the hierarchy, you have access to:
  • balances and position performance metrics denominated in both the base and quoted assets;
  • counters, such as the number of periods the position has been open;
  • statistics, such as performance metrics consolidating both assets, or user-defined statistics;
  • the distance to certain events, such as the number of candles to the last take position event, or the last create order event;
  • rates describing each candle in the episode, such as the open, close, min and max rates;
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Strategy Stages
The Superalgos Protocol implements a trading framework by which strategies within a trading system are described in stages. The trading bot uses these definitions during runtime.
The concept of strategy stages in the context of the trading engine is an extension of the original concept, useful to keep track of the activity of the trading bot and organize the information processed during runtime.
Use these sections of the trading engine if you wish to track exactly what is going on, at a granular level, step by step, from the instant a strategy is triggered until it is closed, with the information segregated by strategy stage.
The exercise may be particularly useful to grasp the intricacies of the workings of the trading bot or to research particular behaviors.
Strategy Trigger Stage
Foundations->Node->Strategy Trigger Stage->Definition
strategy-trigger-stage.png
Strategy trigger stage is the section of the data structure that keeps track of information specific to the scope of the trigger stage during the period the stage is open.
Foundations->Node->Strategy Trigger Stage->Content
The trigger stage is active from the instant the trigger-on event is triggered until either the trigger-off event or the take position event gets triggered. Therefore, this section of the data structure features information spanning those periods only.
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Strategy Open Stage
Foundations->Node->Strategy Open Stage->Definition
strategy-open-stage.png
Strategy open stage is the section of the data structure that keeps track of information specific to the scope of the open stage during the period the stage is open.
Foundations->Node->Strategy Open Stage->Content
The open stage is open from the instant the take position event gets triggered, and starts closing from the instant one of the following things happen:
  • the target size is filled,
  • the close stage event is triggered,
  • the take profit or stop loss targets are hit.
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Strategy Manage Stage
Foundations->Node->Strategy Manage Stage->Definition
strategy-manage-stage.png
Strategy manage stage is the section of the data structure that keeps track of information specific to the scope of the manage stage during the period the stage is open.
Foundations->Node->Strategy Manage Stage->Content
The manage stage is active from the instant the take position event is triggered until the instant either the stop or take profit targets are hit.
Therefore, this section of the data structure features information spanning those periods only.
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Strategy Close Stage
Foundations->Node->Strategy Close Stage->Definition
strategy-close-stage.png
Strategy close stage is the section of the data structure that keeps track of information specific to the scope of the close stage during the period the stage is open.
Foundations->Node->Strategy Close Stage->Content
The close stage is active from the instant either the stop loss or take profit targets are hit until the instant the target size is filled or the close stage event is triggered.
Therefore, this section of the data structure features information spanning those periods only.
Foundations->Concept->Reusable Snippets->Note for Hierarchy Tables No Discussion
Previous
Temporal Context - Current and Last
Next
Base Asset and Quoted Asset