private void GenerateReport() { Report = new List <ResultRow>(); foreach (KeyValuePair <string, Warrant> warrantPair in WarrantsTable.Warrants) { Warrant warrant_ = warrantPair.Value; // ResultRow row = new ResultRow(); } }
public float GetLeverage() { decimal warrantCost = Warrant.WarrantCost(Quote, ConvertibleRatio); decimal stockCost = Decimal.MaxValue; if (isCallnPut) { stockCost = UnderlyingQuote * Convert.ToDecimal(Stock.kShortRate + Stock.kTradeTax + Stock.kHandleFee + Stock.kShortFee); } else { stockCost = Stock.GetStockCost(UnderlyingQuote); } return((float)(stockCost / warrantCost)); }
private int UpdateExpiredDateByMarket(List <PI30002> lst) { Console.WriteLine("All Warrant TSC/OTC Size: " + lst.Count); foreach (PI30002 warrantSource in lst) { Warrant warrantTarget = new Warrant(warrantSource.WarrantID, warrantSource.WarrantAbbr); warrantTarget.TargetStockID = warrantSource.TargetStockNo; warrantTarget.TargetStockName = warrantSource.TargetStockNm; warrantTarget.UsageRatio = Convert.ToUInt32(warrantSource.UsageRatio * 100); warrantTarget.StrikePrice = Convert.ToUInt32(warrantSource.StrikePrice * 100); if (!warrantSource.ExpiredDate.Equals("") && !warrantTarget.TargetStockID.Equals("")) { warrantTarget.ExpiredDays = DateTime.ParseExact(warrantSource.ExpiredDate, "yyyymmdd", null).Date.Subtract(DateTime.Now.Date).Days; Warrants.Add(warrantTarget.ID, warrantTarget); } WarrantsAll.Add(warrantTarget.ID, warrantTarget); } Console.WriteLine("Warrant Size: " + Warrants.Count); return(0); }
public UInt64 GetPercentGainCost(int percent2Gain) { decimal warrantValue = Decimal.MinValue; if (isCallnPut) { // [ 股票賣價(Revenue) - 執行賣價(Cost) ](單股獲利) warrantValue = Convert.ToDecimal(UnderlyingQuote) * (1 - Convert.ToDecimal(Stock.kTradeTax)) - Convert.ToDecimal(StrikePrice) * Convert.ToDecimal((1 + Stock.kHandleFee)); } else { // [ 執行賣價(Revenue) - 股票賣價(Cost) ](單股獲利) warrantValue = Convert.ToDecimal(StrikePrice) * (1 - Convert.ToDecimal(Stock.kTradeTax + Stock.kHandleFee)) - Convert.ToDecimal(UnderlyingQuote); } if (warrantValue <= 0) { return(0); } // [ 權證價值(Cost) x 執行比例 x 預期報酬價(1 - %) ](單股獲利) return(Warrant.ValidFloor(Convert.ToUInt64(warrantValue / Convert.ToDecimal(1 + Warrant.kHandleFee) * ConvertibleRatio / Stock.kLotSize * (1M - Convert.ToDecimal(percent2Gain) / 100M)))); }