Esempio n. 1
0
        public static IEnumerable <QueryGeneralOrderResult> ExtractFrom(TabulateData data)
        {
            if (columnIndices == null)
            {
                columnIndices = columns.Select(c => data.GetColumnIndex(c)).ToArray();
            }

            var subData = data.GetSubColumns(columnIndices);

            foreach (var row in subData.Rows)
            {
                QueryGeneralOrderResult result = new QueryGeneralOrderResult();

                int index = 0;
                result.OrderNo        = int.Parse(row[index++]);
                result.SubmissionTime = row[index++];
                result.SecurityCode   = row[index++];
                result.SecurityName   = row[index++];
                result.BuySellFlag    = row[index++];
                result.StatusString   = row[index++];
                result.Status         = TradingHelper.ConvertStringToOrderStatus(result.StatusString);

                result.SubmissionPrice  = TradingHelper.SafeParseFloat(row[index++]);
                result.SubmissionVolume = TradingHelper.SafeParseInt(row[index++]);
                result.DealPrice        = TradingHelper.SafeParseFloat(row[index++]);
                result.DealVolume       = TradingHelper.SafeParseInt(row[index++]);
                result.SubmissionType   = row[index++];
                result.PricingType      = row[index++];

                yield return(result);
            }
        }
Esempio n. 2
0
        public IEnumerable <QueryGeneralOrderResult> QueryCancellableOrder(out string error)
        {
            TabulateData data;

            if (!QueryData(DataCategory.CancellableOrder, out data, out error))
            {
                return(new List <QueryGeneralOrderResult>());
            }

            return(QueryGeneralOrderResult.ExtractFrom(data));
        }
Esempio n. 3
0
        public IEnumerable <QueryGeneralOrderResult> QuerySubmittedOrderHistory(DateTime startDate, DateTime endDate, out string error)
        {
            TabulateData data;

            if (!QueryHistoryData(HistoryDataCategory.OrderSubmittedInHistory, startDate, endDate, out data, out error))
            {
                return(null);
            }

            return(QueryGeneralOrderResult.ExtractFrom(data));
        }
Esempio n. 4
0
        public IEnumerable <QueryGeneralOrderResult> QuerySubmittedOrderToday(out string error)
        {
            TabulateData data;

            if (!QueryData(DataCategory.OrderSubmittedToday, out data, out error))
            {
                return(new List <QueryGeneralOrderResult>());
            }

            return(QueryGeneralOrderResult.ExtractFrom(data));
        }
Esempio n. 5
0
        private bool CheckOrderStatusChangeAndNotify(ref DispatchedOrder dispatchedOrder, QueryGeneralOrderResult order)
        {
            bool isStatusChanged = false;

            if (order.Status != dispatchedOrder.LastStatus)
            {
                isStatusChanged = true;
            }
            else if (order.Status == OrderStatus.PartiallySucceeded &&
                     dispatchedOrder.LastStatus == order.Status &&
                     order.DealVolume != dispatchedOrder.SucceededVolume)
            {
                isStatusChanged = true;
            }

            dispatchedOrder.LastStatus      = order.Status;
            dispatchedOrder.SucceededVolume = order.DealVolume;

            if (isStatusChanged)
            {
                NotifyOrderStatusChanged(dispatchedOrder);
            }

            return(isStatusChanged);
        }