/// <summary> /// Initializes a new instance of the SecurityProfile class. /// </summary> /// <param name="uefiSettings">Specifies the security settings like /// secure boot and vTPM used while creating the virtual machine. /// <br><br>Minimum api-version: 2020-12-01</param> /// <param name="encryptionAtHost">This property can be used by user in /// the request to enable or disable the Host Encryption for the /// virtual machine or virtual machine scale set. This will enable the /// encryption for all the disks including Resource/Temp disk at host /// itself. <br><br> Default: The Encryption at host will /// be disabled unless this property is set to true for the /// resource.</param> /// <param name="securityType">Specifies the SecurityType of the /// virtual machine. It is set as TrustedLaunch to enable UefiSettings. /// <br><br> Default: UefiSettings will not be enabled /// unless this property is set as TrustedLaunch. Possible values /// include: 'TrustedLaunch'</param> public SecurityProfile(UefiSettings uefiSettings = default(UefiSettings), bool?encryptionAtHost = default(bool?), SecurityTypes?securityType = default(SecurityTypes?)) { UefiSettings = uefiSettings; EncryptionAtHost = encryptionAtHost; SecurityType = securityType; CustomInit(); }
/// <summary> /// Initialize <see cref="SecurityLookupMessage.SecurityTypes"/>. /// </summary> /// <param name="message">Message security lookup for specified criteria.</param> /// <param name="type">Security type.</param> /// <param name="types">Securities types.</param> public static void SetSecurityTypes(this SecurityLookupMessage message, SecurityTypes?type, IEnumerable <SecurityTypes> types = null) { if (message == null) { throw new ArgumentNullException(nameof(message)); } if (type != null) { message.SecurityType = type.Value; } else if (types != null) { var set = types.ToHashSet(); if (set.Count <= 0) { return; } if (set.Count == 1) { message.SecurityType = set.First(); } else { message.SecurityTypes = set.ToArray(); } } }
private void SecurityProviderOnSecuritiesChanged(bool exclude, NotifyCollectionChangedAction action, IEnumerable <Security> securities) { if (!CheckAccess()) { _prevFilter = null; _prevType = null; _isDirty = true; return; } switch (action) { case NotifyCollectionChangedAction.Add: { if (exclude) { FilterSecurities(); } else { FilteredSecurities.AddRange(securities.Where(CheckCondition)); } break; } case NotifyCollectionChangedAction.Remove: { if (exclude) { FilterSecurities(true); } else { FilteredSecurities.RemoveRange(securities); } break; } case NotifyCollectionChangedAction.Reset: { if (exclude) { FilterSecurities(); } else { FilteredSecurities.Clear(); } break; } default: throw new ArgumentOutOfRangeException(nameof(action)); } UpdateCounter(); }
private void SecurityTypes_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { _prevType = _selectedType; _selectedType = SecurityTypeCtrl.SelectedType; FilterSecurities(); _prevType = _selectedType; GridChanged.SafeInvoke(); }
// Преобразует данные DataRow таблицы в Security private static Security CreateSecurity(DataRow row) { var id = row.Field <string>("Id"); var board = row.Field <string>("Board"); var priceStep = row.Field <double?>("PriceStep"); var decimals = row.Field <long?>("Decimals"); var typeInt = row.Field <long?>("Type"); SecurityTypes?type = null; if (typeInt != null) { type = (SecurityTypes)typeInt; } var expDate = row.Field <string>("ExpiryDate"); var underlyingSecurityId = row.Field <string>("UnderlyingSecurityId"); var strike = row.Field <double?>("Strike"); var optTypeInt = row.Field <long?>("OptionType"); var security = new Security { Id = id, Board = ExchangeBoard.GetOrCreateBoard(board), PriceStep = (decimal?)priceStep, Decimals = (int?)decimals, Type = type }; if (security.Type == SecurityTypes.Future || security.Type == SecurityTypes.Option) { security.ExpiryDate = string.IsNullOrWhiteSpace(expDate) ? null : (DateTimeOffset?)DateTimeOffset.Parse(expDate); security.UnderlyingSecurityId = underlyingSecurityId; if (security.Type == SecurityTypes.Option) { security.Strike = (decimal?)strike; OptionTypes?optType = null; if (optTypeInt != null) { optType = (OptionTypes)optTypeInt; } security.OptionType = optType; } } return(security); }
/// <summary> /// To get securities for the instrument code. /// </summary> /// <param name="code">Instrument code.</param> /// <param name="type">Security type.</param> /// <param name="isDownload">Whether to download information from the site, if it is not found locally.</param> /// <returns>Found securities.</returns> public static IEnumerable <SecurityInfo> GetSecurities(string code, SecurityTypes?type, bool isDownload = true) { if (code.IsEmpty()) { throw new ArgumentNullException(nameof(code)); } if (_ignoreCodes.Contains(code)) { return(Enumerable.Empty <SecurityInfo>()); } var info = SecurityInfoCache.TryGetByCode(code); if (info?.Length > 0) { if (type != null) { info = info.Where(i => i.GetSecurityType() == type).ToArray(); } return(info); } var si = SecurityInfoCache.TryGetByShortName(code); if (si != null) { return(new[] { si }); } if (!isDownload) { return(Enumerable.Empty <SecurityInfo>()); } var tplus = code.EndsWithIgnoreCase(".T+"); if (tplus) { code = code.Remove(code.Length - 3); } var securities = EnsureDownload(code); return(securities); }
internal string GetSecurityClass(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); }
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(nameof(securityType)); } }
/// <summary> /// Отменить группу заявок на бирже по фильтру. /// </summary> /// <param name="transactionId">Идентификатор транзакции отмены.</param> /// <param name="isStopOrder"><see langword="true"/>, если нужно отменить только стоп-заявки, <see langword="false"/> - если только обычный и <see langword="null"/> - если оба типа.</param> /// <param name="portfolio">Портфель. Если значение равно <see langword="null"/>, то портфель не попадает в фильтр снятия заявок.</param> /// <param name="direction">Направление заявки. Если значение равно <see langword="null"/>, то направление не попадает в фильтр снятия заявок.</param> /// <param name="board">Торговая площадка. Если значение равно <see langword="null"/>, то площадка не попадает в фильтр снятия заявок.</param> /// <param name="security">Инструмент. Если значение равно <see langword="null"/>, то инструмент не попадает в фильтр снятия заявок.</param> /// <param name="securityType">Тип инструмента. Если значение равно <see langword="null"/>, то тип не попадает в фильтр снятия заявок.</param> protected override void OnCancelOrders(long transactionId, bool?isStopOrder = null, Portfolio portfolio = null, Sides?direction = null, ExchangeBoard board = null, Security security = null, SecurityTypes?securityType = null) { if (security != null && portfolio != null && security.Type == SecurityTypes.Future && !security.UnderlyingSecurityId.IsEmpty()) { base.OnCancelOrders(transactionId, isStopOrder, portfolio, direction, board, security); } else { this.CancelOrders(Orders, isStopOrder, portfolio, direction, board, null, securityType); } }
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); }
public static string ToSterling(this SecurityTypes?date) { throw new NotImplementedException(); }
internal SecurityProfile(UefiSettings uefiSettings, bool?encryptionAtHost, SecurityTypes?securityType) { UefiSettings = uefiSettings; EncryptionAtHost = encryptionAtHost; SecurityType = securityType; }
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); } }
private void SecurityProviderOnSecuritiesChanged(bool exclude, NotifyCollectionChangedAction action, IEnumerable<Security> securities) { if (!CheckAccess()) { _prevFilter = null; _prevType = null; _isDirty = true; return; } switch (action) { case NotifyCollectionChangedAction.Add: { if (exclude) FilterSecurities(); else FilteredSecurities.AddRange(securities.Where(CheckCondition)); break; } case NotifyCollectionChangedAction.Remove: { if (exclude) FilterSecurities(true); else FilteredSecurities.RemoveRange(securities); break; } case NotifyCollectionChangedAction.Reset: { if (exclude) FilterSecurities(); else FilteredSecurities.Clear(); break; } default: throw new ArgumentOutOfRangeException(nameof(action)); } UpdateCounter(); }
internal static string ToSerializedValue(this SecurityTypes?value) { return(value == null ? null : ((SecurityTypes)value).ToSerializedValue()); }