Exemplo n.º 1
0
		/// <summary>
		///   取得基礎周期定義結構值
		/// </summary>
		/// <param name="value">當前週期定義結構</param>
		/// <returns>返回值: 基礎周期定義結構</returns>
		public static Resolution GetBaseValue(Resolution value) {
			if (value.TotalSeconds < MAX_BASE_TOTALSECONDS) {
				return new Resolution(EResolution.Minute, 1);
			} else {
				return new Resolution(EResolution.Day, 1);
			}
		}
Exemplo n.º 2
0
		/// <summary>
		///   建構子
		/// </summary>
		/// <param name="request">InstrumentDataRequest類別</param>
		public InstrumentSettings(ref InstrumentDataRequest request) {
			AbstractExchange cExchange = ProductManager.Manager.GetExchange(request.Exchange);

			__sSymbolId = request.Symbol;
			__sExchange = request.Exchange;
			__sDataSource = request.DataFeed;
			
			__dTimeZone = cExchange.TimeZone;
			__cProduct = cExchange.GetProduct(__sSymbolId);
			__cProperty = cExchange.GetProperty(__sSymbolId, __sDataSource);

			if (__cProperty != null) {
				__cOptionType = __cProperty.GetCallOrPut(__cProduct);     //取得選擇權 Call or Put 類型
				__dStrikePrice = __cProperty.GetStrikePrice(__cProduct);  //取得選擇權履約價格
				
				//取得合約到期日索引值
				IContractTime cContractTime = __cProperty.ContractRule as IContractTime;
				if (cContractTime != null) {
					__iContractIndex = cContractTime.GetContractIndex(__sSymbolId);
				}
			}

			this.Create(ref request);
			__cResolution = request.Resolution;
		}