本文整理汇总了C#中Trade.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Trade.GetProperty方法的具体用法?C# Trade.GetProperty怎么用?C# Trade.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trade
的用法示例。
在下文中一共展示了Trade.GetProperty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClearingID
protected string GetClearingID(Trade trade, string name)
{
// find which allocation number we are
var allocNo = GetAllocationNo(trade);
// there are number of entries for each allocation, need to find the one with clearing ID
int entryNo = 1;
bool found = true;
do
{
var eventProperty = String.Format("{0}:{1}:{2}", sConfirmRegReportingEvent, allocNo, entryNo);
var typeProperty = String.Format("{0}:{1}:{2}", sConfirmRegReportingType, allocNo, entryNo);
if(!trade.Properties.ContainsKey(eventProperty) || !trade.Properties.ContainsKey(typeProperty))
{
found = false;
}
else
{
var eventValue = trade.GetProperty(eventProperty);
var typeValue = trade.GetProperty(typeProperty);
if(eventValue == "2" && typeValue == "0")
{
// this is it, Event = Clearing, Type = Current
var propertyToRetrieve = String.Format("{0}:{1}:{2}", name, allocNo, entryNo);
return trade.GetProperty(propertyToRetrieve);
}
}
entryNo++;
} while (found);
return String.Empty;
}
示例2: GetGeneratorName
internal static string GetGeneratorName(Trade trade)
{
var gname = trade.GetProperty(TradeImportHelper.GeneratorProp);
if (!string.IsNullOrEmpty(gname)) return gname;
var template = trade.GetProperty(TradeImportHelper.TemplateProp);
if (template != null)
{
var prod = trade.Product;
string aliasSource = null;
if (prod is MTMCurrencySwap || prod is CurrencySwap)
aliasSource = SwapInfo.AliasSourceCcy;
else if (prod is FRA)
aliasSource = SwapInfo.AliasSourceFra;
else if (prod is Swap)
aliasSource = SwapInfo.AliasSourceIrs;
else if (prod is Swaption)
aliasSource = SwaptionInfo.AliasSourceSwpt;
if (aliasSource != null)
{
//if (aliasSource.Equals(SwapInfo.AliasSourceIrs) || aliasSource.Equals(SwaptionInfo.AliasSourceSwpt))
{
// use ot template -> generator mapping
var alias =
new Alias
{
AliasType = "Template",
EntityId = 0,
Source = aliasSource,
SourceReference = template
};
alias = Env.Current.StaticData.GetAlias(alias);
if (alias != null)
{
trade.SetProperty("Generator", alias.Name);
return alias.Name;
}
}
/*
else
{
// use generator <- ot template mapping
var aliases = Env.Current.StaticData.GetAliasesByName(new Alias
{
AliasType = "Template",
EntityId = 0,
Source = aliasSource,
Name = template
});
if (aliases != null && aliases.Count > 0)
{
var alias = aliases[0];
trade.SetProperty("Generator", alias.SourceReference);
return alias.SourceReference;
}
}*/
}
}
return null;
}
示例3: SetMatchingFlag
protected void SetMatchingFlag(Trade otTrade, Trade externalTrade)
{
otTrade.SetProperty(ImportRef, externalTrade.GetProperty("ImportRef"));
otTrade.SetProperty(Reconciled, "true");
externalTrade.SetProperty(Reconciled, "true");
}
示例4: Reconcile
public bool Reconcile(Trade otTrade, Trade externalTrade, Market market, bool fullMatch, DateTime reconcileDate,
IList<Exception> exceps)
{
string unmatchReason = string.Empty;
var s = otTrade.GetProperty(ImportRef);
var s2 = externalTrade.GetProperty(ImportRef);
if (s != null && s2 != null)
{
if (s.Equals(s2)) return true;
}
s = otTrade.GetProperty(Reconciled);
if (s != null && s.ToLowerInvariant().Equals("true")) return false;
s2 = externalTrade.GetProperty(Reconciled);
if (s2 != null && s2.ToLowerInvariant().Equals("true")) return false;
if (externalTrade.BookId != otTrade.BookId) return false;
/*
if (externalTrade.BookId != 0)
{
if (otTrade.BookId != externalTrade.BookId)
{
if (fullMatch) return false;
else
{
var book1 = Env.Current.StaticData.GetPartyById(otTrade.BookId);
var book2 = Env.Current.StaticData.GetPartyById(externalTrade.BookId);
if (book1 != null && book2 != null)
{
var port1 = book1.GetProperty(TradeImportHelper.BookProp2);
var port2 = book2.GetProperty(TradeImportHelper.BookProp2);
if (port1 != null && port2 != null && !port1.Equals(port2))
{
return false;
}
}
unmatchReason += "Book ";
}
}
}
else
{
return false;
}*/
#region symmetryProduct
var ifsproduct = externalTrade.Product as SymmetryProduct;
if (ifsproduct != null)
{
if (ifsproduct.SecurityType.ToLowerInvariant() == "currency swaps")
{
if (otTrade.Product is MTMCurrencySwap)
{
//Check Generator
var generator = GetGeneratorName(otTrade);
if (generator == null) return false;
if (!ifsproduct.Security.StartsWith(generator)) return false;
if (!ifsproduct.Generator.Equals(generator.Trim())) return false;
if (otTrade.Product.ContractMaturity != ifsproduct.ContractMaturity)
{
var sd = otTrade.Product.ContractMaturity;
var sw = otTrade.Product as MTMCurrencySwap;
var paymentP = CalendarHelper.Get(sw.PayLeg.PaymentMarketPlaces);
if (!sd.IsBusinessDay(paymentP))
{
sd = sd.NextBusinessDay(paymentP);
if (sd != ifsproduct.ContractMaturity) return false;
}
else return false;
}
if (externalTrade.Product.Currency == "USD")
{
//The Nominal may be in the other currency
var swap = otTrade.Product as MTMCurrencySwap;
if (swap.PayLeg.NotionalCurrency == "USD")
{
if (Math.Abs(externalTrade.Quantity - swap.ReceiveLeg.Notional) < Utilities.Epsilon)
{
if (fullMatch)
SetMatchingFlag(otTrade, externalTrade);
return true;
}
unmatchReason += "RecLegNotional ";
}
else
{
if (Math.Abs(externalTrade.Quantity - swap.PayLeg.Notional) < Utilities.Epsilon)
{
if (fullMatch)
SetMatchingFlag(otTrade, externalTrade);
return true;
}
unmatchReason += "PayLegNotional ";
}
}
if (externalTrade.Product.Currency == otTrade.SettleCurrency)
{
//.........这里部分代码省略.........
示例5: GetAggregateKey
protected string GetAggregateKey(Trade tr)
{
if (tr.Product is FX)
{
var fx = tr.Product as FX;
return fx.Primary + "_" + fx.Quoting + "_" + fx.PrimarySettleDate + "_" + tr.BookId;
}
if (tr.Product.IsMultiplyTraded)
{
return "PR" + tr.Product.Id + "_" + tr.BookId;
}
if (tr.Product is FXOption)
{
string desc = tr.GetProperty(DPEDescription);
if (desc == null)
{
var otcOption = tr.Product as FXOption;
desc = tr.Product.Description;
if (otcOption.ExerciseType == OptionExerciseType.DualDigital)
{
var optInfo = (DualDigitalInfo)otcOption.OptionInfo;
desc = desc + "." + optInfo.SecondStrike + "." + optInfo.SecondUnderlierId;
}
if (otcOption.ExerciseType == OptionExerciseType.Barrier)
{
var optInfo = (BarrierInfo)otcOption.OptionInfo;
desc = desc + "." + optInfo.BarrierStrike + "." + optInfo.LowerBarrierStrike;
}
}
return desc + "_" + tr.BookId;
}
if (tr.Product is Swap)
{
var generator = GetGeneratorName(tr);
if (generator == null) return "TR" + tr.Id;
var swap = tr.Product as Swap;
bool haveStart = false; // ((swap.StartDate - tr.TradingDay) > 5 || (swap.StartDate < tr.TradingDay)) && !(tr.Product is CurrencySwap);
return generator + "_" + "SWAP" + "_" + (haveStart ? swap.StartDate + "_" : string.Empty) + swap.EndDate + "_" + tr.BookId;
}
if (tr.Product is Swaption)
{
var generator = GetGeneratorName(tr);
if (generator == null) return "TR" + tr.Id;
var swaption = tr.Product as Swaption;
return generator + "_" + swaption.OptionType + "_" + swaption.OptionStrike + /*"_" + swaption.Swap.StartDate +*/ "_" + swaption.Swap.EndDate + "_" + tr.BookId;
}
if (tr.Product is FRA)
{
var generator = GetGeneratorName(tr);
if (generator == null) return "TR" + tr.Id;
var swaption = tr.Product as FRA;
return generator + "_" + "FRA" + "_" + /*swaption.StartDate + "_" +*/ tr.SettlementDate + "_" + tr.BookId;
}
if (tr.Product is VolSwap)
{
return tr.Product.Description + "_" + tr.Product.ContractMaturity + "_" + tr.BookId;
}
return "TR" + tr.Id;
}
示例6: GetRegulatoryID
protected string GetRegulatoryID(Trade trade, string name)
{
// find which allocation number we are
var allocNo = GetAllocationNo(trade);
// some properties have extra :1 at the end. some don't
var propertyToRetrieve = String.Format("{0}:{1}:1", name, allocNo);
if(!trade.Properties.ContainsKey(propertyToRetrieve)) // try blank
{
propertyToRetrieve = String.Format("{0}:{1}", name, allocNo);
}
return trade.GetProperty(propertyToRetrieve);
}
示例7: ToStringOptional
protected override string ToStringOptional(ProductEvent pevent, Trade trade, Market market)
{
var sb = new StringBuilder();
// ClearingHouse Clearinghouse code will be provided
var ccp = GetCcp(trade);
if (ccp != null)
sb.Append(ccp);
sb.Append(Separator);
string isSef = string.Empty;
try
{
isSef = GetRegulatoryID(trade, sIsSEFProperty);
}
catch(Exception)
{
// trade doesn't have regulatory ID - ignore and treat as normal IRS
}
if (string.Equals(isSef, "Y", StringComparison.InvariantCultureIgnoreCase))
{
// SefFlag
sb.Append("1").Append(Separator);
// SefTransID SEF Transaction ID required fields when the trade is executed on a SEF platform
if (!Utilities.IsNullOrEmpty(trade.PartyReference))
{
int allocNo = GetAllocationNo(trade);
var sefTransactionId = String.Format("{0}.{1}", trade.PartyReference, allocNo);
sb.Append(sefTransactionId);
}
sb.Append(Separator);
// SefName required fields when the trade is executed on a SEF platform
var tradeSefName = trade.GetProperty("SEFName");
/*var sefNameAlias = Env.Current.StaticData.GetAlias(new Alias
{
EntityId = 0,
AliasType = "SEFName",
Source = trade.TradingSystem,
SourceReference = tradeSefName
});
if (sefNameAlias == null)
{
throw new Exception(String.Format("Unable to find MLP's SEFName alias for SEFName = {0} on trade {1}", tradeSefName, trade.Id));
}
var sefName = sefNameAlias.Name;*/
sb.Append(tradeSefName); // the importer picks up the alias now
sb.Append(Separator);
// USI required fields when the trade is executed on a SEF platform
var sefSource = GetRegulatoryID(trade, sSEFSourceProperty);
var sefId = GetRegulatoryID(trade, sSEFIdProperty);
if (string.IsNullOrWhiteSpace(sefSource) || string.IsNullOrWhiteSpace(sefId))
{
throw new Exception(String.Format("Unable to find {0} or {1} on trade {2} to construct USI.", sSEFSourceProperty, sSEFIdProperty, trade.Id));
}
var regulatoryTradeId = sefSource + sefId;
sb.Append(regulatoryTradeId);
sb.Append(Separator);
// FCM required fields when the trade is executed on a SEF platform
var sefFCM = GetRegulatoryID(trade, sSEFClearerProperty);
if (string.IsNullOrWhiteSpace(sefFCM))
{
throw new Exception(String.Format("Unable to find SEFFCM property on trade {0}.", trade.Id));
}
else
{
sb.Append(sefFCM);
}
sb.Append(Separator);
string insertReason = "23 - Affirmation no send";
sb.Append(insertReason).Append(Separator);
}
else
{
// non-SEF
sb.Append(Separator);
sb.Append(Separator);
sb.Append(Separator);
sb.Append(Separator);
sb.Append(Separator);
sb.Append(Separator);
}
return sb.ToString();
}
示例8: Reconcile
public override bool Reconcile(Trade otTrade, Trade externalTrade, Market market, bool fullMatch, DateTime reconciliationDate, IList<Exception> exceps)
{
var ref1 = otTrade.GetProperty(ReconcileTaskExecutor.Reconciled);
if (ref1 != null && ref1.ToLowerInvariant().Equals("true")) return false;
var ref2 = externalTrade.GetProperty(ReconcileTaskExecutor.Reconciled);
if (ref2 != null && ref2.ToLowerInvariant().Equals("true")) return false;
if (!(otTrade.Product.GetType() == externalTrade.Product.GetType())) return false;
if (otTrade.PrimeBrokerId != externalTrade.PrimeBrokerId &&
otTrade.ClearerId != externalTrade.ClearerId) return false;
if (externalTrade.BookId != otTrade.BookId) return false;
if (externalTrade.PartyId != otTrade.PartyId) return false;
if (Math.Abs(otTrade.Price - externalTrade.Price) > Utilities.Epsilon) return false;
var fut1 = otTrade.Product as Future;
var fut2 = externalTrade.Product as Future;
if (fut1 != null && fut2 != null)
{
var ticker1 = fut1.Ticker;
var ticker2 = fut2.Ticker;
if (!string.IsNullOrEmpty(ticker1) && !string.IsNullOrEmpty(ticker2))
{
if (!ticker1.Equals(ticker2)) return false;
}
}
if ((otTrade.Quantity > 0 && externalTrade.Quantity < 0) ||
(otTrade.Quantity < 0 && externalTrade.Quantity > 0)) return false;
var tradedate1 = new SimpleDate(otTrade.TradeTime);
var tradedate2 = new SimpleDate(externalTrade.TradeTime);
if (tradedate1 != tradedate2 && otTrade.TradingDay != tradedate2) return false;
if (fullMatch)
{
if (Math.Abs(otTrade.Quantity - externalTrade.Quantity) > Utilities.Epsilon) return false;
if (!CompareFees(otTrade, externalTrade)) return false;
}
otTrade.SetProperty(ReconcileTaskExecutor.Reconciled, "true");
externalTrade.SetProperty(ReconcileTaskExecutor.Reconciled, "true");
return true;
}
示例9: Reconcile
public override bool Reconcile(Trade otTrade, Trade externalTrade, Market market, bool fullMatch, DateTime reconciliationDate, IList<Exception> exceps)
{
var unmatchReason = string.Empty;
var ref1 = otTrade.GetProperty(ReconcileTaskExecutor.Reconciled);
if (ref1 != null && ref1.ToLowerInvariant().Equals("true")) return false;
var ref2 = externalTrade.GetProperty(ReconcileTaskExecutor.Reconciled);
if (ref2 != null && ref2.ToLowerInvariant().Equals("true")) return false;
if (!(otTrade.Product.GetType() == externalTrade.Product.GetType())) return false;
if (otTrade.BookId != externalTrade.BookId) return false;
if (otTrade.PrimeBrokerId != externalTrade.PrimeBrokerId &&
otTrade.ClearerId != externalTrade.ClearerId)
{
if (fullMatch) return false;
unmatchReason += "Account ";
}
var prod1 = otTrade.Product;
var prod2 = externalTrade.Product;
var fut1 = prod1 as Future;
var fut2 = prod2 as Future;
if (fut1 != null && fut2 != null)
{
var ticker1 = fut1.Ticker;
var ticker2 = fut2.Ticker;
if (!string.IsNullOrEmpty(ticker1) && !string.IsNullOrEmpty(ticker2))
{
if (!ticker1.Equals(ticker2)) return false;
}
}
var fx1 = prod1 as FX;
var fx2 = prod2 as FX;
if (fx1 != null && fx2 != null)
{
if (!fx1.CurrencyPair.Equals(fx2.CurrencyPair)) return false;
if (fullMatch)
{
if (Math.Abs(fx1.PrimaryAmount - fx2.PrimaryAmount) > Utilities.Epsilon) return false;
if (Math.Abs(fx1.QuotingAmount - fx2.QuotingAmount) > Utilities.Epsilon) return false;
}
return true;
}
if (prod1 is Bond || prod1 is Equity)
{
if (prod1.Id != prod2.Id) return false;
}
if (fullMatch)
{
if (Math.Abs(otTrade.Quantity - externalTrade.Quantity) > Utilities.Epsilon) return false;
}
return true;
}
示例10: WriteTrade
internal static String WriteTrade(Trade trade, SimpleDate date, DateTime effectiveTime, char separator)
{
var sb = new StringBuilder();
var swap = trade.Product as Swap;
var future = trade.Product as Future;
var bond = trade.Product as Bond;
var otcOption = trade.Product as OtcOption;
var iOption = trade.Product as IOption;
var ndf = trade.Product as NDF;
var repo = trade.Product as Repo;
sb.Append(trade.Status).Append(separator);
var bookParty = Env.Current.StaticData.GetPartyById(trade.BookId);
var p = bookParty.RoleList.Contains("Book") ? bookParty.GetProperty("Portfolio") : String.Empty;
var s = bookParty.RoleList.Contains("Book") ? bookParty.GetProperty("Strategy") : String.Empty;
sb.Append(p).Append(separator).Append(s).Append(separator);
sb.Append(trade.Id).Append(separator);
sb.Append(trade.BuySell).Append(separator);
sb.Append(iOption == null ? null : (OptionType?)iOption.OptionType).Append(separator);
sb.Append(SymTradeHelper.GetPayerReceiver(trade)).Append(separator);
sb.Append(trade.Product.Typology(OrchestradeCommon.Products.ProductTypology.Pricing)).Append(separator); //product type
sb.Append(trade.Product.Typology(OrchestradeCommon.Products.ProductTypology.Processing)).Append(separator); //processing type
sb.Append(trade.GetProperty("TemplateName")).Append(separator);
sb.Append(SymTradeHelper.GetNominal(trade)).Append(separator);
sb.Append(trade.Status != null && trade.Status.Equals("Terminated") ? 0.0 : SymTradeHelper.GetCurrentNominal(trade, date, effectiveTime)).Append(separator);
sb.Append(SymTradeHelper.GetPrimaryAmount(trade)).Append(separator);
sb.Append(SymTradeHelper.GetQuotingAmount(trade)).Append(separator);
sb.Append(swap == null ? null : (double?)swap.PayLeg.CurrentLegNominal).Append(separator);
sb.Append(swap == null ? null : (double?)swap.ReceiveLeg.CurrentLegNominal).Append(separator);
sb.Append(trade.Product.Currency).Append(separator);
sb.Append(trade.Product.GetProperty("DefaultTicker")).Append(separator);
sb.Append(trade.Product.Cusip).Append(separator);
sb.Append(trade.Product.Description).Append(separator);
sb.Append(swap == null ? null : swap.PayLeg).Append(separator);
sb.Append(swap == null ? null : (double?)swap.PayLeg.Spread).Append(separator);
sb.Append(swap == null ? null : "\"" + swap.PayLeg.PayReceiveDescription + "\"").Append(separator);
sb.Append(swap == null ? null : swap.PayLeg.RateIndexTenor).Append(separator);
sb.Append(swap == null ? null : (Daycount?)swap.PayLeg.Daycount).Append(separator);
sb.Append(swap == null ? null : (StubType?)swap.PayLeg.StubType).Append(separator);
sb.Append(swap == null ? null : (SimpleDate?)swap.PayLeg.StubDate).Append(separator);
sb.Append(swap == null ? null : swap.PayLeg.StubIndexTenor).Append(separator);
sb.Append(swap == null ? null : swap.PayLeg.StubInterpTenor).Append(separator);
sb.Append(swap == null ? null : swap.ReceiveLeg).Append(separator);
sb.Append(swap == null ? null : (double?)swap.ReceiveLeg.Spread).Append(separator);
sb.Append(swap == null ? null : "\"" + swap.ReceiveLeg.PayReceiveDescription + "\"").Append(separator);
sb.Append(swap == null ? null : swap.ReceiveLeg.RateIndexTenor).Append(separator);
sb.Append(swap == null ? null : (Daycount?)swap.ReceiveLeg.Daycount).Append(separator);
sb.Append(swap == null ? null : (StubType?)swap.ReceiveLeg.StubType).Append(separator);
sb.Append(swap == null ? null : (SimpleDate?)swap.ReceiveLeg.StubDate).Append(separator);
sb.Append(swap == null ? null : swap.ReceiveLeg.StubIndexTenor).Append(separator);
sb.Append(swap == null ? null : swap.ReceiveLeg.StubInterpTenor).Append(separator);
sb.Append(iOption == null ? null : (double?)iOption.OptionStrike).Append(separator);
sb.Append(trade.Product.UnderlierInfo).Append(separator);
sb.Append(trade.Price).Append(separator);
sb.Append(trade.Product.FixedRate).Append(separator);
sb.Append(String.Format("{0:dd/MM/yyyy}",new SimpleDate(trade.TradeTime).ToDateTime())).Append(separator);
sb.Append(String.Format("{0:dd/MM/yyyy}", trade.SettlementDate.ToDateTime())).Append(separator);
sb.Append(String.Format("{0:dd/MM/yyyy}",trade.Product.ContractMaturity.ToDateTime())).Append(separator);
sb.Append(iOption == null ? null : (int?)iOption.OptionExerciseTime).Append(separator);
sb.Append(iOption == null ? null : iOption.OptionExerciseTimeZone).Append(separator);
sb.Append(otcOption == null ? null : otcOption.SettlementMarketPlaces).Append(separator);
sb.Append(ndf == null ? null : (SimpleDate?)ndf.FXFixingDate).Append(separator);
sb.Append(repo == null || repo.Collaterals[0] == null ? null : (double?)repo.Collaterals[0].HairCut).Append(separator);
sb.Append(iOption == null ? null : (OptionExerciseType?)iOption.ExerciseType).Append(separator);
sb.Append(otcOption == null ? null : (ExerciseSettlement?)otcOption.ExerciseSettlement).Append(separator);
sb.Append(SymTradeHelper.GetSettlementAmount(trade)).Append(separator);
sb.Append(Env.Current.StaticData.GetPartyById(trade.InitialPartyId)).Append(separator);
sb.Append(Env.Current.StaticData.GetPartyById(trade.PartyId)).Append(separator);
sb.Append(Env.Current.StaticData.GetPartyById(trade.PrimeBrokerId)).Append(separator);
sb.Append(Env.Current.StaticData.GetPartyById(trade.ClearerId)).Append(separator);
sb.Append(Env.Current.StaticData.GetPartyById(trade.StepOutPartyId)).Append(separator);
sb.Append(Env.Current.StaticData.GetPartyById(trade.CcpId)).Append(separator);
var upfrontFee = trade.Fees == null ? null :
trade.Fees.Where(f => f.FeeType.Equals(FeeType.Upfront)).OrderBy(f => f.Date).FirstOrDefault();
sb.Append(upfrontFee == null ? null : ((Double?)upfrontFee.Amount * (upfrontFee.PayReceive == PayReceive.Pay ? -1 : 1))).Append(separator);
sb.Append(otcOption == null ? null : (double?)otcOption.InitialPremiumAmount).Append(separator);
sb.Append(otcOption == null ? null : (SimpleDate?)otcOption.InitialPremiumDate).Append(separator);
sb.Append(otcOption == null ? null : otcOption.InitialPremiumCurrency).Append(separator);
sb.Append(otcOption == null ? null : (PayReceive?)otcOption.InitialPremiumPayReceive);
return sb.ToString();
}
示例11: Reconcile
public override bool Reconcile(Trade otTrade, Trade externalTrade, Market market, bool fullMatch, DateTime reconciliationDate, IList<Exception> exceps)
{
var date = new SimpleDate(reconciliationDate);
var time = reconciliationDate;
if (externalTrade.Status.Equals(MurexInfo.StateDead)) return false;
string unmatchReason = string.Empty;
bool sameRef = false;
var otTid = otTrade.GetProperty(TradeImportHelper.MurexTradeId);
var extTid = externalTrade.GetProperty(TradeImportHelper.MurexTradeId);
externalTrade.SetProperty(ReconcileTaskExecutor.ImportRef, extTid);
if (otTid != null && extTid != null)
{
if (!otTid.Equals(extTid, StringComparison.Ordinal)) return false;
else sameRef = !fullMatch; // if not in fullMatch mode, turn on sameRef flag
}
if (otTrade.BookId != externalTrade.BookId)
{
if (fullMatch) return false;
else
{
var book1 = Env.Current.StaticData.GetPartyById(otTrade.BookId);
var book2 = Env.Current.StaticData.GetPartyById(externalTrade.BookId);
if (book1 != null && book2 != null)
{
var port1 = book1.GetProperty(TradeImportHelper.BookProp2);
var port2 = book2.GetProperty(TradeImportHelper.BookProp2);
if (port1 != null && port2 != null && !port1.Equals(port2))
{
return false;
}
}
unmatchReason += "Book ";
}
}
if (externalTrade.Product is MurexProduct)
{
var murex = externalTrade.Product as MurexProduct;
var ot = otTrade.Product;
var generator = SymmetryPositionReconciler.GetGeneratorName(otTrade);
if (!CompareParties(otTrade, externalTrade, fullMatch, ref unmatchReason) && fullMatch) return false;
if (!ot.ProcessingType.Equals(murex.ProductProcessingType))
{
if ((ot.ProcessingType.Equals("Swap") && murex.ProductProcessingType.Equals("NDS")) ||
(ot.ProcessingType.Equals("NDS") && murex.ProductProcessingType.Equals("Swap")))
{
if (fullMatch) return false;
else unmatchReason += "Swap/NDS ";
}
else return false;
}
if (otTrade.TradingDay != externalTrade.TradingDay)
{
if (!sameRef) return false;
else unmatchReason += "TradeDate ";
}
if (generator == null || murex.Generator == null || !generator.Equals(murex.Generator))
{
if (!sameRef) return false;
else if (!unmatchReason.Contains("Swap/NDS")) unmatchReason += "Template ";
}
#region swap
if (ot is Swap)
{
// can be irs, currency swap or mtm currency swap
var swap = ot as Swap;
var payLeg = swap.PayLeg;
var recLeg = swap.ReceiveLeg;
Leg leg1, leg2; // 1 and 2 in import file
if ((payLeg.IsFixedRate && !recLeg.IsFixedRate) ||
(!payLeg.IsFixedRate && recLeg.IsFixedRate))
{
// fixed-float: leg1 is fixed, leg2 is float
if (payLeg.IsFixedRate)
{
if (!externalTrade.BuySell.Equals(BuySell.Sell.ToString()))
{
if (!sameRef) return false;
else unmatchReason += "Direction ";
}
leg1 = payLeg;
leg2 = recLeg;
}
else
{
if (externalTrade.BuySell.Equals(BuySell.Sell.ToString()))
{
if (!sameRef) return false;
else unmatchReason += "Direction ";
}
leg1 = recLeg;
leg2 = payLeg;
}
if (!CompareLegs(leg1, leg2, murex, false, fullMatch, sameRef, ref unmatchReason, reconciliationDate) && fullMatch) return false;
}
else if (!payLeg.IsFixedRate && !recLeg.IsFixedRate)
{
//.........这里部分代码省略.........
示例12: GetAccount
protected string GetAccount(Trade tr)
{
var accountpb = tr.GetProperty(MurexInfo.AccountProp);
if (accountpb != null)
{
return accountpb;
}
var partyId = tr.PrimeBrokerId > 0 ? tr.PrimeBrokerId : tr.ClearerId;
if (partyId > 0)
{
var account = Alias.PartyToAlias(0, "Murex", partyId);
return account;
}
return null;
}