예제 #1
0
        private void Init()
        {
            int date = (int)(this.DateTime / 1000000L);

            if (this.Cache[date].HasPrice(this.DateTime))
            {
                Exac = this.Cache[date].GetPrice(this.DateTime);
            }
            else
            {
                int bkDate = date;

                // Prev
                {
                    if (this.Cache[date].HasPrevPrice(this.DateTime))
                    {
                        Prev = this.Cache[date].GetPrevPrice(this.DateTime);
                    }
                    else
                    {
                        for (int c = 0; c < EMPTY_DAY_MAX; c++)
                        {
                            date = DateToDay.toDate(DateToDay.toDay(date) - 1);

                            if (this.Cache[date].IsEmpty() == false)
                            {
                                Prev = this.Cache[date].GetLastPrice();
                                break;
                            }
                        }
                    }
                }

                date = bkDate;

                // Next
                {
                    if (this.Cache[date].HasNextPrice(this.DateTime))
                    {
                        Next = this.Cache[date].GetNextPrice(this.DateTime);
                    }
                    else
                    {
                        for (int c = 0; c < EMPTY_DAY_MAX; c++)
                        {
                            date = DateToDay.toDate(DateToDay.toDay(date) + 1);

                            if (this.Cache[date].IsEmpty() == false)
                            {
                                Next = this.Cache[date].GetFirstPrice();
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        public void FxCollected()
        {
            long dateTime = DateTimeToSec.Now.getDateTime();
            int  date     = (int)(dateTime / 1000000L);
            int  time     = (int)(dateTime % 1000000L);

            TryReload(date);

            if (time < 500)                                         // ? 日付更新から 5 min 未満 -> 昨日もリロードしておく
            {
                date = DateToDay.toDate(DateToDay.toDay(date) - 1); // 昨日
                TryReload(date);
            }
        }