internal virtual int GetRowCount()
        {
            int rowCount = 0;

            switch (TimeView)
            {
            case TimePeriodType.Monthly:
                // row denotes day in month
                rowCount = TimePeriodStart.ToLastDayOfMonth().Day;
                break;

            case TimePeriodType.DailyHourly:
                // row denotes hour of day
                rowCount = 24;
                break;

            case TimePeriodType.DailyHalfHourly:
                // row denotes 30'th minute of day
                rowCount = 24 * 2;
                break;

            case TimePeriodType.DailyQuaterHourly:
                // row denotes 15'th minute of
                rowCount = 24 * 4;
                break;

            default:
                throw new SoftwareException("Internal error. Unsupported time period type {0}", TimeView);
            }

            return(rowCount);
        }
        internal int StartTimeToRow(DateTime time)
        {
            int row = -1;

            switch (TimeView)
            {
            case TimePeriodType.Monthly:
                // row denotes day in month
                row = (int)Math.Floor(time.Subtract(TimePeriodStart.ToFirstDayOfMonth().ToMidnight()).TotalDays);
                break;

            case TimePeriodType.DailyHourly:
                // row denotes hour of day
                row = (int)Math.Ceiling(time.Subtract(TimePeriodStart.ToMidnight()).TotalHours);
                break;

            case TimePeriodType.DailyHalfHourly:
                // row denotes 30'th minute of day
                row = (int)Math.Ceiling(time.Subtract(TimePeriodStart.ToMidnight()).TotalHours * 2.0f);
                break;

            case TimePeriodType.DailyQuaterHourly:
                // row denotes 15'th minute of
                row = (int)Math.Ceiling(time.Subtract(TimePeriodStart.ToMidnight()).TotalHours * 4.0f);
                break;

            default:
                throw new SoftwareException("Internal error. Unsupported time period type {0}", TimeView);
            }
            return(row);
        }
        internal DateTime RowToStartTime(int row)
        {
            DateTime time;

            switch (TimeView)
            {
            case TimePeriodType.Monthly:
                // row denotes day in month
                time = TimePeriodStart.ToFirstDayOfMonth().ToMidnight().AddDays(row);
                break;

            case TimePeriodType.DailyHourly:
                // row denotes hour of day
                time = TimePeriodStart.ToMidnight().AddHours(row);
                break;

            case TimePeriodType.DailyHalfHourly:
                // row denotes 30'th minute of day
                time = TimePeriodStart.ToMidnight().AddMinutes(row * 30.0);
                break;

            case TimePeriodType.DailyQuaterHourly:
                // row denotes 15'th minute of
                time = TimePeriodStart.ToMidnight().AddMinutes(row * 15.0);
                break;

            default:
                throw new SoftwareException("Internal error. Unsupported time period type {0}", TimeView);
            }
            return(time);
        }
Exemple #4
0
        protected virtual void SetVisibleColumns()
        {
            try {
                _blockLookup.Clear();

                //// filter out unnecessary appointment columns and blocks
                DateTime startTime;
                DateTime endTime;
                switch (TimeView)
                {
                case TimePeriodType.Monthly:
                    startTime = TimePeriodStart.ToBeginningOfMonth();
                    endTime   = TimePeriodStart.ToEndOfMonth();
                    break;

                case TimePeriodType.DailyHourly:
                case TimePeriodType.DailyHalfHourly:
                case TimePeriodType.DailyQuaterHourly:
                default:
                    startTime = TimePeriodStart.ToMidnight();
                    endTime   = TimePeriodStart.To1159PM();
                    break;
                }


                switch (ColumnFilter)
                {
                case AppointmentBookViewModelFilter.All:
                    _visibleColumns = _allColumns;
                    break;

                case AppointmentBookViewModelFilter.ExcludeEmptyColumns:
                    _visibleColumns = (
                        from appointment in _allColumns
                        where appointment.Appointments.Any(block => block.VisibleStartTime <endTime && block.VisibleEndTime> startTime)
                        select appointment
                        ).ToArray();
                    break;

                case AppointmentBookViewModelFilter.ShowOnlyEmptyColumns:
                    _visibleColumns = (
                        from appointment in _allColumns
                        where !appointment.Appointments.Any(block => block.VisibleStartTime <= endTime && block.VisibleEndTime >= startTime)
                        select appointment
                        ).ToArray();;
                    break;
                }

                RecreateCellDisplays();
            } catch (Exception error) {
                SystemLog.Exception(error);
                ExceptionDialog.Show(error);
            }
        }
Exemple #5
0
 public bool Equals(Ohlcv other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(ExchangeId, other.ExchangeId) && string.Equals(TradeType, other.TradeType) &&
            string.Equals(BaseAsset, other.BaseAsset) && string.Equals(QuoteAsset, other.QuoteAsset) &&
            TimePeriodStart.Equals(other.TimePeriodStart) && TimePeriodEnd.Equals(other.TimePeriodEnd) &&
            TimeOpen.Equals(other.TimeOpen) && TimeClose.Equals(other.TimeClose) && PriceOpen.Equals(other.PriceOpen) &&
            PriceClose.Equals(other.PriceClose) && PriceLow.Equals(other.PriceLow) && PriceHigh.Equals(other.PriceHigh) &&
            VolumeTraded.Equals(other.VolumeTraded) && TradesCount.Equals(other.TradesCount) && string.Equals(Id, other.Id));
 }
Exemple #6
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = ExchangeId != null?ExchangeId.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (TradeType != null ? TradeType.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (BaseAsset != null ? BaseAsset.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (QuoteAsset != null ? QuoteAsset.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ TimePeriodStart.GetHashCode();
                hashCode = (hashCode * 397) ^ TimePeriodEnd.GetHashCode();
                hashCode = (hashCode * 397) ^ TimeOpen.GetHashCode();
                hashCode = (hashCode * 397) ^ TimeClose.GetHashCode();
                hashCode = (hashCode * 397) ^ PriceOpen.GetHashCode();
                hashCode = (hashCode * 397) ^ PriceClose.GetHashCode();
                hashCode = (hashCode * 397) ^ PriceLow.GetHashCode();
                hashCode = (hashCode * 397) ^ PriceHigh.GetHashCode();
                hashCode = (hashCode * 397) ^ VolumeTraded.GetHashCode();
                hashCode = (hashCode * 397) ^ TradesCount.GetHashCode();
                hashCode = (hashCode * 397) ^ (Id != null ? Id.GetHashCode() : 0);
                return(hashCode);
            }
        }