ATAS
|
Base class for implementing trading strategies. More...
Public Member Functions | |
void | Start () |
void | Stop () |
async Task | StartAsync () |
Starts the strategy, allowing it to execute its trading logic. | |
async Task | WatchAsync () |
async Task | StartFromWatchAsync () |
async Task | StopAsync () |
Stops the strategy, terminating its execution and releasing any resources. | |
async void | OpenOrder (Order order, bool isAutomated=true) |
Открыть ордер. | |
async Task | OpenOrderAsync (Order order, bool isAutomated=true) |
Открыть ордер. | |
async void | ModifyOrder (Order order, Order neworder, bool isAutomated=true) |
Изменить ордер. | |
async Task | ModifyOrderAsync (Order order, Order neworder, bool isAutomated=true) |
Изменить ордер. | |
async void | CancelOrder (Order order, bool isAutomated=true) |
Отменить ордер. | |
async Task | CancelOrderAsync (Order order, bool isAutomated=true) |
Отменить ордер. | |
Task | StartAsync () |
Starts the strategy, allowing it to execute its trading logic. | |
Task | StopAsync () |
Stops the strategy, terminating its execution and releasing any resources. | |
Protected Member Functions | |
Strategy () | |
void | SetState (StrategyStates state) |
Set strategy state. | |
void | SetErrorState (StrategyErrorTypes type, string[] errorDescriptions) |
Set StrategyStates.Error state. | |
void | ResetErrorState () |
Reset error state. | |
void | RaisePropertyChanged (string propertyName) |
Raises the PropertyChanged event with the specified property name. | |
void | RaiseShowNotification (string message, string title=null, bool isError=false) |
Raises the ShowNotification event with the specified message, title, and error flag. | |
bool | SetProperty< TValue > (ref TValue storage, TValue newValue, string propertyName, Action< TValue, TValue > onChanged=null) |
Sets the property with the specified name to the new value and raises the PropertyChanged event if the value has changed. | |
string | GetOCOGroup () |
Generates a unique OCO (One-Cancels-the-Other) group identifier based on the current timestamp. | |
bool | CanProcess (Order order) |
Checks if the specified order can be processed by this strategy. | |
ICollection< MyTrade > | FilterMyTrades (IEnumerable< MyTrade > trades) |
Filters and returns the collection of MyTrade that belong to the current portfolio and security and have occurred after the latest trade time. | |
void | UpdateCurrentPosition () |
Update thr CurrentPosition and AveragePrice values. | |
virtual Task | OnStarted () |
Called when the strategy is started from StrategyStates.Stopped state. | |
virtual Task | OnStartedFromWatch () |
Called when the strategy is started from StrategyStates.Watch state. | |
virtual Task | OnStopping () |
Called when the strategy is stopping. | |
virtual Task | OnStopped () |
Called when the strategy is stopped. | |
virtual Task | OnOpenOrder (Order order, bool isAutomated) |
Called when a new order is opened. | |
virtual Task | OnModifyOrder (Order order, Order newOrder, bool isAutomated) |
Called when an existing order is modified. | |
virtual Task | OnCancelOrder (Order order, bool isAutomated) |
Called when an order is canceled. | |
virtual void | OnMarketDepth (IEnumerable< MarketDepth > depths) |
Called when market depth data is received. | |
virtual void | OnBestBidAsk (MarketDepth depth) |
Called when the best bid or ask market depth data is received. | |
virtual void | OnNewTrade (Trade trade) |
Called when a new trade occurs. | |
virtual void | OnNewPortfolio (Portfolio portfolio) |
Called when a new portfolio is added. | |
virtual void | OnNewPosition (Position position) |
Called when a new position is added. | |
virtual void | OnPositionChanged (Position position) |
Called when an existing position is changed. | |
virtual void | OnPnLChanged (int ticks) |
Called when the profit and loss (PnL) changes. | |
virtual void | OnNewOrder (Order order) |
Called when a new order is added. | |
virtual void | OnOrderChanged (Order order) |
Called when an existing order is changed. | |
virtual void | OnOrderRegisterFailed (Order order, string message) |
Called when an order registration fails. | |
virtual void | OnOrderCancelFailed (Order order, string message) |
Called when an order cancellation fails. | |
virtual void | OnOrderModifyFailed (Order order, Order newOrder, string message) |
Called when an order modification fails. | |
virtual void | OnNewMyTrade (MyTrade myTrade) |
Called when a new trade is added to the collection of MyTrade. | |
virtual void | OnCurrentPositionChanged () |
Called when the volume of the current position changes. | |
virtual void | OnUpdateStrategyState () |
Called when the strategy state needs to be updated. | |
virtual bool | CanProcess () |
Checks if the strategy can process operations in the current state. | |
virtual bool | CanUpdateCurrentPosition (Position position) |
Checks if the current position can be updated with the specified position. | |
virtual void | LogParameters () |
Log current parameters. | |
Properties | |
Security | Security [get, set] |
Gets or sets the security associated with the strategy. | |
Portfolio | Portfolio [get, set] |
Gets or sets the portfolio associated with the strategy. | |
TPlusLimits? | TPlusLimit [get, set] |
Gets or sets the T+ limits for the strategy. | |
IDataFeedConnector | Connector [get, set] |
Gets or sets the data feed connector for the strategy. | |
IEnumerable< MyTrade > | MyTrades [get] |
IEnumerable< Order > | Orders [get] |
Position | Position [get, set] |
decimal | CurrentPosition [get] |
Gets the current position volume of the strategy. | |
decimal | AveragePrice [get] |
Gets the average price of the strategy's trades. | |
int | OpenTicksPnL [get] |
decimal | OpenPnL [get] |
Gets the open profit and loss of the strategy. | |
decimal | ClosedPnL [get] |
Gets the closed profit and loss of the strategy. | |
MarketDepth | BestBid [get] |
MarketDepth | BestAsk [get] |
StrategyStates | State [get, protected set] |
Gets the current state of the strategy. | |
StrategyStateDescription | StateDescription [get] |
string | Name [get, set] |
Gets or sets the name of the strategy. | |
Properties inherited from ATAS.Strategies.IStrategy | |
string | Name [get, set] |
Gets or sets the name of the strategy. | |
StrategyStates | State [get] |
Gets the current state of the strategy. | |
decimal | CurrentPosition [get] |
Gets the current position volume of the strategy. | |
decimal | AveragePrice [get] |
Gets the average price of the strategy's trades. | |
decimal | OpenPnL [get] |
Gets the open profit and loss of the strategy. | |
decimal | ClosedPnL [get] |
Gets the closed profit and loss of the strategy. | |
Security | Security [get, set] |
Gets or sets the security associated with the strategy. | |
Portfolio | Portfolio [get, set] |
Gets or sets the portfolio associated with the strategy. | |
TPlusLimits? | TPlusLimit [get, set] |
Gets or sets the T+ limits for the strategy. | |
IDataFeedConnector | Connector [get, set] |
Gets or sets the data feed connector for the strategy. | |
Events | |
PropertyChangedEventHandler | PropertyChanged |
EventHandler< StrategyStateChangedEventArgs > | StateChanged |
EventHandler< StrategyNotificationEventArgs > | ShowNotification |
Events inherited from ATAS.Strategies.IStrategy | |
EventHandler< StrategyStateChangedEventArgs > | StateChanged |
Occurs when the state of the strategy changes. | |
EventHandler< StrategyNotificationEventArgs > | ShowNotification |
Occurs when the strategy needs to show a notification or alert. | |
Base class for implementing trading strategies.
|
protected |
async void ATAS.Strategies.Strategy.CancelOrder | ( | Order | order, |
bool | isAutomated = true |
||
) |
Отменить ордер.
order | Ордер. |
isAutomated | флаг, является ли выставляемый ордером выставляемым автоматически или ордер является выставляемым юзером. |
async Task ATAS.Strategies.Strategy.CancelOrderAsync | ( | Order | order, |
bool | isAutomated = true |
||
) |
Отменить ордер.
order | Ордер. |
isAutomated | флаг, является ли выставляемый ордером выставляемым автоматически или ордер является выставляемым юзером. |
|
protectedvirtual |
Checks if the strategy can process operations in the current state.
true
if the strategy can process; otherwise, false
.
|
protected |
Checks if the specified order can be processed by this strategy.
order | The order to be processed. |
true
if the order can be processed; otherwise, false
.
|
protectedvirtual |
Checks if the current position can be updated with the specified position.
position | The position to be compared with the current position. |
true
if the current position can be updated; otherwise, false
.Reimplemented in ATAS.Strategies.ATM.ATMStrategy< TStrategy >.
|
protected |
Filters and returns the collection of MyTrade that belong to the current portfolio and security and have occurred after the latest trade time.
trades | The collection of MyTrade to be filtered. |
|
protected |
Generates a unique OCO (One-Cancels-the-Other) group identifier based on the current timestamp.
|
protectedvirtual |
Log current parameters.
Reimplemented in ATAS.Strategies.ATM.ATMStrategy< TStrategy >.
async void ATAS.Strategies.Strategy.ModifyOrder | ( | Order | order, |
Order | neworder, | ||
bool | isAutomated = true |
||
) |
Изменить ордер.
order | Ордер, который модифицируется. |
neworder | Ордер с новыми параметрами. |
isAutomated | флаг, является ли выставляемый ордером выставляемым автоматически или ордер является выставляемым юзером. |
async Task ATAS.Strategies.Strategy.ModifyOrderAsync | ( | Order | order, |
Order | neworder, | ||
bool | isAutomated = true |
||
) |
Изменить ордер.
order | Ордер, который модифицируется. |
neworder | Ордер с новыми параметрами. |
isAutomated | флаг, является ли выставляемый ордером выставляемым автоматически или ордер является выставляемым юзером. |
|
protectedvirtual |
Called when the best bid or ask market depth data is received.
depth | The best bid or ask market depth data. |
|
protectedvirtual |
Called when an order is canceled.
order | The order to be canceled. |
isAutomated | A flag indicating whether the order was canceled automatically. |
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when the volume of the current position changes.
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when market depth data is received.
depths | The collection of MarketDepth data. |
|
protectedvirtual |
Called when an existing order is modified.
order | The original order. |
newOrder | The modified order with new parameters. |
isAutomated | A flag indicating whether the order was modified automatically. |
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when a new trade is added to the collection of MyTrade.
myTrade | The newly added MyTrade. |
|
protectedvirtual |
Called when a new order is added.
order | The newly added order. |
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when a new portfolio is added.
portfolio | The newly added portfolio. |
|
protectedvirtual |
Called when a new position is added.
position | The newly added position. |
|
protectedvirtual |
Called when a new trade occurs.
trade | The newly occurred trade. |
|
protectedvirtual |
Called when a new order is opened.
order | The newly opened order. |
isAutomated | A flag indicating whether the order was opened automatically. |
|
protectedvirtual |
Called when an order cancellation fails.
order | The order that failed to cancel. |
message | The error message. |
|
protectedvirtual |
Called when an existing order is changed.
order | The changed order. |
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when an order modification fails.
order | The order that failed to modify. |
newOrder | The modified order with new parameters. |
message | The error message. |
|
protectedvirtual |
Called when an order registration fails.
order | The order that failed to register. |
message | The error message. |
|
protectedvirtual |
Called when the profit and loss (PnL) changes.
ticks | The number of ticks by which the PnL changes. |
|
protectedvirtual |
Called when an existing position is changed.
position | The changed position. |
|
protectedvirtual |
Called when the strategy is started from StrategyStates.Stopped state.
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when the strategy is started from StrategyStates.Watch state.
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when the strategy is stopped.
|
protectedvirtual |
Called when the strategy is stopping.
Reimplemented in ATAS.Strategies.ATM.BaseStopProfitStrategy< TStrategy, TSettings >.
|
protectedvirtual |
Called when the strategy state needs to be updated.
async void ATAS.Strategies.Strategy.OpenOrder | ( | Order | order, |
bool | isAutomated = true |
||
) |
Открыть ордер.
order | Ордер. |
isAutomated | флаг, является ли выставляемый ордером выставляемым автоматически или ордер является выставляемым юзером |
async Task ATAS.Strategies.Strategy.OpenOrderAsync | ( | Order | order, |
bool | isAutomated = true |
||
) |
Открыть ордер.
order | Ордер. |
isAutomated | флаг, является ли выставляемый ордером выставляемым автоматически или ордер является выставляемым юзером |
|
protected |
Raises the PropertyChanged event with the specified property name.
propertyName | The name of the property that changed. |
|
protected |
Raises the ShowNotification event with the specified message, title, and error flag.
message | The notification message. |
title | The notification title (optional). |
isError | A flag indicating whether the notification is an error. |
|
protected |
Reset error state.
|
protected |
Set StrategyStates.Error state.
type | Error type. |
errorDescriptions | Error descriptions. |
|
protected |
Sets the property with the specified name to the new value and raises the PropertyChanged event if the value has changed.
TValue | The type of the property value. |
storage | A reference to the storage for the property value. |
newValue | The new value of the property. |
propertyName | The name of the property. |
onChanged | An optional action to execute when the property value changes. |
true
if the property value has changed; otherwise, false
.
|
protected |
Set strategy state.
state | New state. |
void ATAS.Strategies.Strategy.Start | ( | ) |
async Task ATAS.Strategies.Strategy.StartAsync | ( | ) |
Starts the strategy, allowing it to execute its trading logic.
Implements ATAS.Strategies.IStrategy.
async Task ATAS.Strategies.Strategy.StartFromWatchAsync | ( | ) |
void ATAS.Strategies.Strategy.Stop | ( | ) |
async Task ATAS.Strategies.Strategy.StopAsync | ( | ) |
Stops the strategy, terminating its execution and releasing any resources.
Implements ATAS.Strategies.IStrategy.
|
protected |
Update thr CurrentPosition and AveragePrice values.
async Task ATAS.Strategies.Strategy.WatchAsync | ( | ) |
|
get |
Gets the average price of the strategy's trades.
Implements ATAS.Strategies.IStrategy.
|
get |
|
get |
|
get |
Gets the closed profit and loss of the strategy.
Implements ATAS.Strategies.IStrategy.
|
getset |
Gets or sets the data feed connector for the strategy.
Implements ATAS.Strategies.IStrategy.
|
get |
Gets the current position volume of the strategy.
Implements ATAS.Strategies.IStrategy.
|
get |
|
getset |
Gets or sets the name of the strategy.
Implements ATAS.Strategies.IStrategy.
|
get |
Gets the open profit and loss of the strategy.
Implements ATAS.Strategies.IStrategy.
|
get |
|
get |
|
getset |
Gets or sets the portfolio associated with the strategy.
Implements ATAS.Strategies.IStrategy.
|
getset |
|
getset |
Gets or sets the security associated with the strategy.
Implements ATAS.Strategies.IStrategy.
|
getprotected set |
Gets the current state of the strategy.
Implements ATAS.Strategies.IStrategy.
|
get |
|
getset |
Gets or sets the T+ limits for the strategy.
Implements ATAS.Strategies.IStrategy.
PropertyChangedEventHandler ATAS.Strategies.Strategy.PropertyChanged |
EventHandler<StrategyNotificationEventArgs> ATAS.Strategies.Strategy.ShowNotification |
EventHandler<StrategyStateChangedEventArgs> ATAS.Strategies.Strategy.StateChanged |