Ejemplo n.º 1
0
        private static void Test_QuerySecurityHistoricalOrder(RushQuantTradeClient client)
        {
            Console.WriteLine("******* QuerySecurityHistoricalOrder BEGIN *********\n");

            QuerySecurityHistoricalOrderInput input = new QuerySecurityHistoricalOrderInput()
            {
                BeginDate = 20181224,
                EndDate   = 20181231
            };
            QuerySecurityHistoricalOrderOutput output = client.QuerySecurityHistoricalOrder(input);

            Console.WriteLine($"{"委托日期",-10}{"委托时间",-10}{"委托编号",-10}{"股东代码",-10}{"交易所代码",-10}{"合约代码",-10}{"合约名称",-10}{"交易标志",-10}{"委托价格",-10}{"委托数量",-10}{"成交数量",-10}{"撤单数量",-10}{"报价类型",-10}{"状态",-10}");

            for (int i = 0; i < output.Count; i++)
            {
                QuerySecurityHistoricalOrderOutputItem item = output.Items[i];
                Console.WriteLine($"{item.OrderDate,-14}{item.OrderTime,-14}{item.OrderID,-14}{item.StockholderCode,-14}{item.ExchangeId,-15}{item.InstrumentCode,-14}{item.InstrumentName,-10}{GetTradeFlagText(item.TradeFlag),-12}{item.OrderPrice,-14}{item.OrderVolume,-14}{item.DealVolume,-14}{item.CancelVolume,-14}{GetQuoteType(item.ExchangeId, item.QuoteType),-10}{GetStatusText(item.OrderStatus)}");
            }
            Console.WriteLine("******* QuerySecurityHistoricalOrder END *********\n");
            Console.WriteLine();
        }
        public unsafe QuerySecurityHistoricalOrderOutput QuerySecurityHistoricalOrder(QuerySecurityHistoricalOrderInput input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            byte *pInput  = stackalloc byte[QuerySecurityHistoricalOrderInput.GetSize()];
            byte *pOutput = null;

            input.WriteTo(pInput);
            int result = UnsafeNativeMethods.rushquant_trade_QuerySecurityHistoricalOrder(this._accountId, pInput, ref pOutput);
            QuerySecurityHistoricalOrderOutput output = new QuerySecurityHistoricalOrderOutput();

            output.ReadFrom(pOutput);
            UnsafeNativeMethods.rushquant_free(pOutput);
            if (result != ErrorCode.Success)
            {
                throw new RushQuantClientException(result, output.ErrorMessage);
            }

            return(output);
        }