예제 #1
0
        void fillBonusChart()
        {
            List <BonusRange> bonusRangeList = new List <BonusRange>();

            for (int i = -10; i < 10; i++)
            {
                bonusRangeList.Add(new BonusRange(i, i + 1));
            }
            List <SelectItem> selItems = re_.runMode_ == RunMode.RM_Asset ? re_.buyItems_ : re_.selItems_;

            foreach (var item in selItems)
            {
                var bonus = item.getColumnVal("bonus");
                if (bonus != "")
                {
                    float bonusValue = Utils.GetBonusValue(bonus);
                    int   iIndex     = (int)Math.Floor(bonusValue) + 10;
                    if (iIndex < 0)
                    {
                        iIndex = 0;
                    }
                    else if (iIndex >= bonusRangeList.Count)
                    {
                        iIndex = bonusRangeList.Count - 1;
                    }
                    bonusRangeList[iIndex].nTradeCount_ += 1;
                }
                var nsh = item.getColumnVal("nsh");
                if (nsh != "")
                {
                    float nshValue = Utils.GetBonusValue(nsh);
                    int   iIndex   = (int)Math.Floor(nshValue) + 10;
                    if (iIndex < 0)
                    {
                        iIndex = 0;
                    }
                    else if (iIndex >= bonusRangeList.Count)
                    {
                        iIndex = bonusRangeList.Count - 1;
                    }
                    bonusRangeList[iIndex].nHfCount_ += 1;
                }
                var nsc = item.getColumnVal("nsc");
                if (nsc != "")
                {
                    float nscValue = Utils.GetBonusValue(nsc);
                    int   iIndex   = (int)Math.Floor(nscValue) + 10;
                    if (iIndex < 0)
                    {
                        iIndex = 0;
                    }
                    else if (iIndex >= bonusRangeList.Count)
                    {
                        iIndex = bonusRangeList.Count - 1;
                    }
                    bonusRangeList[iIndex].nCfCount_ += 1;
                }
            }
            SUtils.FillBonusChart(chart_, bonusRangeList);
        }
예제 #2
0
        public void fillHistoryDataChart()
        {
            if (re_.selItems_.Count == 0)
            {
                return;
            }
            ChartXUnit xUnit;

            selItemsHistoryDataToChart(chart_, re_.selItems_, re_.dateRangeList_, re_.runMode_, out xUnit);
            chart_.Titles[0].Text = chart_.Titles[0].Text + ", " + SUtils.ToUnitName(xUnit) + ", " + re_.getTradeDayCount() + "days";
        }
예제 #3
0
        void fillRateItemChart()
        {
            if (re_.runMode_ != RunMode.RM_Raw)
            {
                return;
            }
            List <HistoryData> dataList;
            List <String>      rateItemList;

            if (App.asset_.collectRateItemHistory(re_, out strategyRateItemHistoryData_, out dataList, out rateItemList))
            {
                SUtils.FillHistoryDataToChart(chart_, dataList, rateItemList);
            }
        }
예제 #4
0
        public void selItemsHistoryDataToChart(Chart chart, List <SelectItem> selItems, List <DateRange> dateRangeList, RunMode runMode, out ChartXUnit xUnit)
        {
            List <HistoryData>    dataList = new List <HistoryData>();
            List <DateSelectItem> items    = RegressResult.ToDaySelectItemList(selItems, dateRangeList);

            xUnit = SUtils.DetermineXUnit(items.Count);
            if (items.Count == 0)
            {
                return;
            }
            if (xUnit == ChartXUnit.CXU_Year)
            {
                items.Reverse();
                int startDate        = items[0].date_;
                int endDate          = items[items.Count - 1].date_;
                int startYear        = Utils.Year(startDate);
                int endYear          = Utils.Year(endDate);
                int iSearchStartHint = 0;
                for (int iYear = startYear; iYear <= endYear; iYear++)
                {
                    int iStartIndex = -1;
                    int nDaySpan    = 0;
                    for (int i = iSearchStartHint; i < items.Count; i++)
                    {
                        if (iStartIndex == -1 && Utils.Year(items[i].date_) == iYear)
                        {
                            iStartIndex = i;
                        }
                        if (iStartIndex != -1)
                        {
                            if (Utils.Year(items[i].date_) == iYear)
                            {
                                nDaySpan++;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    iSearchStartHint = iStartIndex + nDaySpan;
                    HistoryData data = StrategyAsset.GetHistoryData(items, iStartIndex, nDaySpan, runMode);
                    dataList.Add(data);
                }
            }
            else
            {
                int nDaySpan    = SUtils.ToDayCount(xUnit);
                int iStartIndex = 0;
                do
                {
                    if (iStartIndex + nDaySpan - 1 > items.Count)
                    {
                        break;
                    }
                    HistoryData data = StrategyAsset.GetHistoryData(items, iStartIndex, nDaySpan, runMode);
                    dataList.Add(data);
                    iStartIndex += nDaySpan;
                } while (iStartIndex < items.Count);
                dataList.Reverse();
            }

            List <String> xDescList = new List <string>();

            foreach (var item in dataList)
            {
                xDescList.Add(SUtils.ToXDesc(xUnit, item.startDate_, item.endDate_));
            }
            SUtils.FillHistoryDataToChart(chart, dataList, xDescList);
            re_.reHistory_ = StrategyAsset.GetHistoryData(items, 0, items.Count, re_.runMode_);
        }