public DeskViewModel(Entities.Instrument Call, Entities.Instrument Put, double strike, DateTime MatDate) { this._Put = Put; this._Call = Call; this._Strike = strike; this._MaturityDate = MatDate; this._IsViewed = false; }
public void PublishReview(Entities.Review pReview) { if(sSubscriptions.ContainsKey(pReview.UPC)) { foreach(String lSubscriberAddress in sSubscriptions[pReview.UPC]) { IReviewSubscriber lSubscriber = ServiceFactory.GetService<IReviewSubscriber>(lSubscriberAddress); lSubscriber.ReceiveReview(pReview); } } }
public static Entities.HangHoa[] CheckGoiHang(Entities.HangHoa[] hh1, Entities.GoiHang[] goihang, Entities.ChiTietGoiHang[] chitietgoihang) { try { ArrayList array = new ArrayList(); foreach (Entities.GoiHang item in goihang) { int sotang = 0; foreach (Entities.ChiTietGoiHang item1 in chitietgoihang) { if (item.MaGoiHang == item1.MaGoiHang) { sotang++; foreach (Entities.HangHoa item2 in hh1) { if (item1.MaHangHoa == item2.MaHangHoa) { sotang--; break; } } if (sotang != 0) break; } } if (sotang == 0) { Entities.HangHoa hh = new Entities.HangHoa(); hh.MaHangHoa = item.MaGoiHang; hh.TenHangHoa = item.TenGoiHang; hh.MaNhomHangHoa = item.MaNhomHang; hh.TenNhomHangHoa = item.TenNhomHang; hh.MaThueGiaTriGiaTang = ""; hh.GiaBanBuon = item.GiaBanBuon; hh.GiaBanLe = item.GiaBanLe; hh.GiaNhap = item.GiaNhap; array.Add(hh); } } return (Entities.HangHoa[])array.ToArray(typeof(Entities.HangHoa)); } catch { return new Entities.HangHoa[0]; } }
public static double CalculateDelta(Entities.OptionType type, double settleprice, double strike, double volatility, int daystomate, double risk_free) { double pdaystomate = (double)daystomate / YearLength; double d1=(Math.Log(settleprice/strike)+volatility*volatility*0.5*pdaystomate)/(volatility*Math.Sqrt(pdaystomate)); if (type == Entities.OptionType.Call) { return Math.Exp((-1 * risk_free * pdaystomate) * NormalDistribution(d1)); } else if (type == Entities.OptionType.Put) { return -1.0 * Math.Exp(-1.0 * risk_free * pdaystomate) * NormalDistribution(-1.0 * d1); } else { return 0; } }
public static double CalculateThetha(Entities.OptionType type, double settleprice, double strike, double volatility, int daystomate, double risk_free) { double pdaystomate = (double)daystomate / YearLength; double d1 = (Math.Log(settleprice / strike) + volatility * volatility * 0.5 * pdaystomate) / (volatility * Math.Sqrt(pdaystomate)); double temp = settleprice * Math.Exp(-1 * risk_free * pdaystomate); double d2 = d1 - volatility * Math.Sqrt(pdaystomate); if (type == Entities.OptionType.Call) { return (-1 * (temp * NormalDistributionDensity(d1) * volatility) / (2 * Math.Sqrt(pdaystomate)) + risk_free * temp * NormalDistribution(d1) - risk_free * strike * temp * NormalDistribution(d2)) / Quant.YearLength; } else if (type == Entities.OptionType.Put) { return (-1 * (temp * NormalDistributionDensity(d1) * volatility) / (2 * Math.Sqrt(pdaystomate)) - risk_free * temp * NormalDistribution(-1 * d1) + risk_free * strike * temp * NormalDistribution(-1 * d2)) / Quant.YearLength; } else { return 0; } }
public static double CalculateVega(Entities.OptionType type, double settleprice, double strike, double volatility, int daystomate, double risk_free) { double pdaystomate = (double)daystomate / YearLength; double d1 = (Math.Log(settleprice / strike) + volatility * volatility * 0.5 * pdaystomate) / (volatility * Math.Sqrt(pdaystomate)); return settleprice*NormalDistributionDensity(d1)*Math.Exp(-1*risk_free*pdaystomate)*Math.Sqrt(pdaystomate)/100; }
public void UpdateUrl(Entities.UrlInfo objUrl) { dataProvider.UpdateUrl(objUrl.Id, objUrl.PortalId, objUrl.ForumId, objUrl.TopicId, objUrl.Url, objUrl.LastModifiedOnDate); //Caching.ClearUrlCache(id, portalId); }
public int AddUrl(Entities.UrlInfo objUrl) { return dataProvider.AddUrl(objUrl.PortalId, objUrl.ForumId, objUrl.TopicId, objUrl.Url, objUrl.CreatedOnDate); }
public static bool CheckHangHoaOrGoiHang(string MaHangHoa, Entities.GoiHang[] GoiHang, Entities.ChiTietGoiHang[] ChiTietGoiHang) { //True: Gói hàng | False: Hàng hóa bool kq = false; //Mặc định là hàng hóa if (GoiHang.Equals(null) || ChiTietGoiHang.Equals(null)) { return kq; } if (GoiHang.Length == 0 || ChiTietGoiHang.Length == 0) { return kq; } foreach (Entities.GoiHang item in GoiHang) { foreach (Entities.ChiTietGoiHang item1 in ChiTietGoiHang) { if (item1.MaGoiHang.Equals(item.MaGoiHang) && item1.Equals(MaHangHoa)) { kq = true; return true; } } } return kq; }
public void CreateFileServerConfig(Entities.ServerConfig config) { try { string Links = System.Windows.Forms.Application.StartupPath.ToString() + new Common.Constants.Sql().ServerConfig; if (CheckFile(Links) == true) { DeleteFile(Links); } XmlTextWriter txtwrite = new XmlTextWriter(Links, null); txtwrite.WriteStartDocument(); txtwrite.WriteStartElement(constants.Config); txtwrite.WriteElementString(constants.Server, MaHoa(constants.KeywordServerConfig, config.Server)); txtwrite.WriteElementString(constants.IP, MaHoa(constants.KeywordServerConfig, config.Ip)); txtwrite.WriteElementString(constants.Port, MaHoa(constants.KeywordServerConfig, config.Port)); txtwrite.WriteEndElement(); txtwrite.WriteEndDocument(); txtwrite.Close(); } catch (Exception ex) { string s = ex.Message.ToString(); } }