/// <summary>
 /// Creates a new accessor to the DataStore WCF service and checks the connection.
 /// </summary>
 /// <exception cref="EndpointNotFoundException">When the connection to the specified server endpoint cannot be established.</exception>
 /// <param name="serviceUrl">The full URL to the DatabaseServices endpoint of the DataStore WCF service. Standard: http://www.service.proschlaf.at:8733/DataStore/DatabaseServices/Secure </param>
 public DataStoreServiceAccess(string serviceUrl, SecurityTypes security, string pathToClientCertificate, string clientCertificatePassword)
 {
     this.serviceEndpointAddress = serviceUrl;
     this.security = security;
     this.pathToClientCertificate   = pathToClientCertificate;
     this.clientCertificatePassword = clientCertificatePassword;
 }
 //public SqlIdProvider()
 //{
 //    this.SecurityTypes = new SecurityTypes();
 //    this.ContentSources = new ContentSources();
 //    this.ContentTypes = new ContentTypes();
 //}
 public void Init(ISqlIdDataService source)
 {
     this.SecurityTypes = new SecurityTypes(source);
     this.ContentSources = new ContentSources(source);
     this.ContentTypes = new ContentTypes(source);
     this.CoreContent = new CoreContent(source);
 }
Exemple #3
0
		public static IBSocket SendSecurityType(this IBSocket socket, SecurityTypes? securityType)
		{
			if (securityType == null)
				return socket.Send(string.Empty);

			switch (securityType)
			{
				case SecurityTypes.Stock:
					return socket.Send("STK");
				case SecurityTypes.Future:
					return socket.Send("FUT");
				case SecurityTypes.Option:
					return socket.Send("OPT");
				case SecurityTypes.Index:
					return socket.Send("IND");
				case SecurityTypes.Currency:
					return socket.Send("CASH");
				case SecurityTypes.Bond:
					return socket.Send("BOND");
				case SecurityTypes.Warrant:
					return socket.Send("WAR");
				case SecurityTypes.Forward:
				case SecurityTypes.Swap:
					throw new NotSupportedException(LocalizedStrings.Str2499Params.Put(securityType));
				default:
					throw new ArgumentOutOfRangeException("securityType");
			}
		}
Exemple #4
0
        public override void ExecuteCmdlet()
        {
            if (this.VM.SecurityProfile == null)
            {
                this.VM.SecurityProfile = new SecurityProfile();
            }

            this.VM.SecurityProfile.SecurityType = SecurityType;

            WriteObject(this.VM);
        }
Exemple #5
0
        private void Run()
        {
            if (this.IsParameterBound(c => c.SecurityType))
            {
                // Security Profile
                if (this.VirtualMachineScaleSet.VirtualMachineProfile.SecurityProfile == null)
                {
                    this.VirtualMachineScaleSet.VirtualMachineProfile.SecurityProfile = new SecurityProfile();
                }
                this.VirtualMachineScaleSet.VirtualMachineProfile.SecurityProfile.SecurityType = SecurityType;
            }

            WriteObject(this.VirtualMachineScaleSet);
        }
Exemple #6
0
		public static string GetSecurityClass(this IDictionary<string, RefPair<SecurityTypes, string>> securityClassInfo, SecurityTypes? secType, string boardName)
		{
			if (secType == null)
				return null;

			if (boardName == ExchangeBoard.Forts.Code)
				return secType == SecurityTypes.Stock ? "RTS_STANDARD" : "FORTS";

			var kv = securityClassInfo.FirstOrDefault(kv2 => kv2.Value.First == secType && kv2.Value.Second == boardName);

			if (!kv.IsDefault())
				return kv.Key;

			return null;
		}
