Ejemplo n.º 1
0
        protected void generateDateLine(List <string> tradingDays_, ISheet tab_, HSSFWorkbook wb_)
        {
            IRow row = tab_.CreateRow(currentLine++);

            ICell[] cells = new ICell[5];

            for (int i = 0; i < 5; i++)
            {
                cells[i] = row.CreateCell(i, CellType.String);
            }

            HSSFCellStyle style = CellStyle.headingStyle(wb_);

            cells[0].SetCellValue("TradingDay : ");
            cells[0].CellStyle = style;

            cells[1].SetCellValue("From ");
            cells[1].CellStyle = style;

            cells[2].SetCellValue(tradingDays_[0]);
            cells[2].CellStyle = style;

            cells[3].SetCellValue(" To ");
            cells[3].CellStyle = style;

            cells[4].SetCellValue(tradingDays_[tradingDays_.Count - 1]);
            cells[4].CellStyle = style;
        }
Ejemplo n.º 2
0
        private void addStatistics(List <ClientTradeSummary> tradeStatistics_, ISheet tab_, HSSFWorkbook wb_)
        {
            HSSFCellStyle leftColStyle = CellStyle.headingStyle(wb_);
            HSSFCellStyle contentStyle = CellStyle.contentStyle(wb_);

            foreach (ClientTradeSummary summary in tradeStatistics_)
            {
                IRow    row   = tab_.CreateRow(currentLine++);
                ICell[] cells = new ICell[columeNb];
                cells[0] = row.CreateCell(0, CellType.String);
                cells[0].SetCellValue(summary.getAccountId());
                cells[0].CellStyle = leftColStyle;

                cells[1] = row.CreateCell(1, CellType.String);
                cells[1].SetCellValue(summary.getAbbrName());
                cells[1].CellStyle = leftColStyle;

                cells[2] = row.CreateCell(2, CellType.Numeric);
                cells[2].SetCellValue((double)MathUtil.round(summary.getTotalTurnover(), 2));
                cells[2].CellStyle = leftColStyle;

                cells[3] = row.CreateCell(3, CellType.Numeric);
                cells[3].SetCellValue((double)MathUtil.round(summary.getFillRate(), 4));
                cells[3].CellStyle = leftColStyle;

                cells[4] = row.CreateCell(4, CellType.Numeric);
                cells[4].SetCellValue((double)MathUtil.round(summary.getCancelRate(), 4));
                cells[4].CellStyle = leftColStyle;

                int firstPosition = FIRST_NUMERIC_COLUME;
                int offset        = 0;
                int algoNb        = 0;

                foreach (OrderAlgo algo in sortedAlgos)
                {
                    StrategyStatistics algoStrategy = summary.getByAlgo(algo);
                    offset = columeEachAlgo * algoNb + firstPosition;

                    cells[offset + 0] = row.CreateCell(offset + 0, CellType.Numeric);
                    cells[offset + 0].SetCellValue((double)MathUtil.round(algoStrategy.getOrderCount(), 2));
                    cells[offset + 0].CellStyle = contentStyle;

                    cells[offset + 1] = row.CreateCell(offset + 1, CellType.Numeric);
                    cells[offset + 1].SetCellValue((double)MathUtil.round(algoStrategy.getSliceCount(), 2));
                    cells[offset + 1].CellStyle = contentStyle;

                    cells[offset + 2] = row.CreateCell(offset + 2, CellType.Numeric);
                    cells[offset + 2].SetCellValue((double)MathUtil.round(algoStrategy.getSlipage(), 2));
                    cells[offset + 2].CellStyle = contentStyle;

                    cells[offset + 3] = row.CreateCell(offset + 3, CellType.Numeric);
                    cells[offset + 3].SetCellValue((double)MathUtil.round(algoStrategy.getTurnover(), 2));
                    cells[offset + 3].CellStyle = contentStyle;

                    algoNb++;
                }
            }
        }
Ejemplo n.º 3
0
        protected void createSheetHeader(ISheet tb_, HSSFWorkbook wb_)
        {
            IRow row0     = tb_.CreateRow(currentLine++);
            int  columeNb = columeName.Length;

            HSSFCellStyle style = CellStyle.headingStyle(wb_);

            for (int i = 0; i < columeNb; i++)
            {
                ICell cell = row0.CreateCell(i);
                cell.CellStyle = style;
                cell.SetCellValue(columeName[i]);
            }
            row0.Height = 1000;
        }
Ejemplo n.º 4
0
        private void addColumeNameLine(ISheet tab_, HSSFWorkbook wb_)
        {
            Array algos = Enum.GetValues(typeof(OrderAlgo));
            IRow  row   = tab_.CreateRow(currentLine++);

            ICell[]       cells = new ICell[columeNb];
            HSSFCellStyle style = CellStyle.headingStyle(wb_);

            cells[0] = row.CreateCell(0, CellType.String);
            cells[0].SetCellValue(ACCOUNT_COLUME);
            cells[0].CellStyle = style;

            cells[1] = row.CreateCell(1, CellType.String);
            cells[1].SetCellValue(NAME_COLUME);
            cells[1].CellStyle = style;

            cells[2] = row.CreateCell(2, CellType.String);
            cells[2].SetCellValue(TURNOVER_COLUME);
            cells[2].CellStyle = style;

            cells[3] = row.CreateCell(3, CellType.String);
            cells[3].SetCellValue(FILLRATE_COLUME);
            cells[3].CellStyle = style;

            cells[4] = row.CreateCell(4, CellType.String);
            cells[4].SetCellValue(CANCEL_COLUME);
            cells[4].CellStyle = style;

            int index = FIRST_NUMERIC_COLUME;

            for (int i = 0; i < algos.Length; i++)
            {
                for (int j = 0; j < ALGO_RESULT_COLUMES.Length; j++)
                {
                    cells[index] = row.CreateCell(index, CellType.String);
                    cells[index].SetCellValue(ALGO_RESULT_COLUMES[j]);
                    cells[index].CellStyle = style;
                    index++;
                }
            }
        }
Ejemplo n.º 5
0
        private void addStrategyLine(ISheet tab_, HSSFWorkbook wb_)
        {
            IRow row = tab_.CreateRow(currentLine++);

            ICell[] cells = new ICell[columeNb];

            int           firstNonBlankCell = 0;
            HSSFCellStyle style             = CellStyle.headingStyle(wb_);

            int algoIndex = 0;

            for (int i = FIRST_NUMERIC_COLUME; i < columeNb; i++)
            {
                cells[i] = row.CreateCell(i, CellType.String);
                if ((i - FIRST_NUMERIC_COLUME) % columeEachAlgo == 0)
                {
                    cells[i].SetCellValue(sortedAlgos[algoIndex].ToString());
                    cells[i].CellStyle = style;
                    algoIndex++;
                    if (firstNonBlankCell == 0)
                    {
                        firstNonBlankCell = i - ALGO_RESULT_COLUMES.Length / 2;
                    }
                }
                else
                {
                    cells[i].SetCellValue("");
                    cells[i].CellStyle = style;
                }
            }

            for (int i = 0; i <= 4; i++)
            {
                cells[i]           = row.CreateCell(i, CellType.String);
                cells[i].CellStyle = style;
                cells[i].SetCellValue("");
            }

            cells[1].SetCellValue("Total");
        }