Example #1
0
        public new void createWorkSheet(Client client_)
        {
            List <SavedClientOrder> eqtTrades  = client_.getEqtTrades();
            List <SavedClientOrder> repoTrades = client_.getRepoTrades();
            List <SavedClientOrder> futTrades  = client_.getFutureTrades();
            List <SavedClientOrder> bdcTrades  = client_.getBDCTrades();

            if (eqtTrades.Count > 0)
            {
                String             tabName = "Equity_" + client_.getClientName();
                ClientTradeSummary summary = tradeTab.createTradeTab(eqtTrades, client_, wk, tabName);
                this.tradeStatistics.Add(summary);
            }
            if (repoTrades.Count > 0)
            {
                String             tabName = "Repo_" + client_.getClientName();
                ClientTradeSummary summary = tradeTab.createTradeTab(repoTrades, client_, wk, tabName);
                this.repoTradeStatistics.Add(summary);
            }
            if (futTrades.Count > 0)
            {
                String             tabName = "Future_" + client_.getClientName();
                ClientTradeSummary summary = tradeTab.createTradeTab(futTrades, client_, wk, tabName);
                this.FutureTradeStatistics.Add(summary);
            }
            if (bdcTrades.Count > 0)
            {
                String             tabName = "BDC_" + client_.getClientName();
                ClientTradeSummary summary = tradeTab.createTradeTab(bdcTrades, client_, wk, tabName);
                this.BDCTradeStatistics.Add(summary);
            }
        }
Example #2
0
        public ClientTradeSummary createTradeTab(List <SavedClientOrder> orders_, Client client_, HSSFWorkbook wb_, string tabName)
        {
            this.columeName = Colume_Headers;
            ISheet tb = wb_.CreateSheet(tabName);

            createSheetHeader(tb, wb_);
            int columeNb = this.columeName.Length;

            List <LineContent> lines        = this.buildExcelLines(orders_, client_);
            List <decimal>     slipList     = new List <decimal>();
            List <decimal>     turnoverList = new List <decimal>();

            HSSFCellStyle style = CellStyle.contentStyle(wb_);

            foreach (LineContent line in lines)
            {
                IRow    row   = tb.CreateRow(currentLine++);
                ICell[] cells = new ICell[columeNb];
                for (int j = 0; j < columeNb; j++)
                {
                    cells[j]           = row.CreateCell(j);
                    cells[j].CellStyle = style;
                }

                cells[0].SetCellValue(line.symbol);
                cells[1].SetCellValue(line.stockName);
                cells[2].SetCellValue(line.effectiveTime);
                cells[3].SetCellValue(line.expireTime);
                cells[4].SetCellValue(line.side);
                cells[5].SetCellValue(Double.Parse(MathUtil.round(line.avgPrice).ToString()));
                cells[6].SetCellValue(Double.Parse(line.volume.ToString()));
                cells[7].SetCellValue(Double.Parse(MathUtil.round(line.slipage).ToString()));

                slipList.Add(line.slipage);
                turnoverList.Add(line.turnover);
            }

            ClientTradeSummary tradeSummary = new ClientTradeSummary(client_, orders_);

            this.addFootLine(wb_, tb, turnoverList, slipList, tradeSummary.getTotalTurnover(), tradeSummary.getCancelRate(), tradeSummary.getFillRate());
            this.setAutoSizeColumn(tb, columeNb);
            currentLine = 0;
            return(tradeSummary);
        }