Exemple #7
0
        //设置证券类型
        private void SetSymbolType()
        {
            string symbolString = this.ToString();

            this.StockType = StockTypes.unknow;

            if (Regex.IsMatch(symbolString, @"(SH.000\d{3})|(SZ.399\d{3})") == true)
            {
                this.SecurityType = SecurityTypes.Index;
            }
            else if (Regex.IsMatch(symbolString, @"(SH.60[0-8]\d{3})|(SZ.00[01256789]\d{3})") == true)
            {
                this.SecurityType = SecurityTypes.Stock;
                this.StockType    = StockTypes.A;
            }
            else if (Regex.IsMatch(symbolString, @"(SH.90\d{4})|(SZ.20\d{4})") == true)
            {
                this.SecurityType = SecurityTypes.Stock;
                this.StockType    = StockTypes.B;
            }
            else if (Regex.IsMatch(symbolString, @"(SZ.300\d{3})") == true)
            {
                this.SecurityType = SecurityTypes.Stock;
                this.StockType    = StockTypes.Board2;
            }
            else if (Regex.IsMatch(symbolString, @"(SZ.4[023]\d{4})") == true)
            {
                this.SecurityType = SecurityTypes.Stock;
                this.StockType    = StockTypes.Board3;
            }
            else if (Regex.IsMatch(symbolString, @"(SH.[012]\d{5})|(SZ.1[0123]\d{4})") == true)
            {
                this.SecurityType = SecurityTypes.Bond;
            }
            else if (Regex.IsMatch(symbolString, @"(SH.5[01]\d{4})|(SZ.184\d{3})|(SZ.1[56]\d{4})") == true)
            {
                this.SecurityType = SecurityTypes.Fund;
            }
            else if (Regex.IsMatch(symbolString, @"(SH.58\d{4})|(SZ.03\d{4})") == true)
            {
                this.SecurityType = SecurityTypes.Warrants;
            }
            else
            {
                this.SecurityType = SecurityTypes.Other;
            }
        }
        public Security CreateSecurity(string secStr)
        {
            Security security;

            int    strLn    = secStr.IndexOfAny("@".ToCharArray());
            string secBorad = secStr.Substring(strLn + 1);

            ExchangeBoard eb = new ExchangeBoard();
            SecurityTypes st = new SecurityTypes();

            switch (secBorad)
            {
            case "FORTS":
                eb = ExchangeBoard.Forts;
                st = SecurityTypes.Future;
                break;

            case "EQBR":
                eb = ExchangeBoard.MicexEqbr;
                st = SecurityTypes.Stock;
                break;

            default:
                eb = ExchangeBoard.Micex;
                st = SecurityTypes.Future;
                break;
            }

            string secCode = secStr.Substring(0, strLn);

            security = new Security()
            {
                Id    = secStr,
                Code  = secCode,
                Board = eb,
                Type  = st
            };

            return(security);
        }
Exemple #9
0
        /// <summary>
        /// Determines whether the specified criterias are considered equal.
        /// </summary>
        /// <param name="other">Another search criteria with which to compare.</param>
        /// <returns><see langword="true" />, if criterias are equal, otherwise, <see langword="false" />.</returns>
        public bool Equals(SecurityLookupMessage other)
        {
            if (SecurityId.Equals(other.SecurityId))
            {
                return(true);
            }

            if (Name == other.Name &&
                ShortName == other.ShortName &&
                Currency == other.Currency &&
                ExpiryDate == other.ExpiryDate &&
                OptionType == other.OptionType &&
                ((SecurityTypes == null && other.SecurityTypes == null) ||
                 (SecurityTypes != null && other.SecurityTypes != null && SecurityTypes.SequenceEqual(other.SecurityTypes))) &&
                SettlementDate == other.SettlementDate &&
                Strike == other.Strike &&
                UnderlyingSecurityCode == other.UnderlyingSecurityCode && CFICode == other.CFICode)
            {
                return(true);
            }

            return(false);
        }
