コード例 #1
0
        public static IBSocket SendSecurity(this IBSocket socket, SecurityMessage security, bool sendPrimExchange = true, bool sendPrimExchange2 = true)
        {
            if (security == null)
            {
                throw new ArgumentNullException(nameof(security));
            }

            var multiplier = security.Multiplier;

            socket
            .Send(security.Name)
            .SendSecurityType(security.SecurityType)
            .Send(security.ExpiryDate, _expiryFormat)
            .Send(security.Strike)
            .SendOptionType(security.OptionType)
            .SendIf(ServerVersions.V15, s => s.Send(multiplier == 1 ? string.Empty : multiplier.To <string>()))
            .SendBoardCode(security.SecurityId.BoardCode);

            if (sendPrimExchange2)
            {
                socket.Send(security.SecurityId.BoardCode);
                socket.Send(security.GetRoutingBoard());
            }
            else if (sendPrimExchange)
            {
                socket.SendPrimaryExchange(security);
            }

            return(socket
                   .SendCurrency(security.Currency)
                   .SendSecurityCode(security.SecurityId.SecurityCode));
        }