public override int GetHashCode() { int hash = 1; if (reportTime_ != null) { hash ^= ReportTime.GetHashCode(); } if (Type != global::Google.Cloud.Notebooks.V1.Event.Types.EventType.Unspecified) { hash ^= Type.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void TestComputeAmericanCallByBinomialPricer() { var n = 15; var rf = 0.02; var option = new Option { Type = OptionType.Call, Underlying = new Security { Volatility = 0.3, MarketPrice = 100, YieldRate = 0.01 }, Strike = 110, TimeToMaturity = 0.25, }; using (ReportTime.Start()) { BinomialPricer.ComputeOption(option, rf, n); } }
public void TestVarianceMatrix() { var secs = FileReaders.ReadSecurities(@"securities.csv"); var covs = FileReaders.ReadCorrelations(@"correlations.csv", secs); using (ReportTime.Start()) { Dictionary <Security, double> weights; var expectedReturn = 9d; var matrix = Portfolios.ComputeCovariances(covs); var variance = Portfolios.ComputePortfolioMinimumVariance(matrix, expectedReturn, out weights); Console.WriteLine(weights.Aggregate("Weights:" + Environment.NewLine, (str, pair) => str + (Environment.NewLine + pair.Key.Symbol + "," + pair.Value))); Console.WriteLine("ExpectedReturn: " + expectedReturn); Console.WriteLine("Variance: " + variance); Console.WriteLine("Sharpe: " + expectedReturn / Math.Sqrt(variance)); } }
public void MergeFrom(Event other) { if (other == null) { return; } if (other.reportTime_ != null) { if (reportTime_ == null) { ReportTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } ReportTime.MergeFrom(other.ReportTime); } if (other.Type != global::Google.Cloud.Notebooks.V1.Event.Types.EventType.Unspecified) { Type = other.Type; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public static void TestComputeAmericanPutByBinomialPricer() { var n = 15; var rf = 0.02; var option = new Option { Type = OptionType.Put, Underlying = new Security { Volatility = 0.3, MarketPrice = 100, YieldRate = 0.01 }, Strike = 110, TimeToMaturity = 0.25, }; using (ReportTime.Start()) { BinomialPricer.ComputeOption(option, rf, n); Assert.Greater(option.FairPrice, 2.60); Assert.Less(option.FairPrice, 2.61); } }
public static void TestComputeAmericanPutByBinomialPricer() { var n = 15; var rf = 0.02; var option = new Option { Type = OptionType.Put, Underlying = new Security { Volatility = 0.3, MarketPrice = 100, YieldRate = 0.01 }, Strike = 110, TimeToMaturity = 0.25, }; using (ReportTime.Start()) { BinomialPricer.ComputeOption(option, rf, n); Console.WriteLine(option.FairPrice >= 12.359); Console.WriteLine(option.FairPrice <= 12.360); } }
public override int GetHashCode() { int hash = 1; if (Temperature != 0) { hash ^= Temperature.GetHashCode(); } if (ReportTime != 0L) { hash ^= ReportTime.GetHashCode(); } if (Weather != 0) { hash ^= Weather.GetHashCode(); } if (ZipCode.Length != 0) { hash ^= ZipCode.GetHashCode(); } return(hash); }
public void SetReportTimeDelegate(ReportTime reportTime) { this.m_ReportTime = reportTime; this.m_ProgressHandle.SetReportTimeDelegate(reportTime); }
public void SetReportTimeDelegate(ReportTime reportTime) { this.m_ReportTime = reportTime; }