Exemple #10
0
 public static List <Security> GetSecuritiesWithPositions(this IConnector connector, SecurityTypes securitiesType)
 {
     return(GetSecuritiesWithPositions(connector).Where(s => s.Type == securitiesType).ToList());
 }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="securities"></param>
        /// <param name="code"></param>
        /// <param name="type"></param>
        /// <param name="board"></param>
        /// <param name="secMsg"></param>
        /// <param name="onlyLocal"></param>
        public static void TryFindLocal(this IDictionary <Tuple <string, SecurityTypes>, SecurityMessage> securities, string code, SecurityTypes type, string board, SecurityMessage secMsg, bool onlyLocal = false)
        {
            if (_ignoreCodes.Contains(code))
            {
                return;
            }

            var secProvider = ServicesRegistry.TrySecurityProvider;

            if (secProvider != null)
            {
                var found = (board.IsEmpty() ? null : new[] { secProvider.LookupById(new SecurityId {
                        SecurityCode = code, BoardCode = board
                    }) }.Where(f1 => f1 != null)) ??
                            secProvider.LookupByCode(code, type).Where(s => s.ToSecurityId().SecurityCode.CompareIgnoreCase(code)) ??
                            secProvider.Lookup(new SecurityLookupMessage {
                    ShortName = code, SecurityType = type
                }) ??
                            secProvider.Lookup(new SecurityLookupMessage {
                    Name = code, SecurityType = type
                });

                if (type == SecurityTypes.Stock)
                {
                    found = found.OrderBy(f2 =>
                    {
                        var id = f2.Id.ToSecurityId();

                        if (id.BoardCode.EndsWithIgnoreCase("EMU"))
                        {
                            return(100);
                        }

                        if (id.BoardCode.StartsWithIgnoreCase("TQ"))
                        {
                            return(0);
                        }

                        return(50);
                    });
                }

                var f = found.FirstOrDefault();
                if (f != null)
                {
                    f.ToMessage().CopyTo(secMsg);
                    return;
                }
            }

            if (!onlyLocal)
            {
                securities.TryAdd(Tuple.Create(code.ToUpperInvariant(), type), secMsg);
            }
        }
Exemple #12
0
		/// <summary>
		/// Load settings.
		/// </summary>
		/// <param name="storage">Storage.</param>
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			SecurityType = storage.GetValue<SecurityTypes>("SecurityType");
		}
Exemple #13
0
		public void CancelOrders(bool? isStopOrder, string portfolioName, Sides? side, SecurityId securityId, SecurityTypes? securityType)
		{
			_adapter.AddDebugLog("CancelOrders: stop={0}, portf={1}, side={2}, id={3}", isStopOrder, portfolioName, side, securityId);

			var isBuySell = (side == null) ? null : side.Value.ToAlfaDirect();
			var account = portfolioName.IsEmpty() ? null : portfolioName.AccountFromPortfolioName();
			var pCode = securityId.SecurityCode.IsEmpty() ? null : securityId.SecurityCode;

			var treaties = new List<string>();
			var treaty = account.IsEmpty() ? null : account.TreatyFromAccount();

			if (!treaty.IsEmpty())
				treaties.Add(treaty);
			else
			{
				var data = _tableAccounts.GetLocalDbData();
				treaties.AddRange(data.Select(row => FieldsAccounts.Treaty.GetStrValue(row.ToColumns())));
			}

			if (!treaties.Any())
				throw new InvalidOperationException(LocalizedStrings.Str2277Params.Put(portfolioName));

			string placeCode = null;
			if (!securityId.IsDefault())
			{
				placeCode = _adapter.SecurityClassInfo.GetSecurityClass(securityType, securityId.BoardCode);

				if (placeCode == null)
					throw new InvalidOperationException(LocalizedStrings.Str2278);
			}

			foreach (var t in treaties)
				_ad.DropOrder(null, isBuySell, t, account, placeCode, pCode, -1);
		}
Exemple #14
0
 public void WriteSecurityType(SecurityTypes securityType)
 {
     writer.Write((byte)securityType);
     writer.Flush();
 }
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            SecurityType = storage.GetValue <SecurityTypes>(nameof(SecurityType));
        }
Exemple #16
0
 private void CheckBoxOnChecked(object sender, RoutedEventArgs e)
 {
     OkBtn.IsEnabled = SecurityTypes.Any();
 }