Exemplo n.º 1
0
        private static Asset CreateEmptyAsset()
        {
            var asset = new Asset
            {
                DividendsFactor    = new DividendsFactor(),
                TickFormulaDetails = new TickFormula
                {
                    TickFormulaParameters = new TickFormulaParameters()
                },
                Underlying = new Underlying
                {
                    MarketDetails = new Market
                    {
                        Calendar        = new Calendar(),
                        MarketHours     = new MarketHours(),
                        DividendsFactor = new DividendsFactor(),
                    },
                    InterestRates           = new List <InterestRate>(),
                    DividendsFactor         = new DividendsFactor(),
                    AvailableClientProfiles = new List <ClientProfile>()
                },
            };

            return(asset);
        }
Exemplo n.º 2
0
 public static void SetAssetFieldsFromProduct(this Asset asset, Product product)
 {
     asset.AssetId           = product.ProductId;
     asset.UnderlyingMdsCode = product.UnderlyingMdsCode;
     asset.ForceId           = product.ForceId;
     asset.Name                         = product.Name;
     asset.ShortPosition                = product.ShortPosition;
     asset.Comments                     = product.Comments;
     asset.MarketMakerAssetAccountId    = product.MarketMakerAssetAccountId;
     asset.IsinLong                     = product.IsinLong;
     asset.IsinShort                    = product.IsinShort;
     asset.Issuer                       = product.Issuer;
     asset.MaxPositionSize              = product.MaxPositionSize;
     asset.SettlementCurrency           = product.SettlementCurrency;
     asset.MaxOrderSize                 = product.MaxOrderSize;
     asset.NewsId                       = product.NewsId;
     asset.ContractSize                 = product.ContractSize;
     asset.MinOrderDistancePercent      = product.MinOrderDistancePercent;
     asset.MinOrderEntryInterval        = product.MinOrderEntryInterval;
     asset.MinOrderSize                 = product.MinOrderSize;
     asset.Parity                       = product.Parity;
     asset.PublicationRic               = product.PublicationRic;
     asset.Tags                         = product.Tags;
     asset.TickFormulaName              = product.TickFormula;
     asset.Parity                       = product.Parity;
     asset.OvernightMarginMultiplier    = product.OvernightMarginMultiplier;
     asset.Underlying.AssetType         = product.AssetType;
     asset.Underlying.Keywords          = product.Keywords;
     asset.LiquidationThresholdQuantity = 0;
     asset.Underlying.RicCode           = product.PublicationRic;
     asset.Underlying.HedgeCost         = product.HedgeCost;
 }
Exemplo n.º 3
0
 public static void SetAssetFieldsFromTickFormula(this Asset asset, ITickFormula tickFormula)
 {
     asset.TickFormulaName         = tickFormula.Id;
     asset.TickFormulaDetails.Name = tickFormula.Id;
     asset.TickFormulaDetails.TickFormulaParameters.Ladders = tickFormula.PdlLadders;
     asset.TickFormulaDetails.TickFormulaParameters.Values  = tickFormula.PdlTicks;
 }
Exemplo n.º 4
0
 public static void SetAssetFieldsFromBaseCurrency(this Asset asset,
                                                   Currency baseCurrency,
                                                   IList <string> assetTypesWithZeroInterestRate)
 {
     asset.SetAssetFieldsFromCurrency(baseCurrency,
                                      assetTypesWithZeroInterestRate,
                                      x => asset.Underlying.VariableInterestRate1 = x);
 }
Exemplo n.º 5
0
        public static void SetAssetFieldsFromMarketSettings(this Asset asset, MarketSettings marketSettings)
        {
            var marketScheduleUtcRespectful = marketSettings.MarketSchedule.ShiftToUtc();

            asset.Underlying.MarketDetails.Calendar.Holidays = marketSettings.Holidays;
            asset.Underlying.MarketDetails.MarketHours.Open  = marketScheduleUtcRespectful.Open;
            asset.Underlying.MarketDetails.MarketHours.Close = marketScheduleUtcRespectful.Close;
            asset.Underlying.MarketDetails.Name     = marketSettings.Name;
            asset.Underlying.MarketDetails.MarketId = marketSettings.Id;
            asset.SetHalfWorkingDays(marketSettings);
        }
