/// <summary> /// 初始化策略 /// </summary> private void InitStrategy() { strategyList = new List <BaseStrategy>(); string filePath = System.Windows.Forms.Application.StartupPath + @"\OptionWheeled.txt"; //if (File.Exists(filePath)) //{ // TextFile textFile = new TextFile("\t"); // textFile.OpenFile(filePath); // for (int i = 0; i < textFile.Count; i++) // { // StringAnalyse tokens = textFile.GetElementAt(i); // InitOptionStrategy(tokens.GetElementAt(0)); // } //} filePath = System.Windows.Forms.Application.StartupPath + @"\SpreadLongWheeled.txt"; if (File.Exists(filePath)) { TextFile textFile = new TextFile("\t"); textFile.OpenFile(filePath); for (int i = 0; i < textFile.Count; i++) { StringAnalyse tokens = textFile.GetElementAt(i); InitSpreadLongWheeled(tokens.GetElementAt(0)); } } }
/// <summary> /// 从文本获取合约对应的参数,并请求行情数据 /// </summary> protected override void ReqMktData() { string filePath = System.Windows.Forms.Application.StartupPath + @"\" + m_StrategyName + @"\Instrument.txt"; if (File.Exists(filePath)) { TextFile textFile = new TextFile(","); textFile.OpenFile(filePath); string[] instruments = new string[2]; StringAnalyse tokens = textFile.GetElementAt(0); instruments[0] = tokens.GetElementAt(0); tokens = textFile.GetElementAt(1); instruments[1] = tokens.GetElementAt(0); m_ContractList = new Contract[instruments.Length]; for (int i = 0; i < instruments.Length; i++) { m_ContractList[i] = GetMChHk(instruments[i]); } for (int i = 0; i < m_ContractList.Length; i++) { m_StrategyPool.ClientSocket.reqMktData(m_StartTickID + i, m_ContractList[i], "", false, new List <TagValue>()); } } }
/// <summary> /// 通过文本初始化策略参数 /// </summary> /// <returns></returns> protected override void InitStrategyParm() { string filePath = System.Windows.Forms.Application.StartupPath + @"\" + m_StrategyName + @"\Strategy.txt"; if (File.Exists(filePath)) { TextFile textFile = new TextFile("\t"); textFile.OpenFile(filePath); StringAnalyse tokens = textFile.GetElementAt(0); m_BaseMktQty = Convert.ToInt32(tokens.GetElementAt(0)); tokens = textFile.GetElementAt(1); m_WheeledThreshold = Convert.ToDouble(tokens.GetElementAt(0)); } }
/// <summary> /// 通过文本初始化策略参数 /// </summary> /// <returns></returns> protected override void InitStrategyParm() { string filePath = System.Windows.Forms.Application.StartupPath + @"\" + m_StrategyName + @"\Strategy.txt"; if (File.Exists(filePath)) { TextFile textFile = new TextFile(","); textFile.OpenFile(filePath); string[] instruments = new string[2]; StringAnalyse tokens = textFile.GetElementAt(0); m_BasePosition = Convert.ToInt32(tokens.GetElementAt(0)); tokens = textFile.GetElementAt(1); m_BasePriceDis = Convert.ToDouble(tokens.GetElementAt(0)); tokens = textFile.GetElementAt(2); m_WheeledPriceDis = Convert.ToDouble(tokens.GetElementAt(0)); } }