Advertisement
Guest User

Untitled

a guest
May 26th, 2022
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1.         private void OnExecutionUpdate(object sender, ExecutionEventArgs e)
  2.  
  3.         {
  4.             if(e.Execution.Order != null)
  5.             {
  6.                 if (e.Execution.Order.OrderState == OrderState.Filled)
  7.                 {
  8.                     if(e.Execution.MarketPosition == MarketPosition.Long)
  9.                     {
  10.                         SendMail(ToEmail, "Execution on your account",
  11.                         string.Format("Instrument: {0} Quantity: {1} Price: {2} Order Type: {3}",e.Execution.Instrument.FullName, e.Quantity, e.Price, "Buy Order")
  12.                     );
  13.                     }
  14.                    
  15.                     if(e.Execution.MarketPosition == MarketPosition.Short)
  16.                     {
  17.                         SendMail(ToEmail, "Execution on your account",
  18.                         string.Format("Instrument: {0} Quantity: {1} Price: {2} Order Type: {3}",e.Execution.Instrument.FullName, e.Quantity, e.Price, "Sell Order")
  19.                     );
  20.                     }
  21.                 }
  22.                
  23.                 if (EmailPartFilled && e.Execution.Order.OrderState == OrderState.PartFilled)
  24.                 {
  25.                     if(e.Execution.MarketPosition == MarketPosition.Long)
  26.                     {
  27.                         SendMail(ToEmail, "Partial Execution on your account",
  28.                         string.Format("Instrument: {0} Quantity: {1} Price: {2} Order Type: {3}",e.Execution.Instrument.FullName, e.Quantity, e.Price, "Buy Order")
  29.                     );
  30.                     }
  31.                    
  32.                     if(e.Execution.MarketPosition == MarketPosition.Short)
  33.                     {
  34.                         SendMail(ToEmail, "Partial Execution on your account",
  35.                         string.Format("Instrument: {0} Quantity: {1} Price: {2} Order Type: {3}",e.Execution.Instrument.FullName, e.Quantity, e.Price, "Sell Order")
  36.                     );
  37.                     }
  38.                 }
  39.             }
  40.  
  41.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement