private static void Script_onScriptParameters(object sender, ScriptParametersEvent e) { List<InputAttribute> cParameters = e.ScriptParameters; foreach (InputAttribute cParameter in cParameters) { if (cParameter.Name.Equals("PipeNumber")) { cParameter.SetValue(__iPipedNumber); } } /* 設定手續費 RulePropertyAttribute cRuleProperty = e.OrderService.GetRuleItems(ERuleType.Fee)[0]; RuleBase cRule = new RuleBase(); cRule.ClassName = cRuleProperty.ClassName; List<Zeghs.Orders.ICommission> cCommissions = new List<Zeghs.Orders.ICommission>(); cCommissions.Add(e.OrderService.CreateCommission(cRule)); e.OrderService.SetCommissions(cCommissions); //*/ __cManualReset.Set(); }
internal override void CStudyInitialize() { if (__cProperty.OrderSource != null) { if (__cOrderService != null) { //如果之前已經建立下單服務元件 __cOrderService.Dispose(); //釋放下單服務元件 } string sOrderSource = __cProperty.OrderSource; __cOrderService = OrderManager.Manager.CreateOrderService(sOrderSource); __cOrderService.onResponse += OrderService_onResponse; __cOrderService.SetInstrument(this.Instruments[0]); __cOrderService.SetDefaultContracts(__cProperty.DefaultContracts); this.OrderCreator = __cOrderService as IOrderCreator; if (log.IsInfoEnabled) log.InfoFormat("[SignalObject.SetOrderSource] Set \"{0}\" and create...", sOrderSource); } List<InputAttribute> cParameters = new List<InputAttribute>(); cParameters.AddRange(InputAttribute.GetParameters(this)); if (__cOrderService != null) { cParameters.AddRange(InputAttribute.GetParameters(__cOrderService)); } ScriptParametersEvent cScriptParametersEvent = new ScriptParametersEvent(); cScriptParametersEvent.SetOrderService(__cOrderService); cScriptParametersEvent.SetScriptParameters(cParameters); OnScriptParameters(cScriptParametersEvent); if (__cOrderService != null) { __cOrderService.Initialize(); //參數設定完成之後才初始化下單元件 } }
internal void OnScriptParameters(ScriptParametersEvent e) { if (onScriptParameters != null) { onScriptParameters(this, e); } }
private void SignalObject_onScriptParameters(object sender, ScriptParametersEvent e) { List<InputAttribute> cParameters = e.ScriptParameters; int iCount = cParameters.Count; List<string> sArgs = __cProfile.Parameters; if (sArgs == null) { if (iCount > 0) { frmScriptParameters frmScriptParameters = new frmScriptParameters(); frmScriptParameters.SetParameters(cParameters); frmScriptParameters.ShowDialog(); __cProfile.Parameters = new List<string>(iCount); sArgs = __cProfile.Parameters; for (int i = 0; i < iCount; i++) { sArgs.Add(cParameters[i].Value.ToString()); } } } else { for (int i = 0; i < iCount; i++) { cParameters[i].SetValue(sArgs[i]); } } }