public static void calculateNPV(Double rate, Trade trade)
        {
            double        disc = 1.0 / (1.0 + (double)(rate / 100));
            CacheFlowData cf   = trade.cacheFlowData;
            double        NPV  = (cf.cacheFlowYear0 +
                                  disc * (cf.cacheFlowYear1 +
                                          disc * (cf.cacheFlowYear2 +
                                                  disc * (cf.cacheFlowYear3 +
                                                          disc * (cf.cacheFlowYear4 +
                                                                  disc * cf.cacheFlowYear5)))));

            trade.NPV = NPV;
        }
        public static Trade generateTrade(int id)
        {
            Trade trade = new Trade();

            trade.id = id;
            CacheFlowData cf = new CacheFlowData();

            cf.cacheFlowYear0   = trunc(random.NextDouble() * -10000);
            cf.cacheFlowYear1   = trunc(random.NextDouble() * 10000);
            cf.cacheFlowYear2   = trunc(random.NextDouble() * 10000);
            cf.cacheFlowYear3   = trunc(random.NextDouble() * 10000);
            cf.cacheFlowYear4   = trunc(random.NextDouble() * 10000);
            cf.cacheFlowYear5   = trunc(random.NextDouble() * 10000);
            trade.cacheFlowData = cf;
            trade.NPV           = 0.0;
            return(trade);
        }