Exemplo n.º 6
0
        private async Task PublishAssetUpsertedEvent(Asset asset, string oldMdsCodeIfUpdated = null)
        {
            var evt = new AssetUpsertedEvent
            {
                Asset         = asset,
                EventMetadata = new EventMetadata(
                    eventId: Guid.NewGuid().ToString(),
                    eventCreationDate: DateTime.UtcNow),
                PropertiesPriorValueIfUpdated = new AssetUpdatedProperties
                {
                    UnderlyingMdsCode = oldMdsCodeIfUpdated
                }
            };
            await _assetUpsertedPublisher.ProduceAsync(evt);

            _log.WriteInfo(nameof(LegacyAssetsCacheUpdater), evt, "Published asset upserted event");
        }
Exemplo n.º 7
0
        public static void SetDividendFactorFields(this Asset asset, MarketSettings marketSettings,
                                                   BrokerSettingsContract brokerSettings, Product product)
        {
            var dividendShort = product.DividendsShort ?? marketSettings.DividendsShort ?? brokerSettings.DividendsShortPercent;
            var dividendLong  = product.DividendsLong ?? marketSettings.DividendsLong ?? brokerSettings.DividendsLongPercent;
            var dividend871M  = product.Dividends871M ?? marketSettings.Dividends871M ?? brokerSettings.Dividends871MPercent;

            asset.DividendsFactor.Percent      = dividendLong;
            asset.DividendsFactor.ShortPercent = dividendShort;
            asset.DividendsFactor.Us871Percent = dividend871M;
            asset.Underlying.MarketDetails.DividendsFactor.Percent      = dividendLong;
            asset.Underlying.MarketDetails.DividendsFactor.ShortPercent = dividendShort;
            asset.Underlying.MarketDetails.DividendsFactor.Us871Percent = dividend871M;
            asset.Underlying.DividendsFactor.Percent      = dividendLong;
            asset.Underlying.DividendsFactor.ShortPercent = dividendShort;
            asset.Underlying.DividendsFactor.Us871Percent = dividend871M;
        }
Exemplo n.º 8
0
        private static void SetAssetFieldsFromCurrency(this Asset asset,
                                                       Currency currency,
                                                       IList <string> assetTypesWithZeroInterestRate,
                                                       Action <string> assignInterestRate)
        {
            if (assetTypesWithZeroInterestRate.Contains(asset.Underlying.AssetType) || currency == null)
            {
                assignInterestRate(string.Empty);
                return;
            }

            assignInterestRate(currency.InterestRateMdsCode);
            asset.Underlying.InterestRates.Add(new InterestRate
            {
                MdsCode  = currency.InterestRateMdsCode,
                Currency = currency.Id,
                Name     = currency.InterestRateMdsCode,
            });
        }
Exemplo n.º 9
0
 public static void SetAssetFieldsFromUnderlying(this Asset asset, UnderlyingsCacheModel underlying)
 {
     asset.Underlying.AlmParam             = underlying.AlmParam;
     asset.Underlying.CfiCode              = underlying.CfiCode;
     asset.Underlying.Eligible871m         = underlying.Eligible871M;
     asset.Underlying.Isin                 = underlying.Isin;
     asset.Underlying.MdsCode              = underlying.MdsCode;
     asset.Underlying.Name                 = underlying.Name;
     asset.Underlying.RepoSurchargePercent = underlying.RepoSurchargePercent;
     asset.Underlying.Spread               = underlying.Spread;
     asset.Underlying.TradingCurrency      = underlying.TradingCurrency;
     asset.Underlying.CommodityBase        = underlying.CommodityBase;
     asset.Underlying.BaseCurrency         = underlying.BaseCurrency;
     asset.Underlying.IndexName            = underlying.IndexName;
     asset.Underlying.EMIRType             = underlying.EmirType;
     asset.Underlying.CommodityDetails     = underlying.CommodityDetails;
     asset.LastTradingDate                 = underlying.LastTradingDate?.ToString(DateFormat, CultureInfo.InvariantCulture);
     asset.ExpiryDate = underlying.ExpiryDate?.ToString(DateFormat, CultureInfo.InvariantCulture);
     asset.Underlying.MaturityDate = underlying.MaturityDate?.ToString(DateFormat, CultureInfo.InvariantCulture);
 }
Exemplo n.º 10
0
 private static void SetHalfWorkingDays(this Asset asset, MarketSettings marketSettings)
 {
     asset.Underlying.MarketDetails.Calendar.HalfWorkingDays = marketSettings.MarketSchedule.HalfWorkingDays.ToList();
 }
Exemplo n.º 11
0
 public static void SetAssetFieldsFromAssetType(this Asset asset, AssetType assetType)
 {
     asset.Underlying.UnderlyingCategoryId = assetType.UnderlyingCategoryId;
 }
Exemplo n.º 12
0
 public static void SetAssetFieldsFromCategory(this Asset asset, ProductCategory category)
 {
     asset.CategoryRaw = category.Id;
 }