private static Transaction SetSecurity(this Transaction transaction, IMessageSessionHolder sessionHolder, OrderMessage message) { return (transaction .SetClassCode(sessionHolder.GetSecurityClass(message.SecurityId)) .SetSecurityCode(message.SecurityId.SecurityCode)); }
public static Transaction CreateCancelFuturesTransaction(this IMessageSessionHolder sessionHolder, OrderGroupCancelMessage message) { if (sessionHolder == null) { throw new ArgumentNullException("sessionHolder"); } if (message == null) { throw new ArgumentNullException("message"); } if (message.PortfolioName.IsEmpty()) { throw new ArgumentException("message"); } if (message.SecurityId.SecurityCode.IsEmpty()) { throw new ArgumentException("message"); } var underlyingSecurityCode = message.GetValue <string>("UnderlyingSecurityCode"); if (underlyingSecurityCode.IsEmpty()) { throw new ArgumentException(LocalizedStrings.Str1850, "message"); } var secType = message.SecurityId.SecurityType; if (secType != SecurityTypes.Future) { throw new ArgumentException(LocalizedStrings.Str1851Params.Put(secType), "message"); } var transaction = new Transaction(TransactionTypes.CancelGroup, message); transaction .SetAccount(message.PortfolioName) .SetBaseContract(underlyingSecurityCode) .SetAction(TransactionActions.KillAllFuturesOrders) .SetClassCode(sessionHolder.GetSecurityClass(message.SecurityId)); if (message.Side != null) { transaction.SetSide(message.Side.Value); } return(transaction); }
private static Transaction SetOtherSecurity(this Transaction transaction, IMessageSessionHolder sessionHolder, SecurityId securityId) { var secClass = sessionHolder.GetSecurityClass(securityId); return(transaction.SetOtherSecurity(securityId.SecurityCode, secClass)); }