Exemplo n.º 1
0
        private void CalculateAxisUnit()
        {
            double dValue = 0;

            if (__cSetting.AxisScope == EAxisScope.PriceScaleScope)
            {
                double[] dScales = __cPriceScale.GetPriceScale(__dAxisMax);
                dValue = dScales[0] * dScales[1];
            }
            else
            {
                EAxisScaleMode cScaleMode = __cSetting.ScaleMode;
                switch (cScaleMode)
                {
                case EAxisScaleMode.ScaleGap:
                    dValue = __cSetting.ScaleValue;
                    break;
                }
            }

            __dScaleUnit = (__dAxisMax - __dAxisMin) / __iScaleCount;
            if (dValue > 0)
            {
                __dScaleUnit = Math.Ceiling(__dScaleUnit / dValue) * dValue;
            }
        }
Exemplo n.º 2
0
        internal _QuoteInfo(string exchangeName, string dataSource, string symbolId, string symbolName, double price)
        {
            this.SymbolId   = symbolId;
            this.SymbolName = symbolName;
            this.DataSource = dataSource;

            AbstractExchange        cExchange = ProductManager.Manager.GetExchange(exchangeName);
            AbstractProductProperty cProperty = cExchange.GetProperty(symbolId, dataSource);

            IPriceScale cPriceScale = null;

            if (cProperty != null)
            {
                cPriceScale = cProperty.PriceScaleRule as IPriceScale;
            }

            double[] dScales = new double[] { 1, 1 };
            if (cPriceScale != null)
            {
                dScales = cPriceScale.GetPriceScale(price);
            }

            string sScale = dScales[0].ToString();
            int    iIndex = sScale.IndexOf('.');

            if (iIndex > -1)
            {
                __iDecimals = sScale.Length - iIndex - 1;
            }
        }
Exemplo n.º 3
0
		/// <summary>
		///   從目標價格資訊設定價格座標
		/// </summary>
		/// <param name="price">目標價格</param>
		public void SetPriceScaleFromClosePrice(double price) {
			double[] dValues = new double[] { 1, 1 };
			IPriceScale cPriceScale = __cProperty.PriceScaleRule as IPriceScale;
			if (cPriceScale != null) {
				dValues = cPriceScale.GetPriceScale(price);
			}
			
			__dPriceScale = dValues[0];  //價格座標
			__dMinValue = dValues[1];    //最小跳動單位
		}