Ejemplo n.º 1
0
        /// <summary>
        /// 获取条件单
        /// </summary>
        /// <param name="contractCode"></param>
        /// <returns></returns>
        private static long QueryConditionOrders(string contractCode)
        {
            _logger.Start();
            var req = new QueryConditionOrdersRequest
            {
                ContractCodeList = new List <string>()
                {
                    contractCode
                },
                TaskTypeList   = new List <int>(),
                TrigTypeList   = new List <int>(),
                TaskStatusList = new List <int>(),
                Direct         = 0,
                Side           = 0,
                StartTime      = 0,
                EndTime        = 0
            };
            var data = _tradeClient.QueryConditionOrdersAsync(req).Result;

            _logger.StopAndLog();
            AppLogger.Info($"query condition orders, data:{JsonConvert.SerializeObject(data)}");

            long taskId = 0;

            if (data != null && data.Result.Any())
            {
                taskId = data.Result.FirstOrDefault(x => x.TaskStatus == 1)?.TaskId ?? 0;
            }

            return(taskId);
        }