Пример #1
0
        public void SetRealOrderBookInfo(string trCode)
        {
            apiModel.SetRealType(trCode);
            List <BidAskSpread> AskSpreadList = new List <BidAskSpread>();
            List <BidAskSpread> BidSpreadList = new List <BidAskSpread>();

            for (int i = 0; i < 10; i++)
            {
                int          price     = apiModel.GetRealtimeValue <int>(RealTypes.매도호가10 - i);
                int          amount    = apiModel.GetRealtimeValue <int>(RealTypes.매도호가수량10 - i);
                BidAskSpread askSpread = new BidAskSpread();
                askSpread.Amount = amount;
                askSpread.Price  = price;
                BidSpreadList.Add(askSpread);
            }
            for (int i = 0; i < 10; i++)
            {
                int          price     = apiModel.GetRealtimeValue <int>(RealTypes.매수호가1 + i);
                int          amount    = apiModel.GetRealtimeValue <int>(RealTypes.매수호가수량1 + i);
                BidAskSpread bidSpread = new BidAskSpread();
                bidSpread.Amount = price;
                bidSpread.Price  = amount;
                BidSpreadList.Add(bidSpread);
            }
            //UpdateOrderBook(AskSpreadList, BidSpreadList);
        }
Пример #2
0
        public void SetOrderBookInfo(string trCode, string rqName)
        {
            apiModel.SetRequestType(trCode, rqName);
            List <BidAskSpread> AskSpreadList = new List <BidAskSpread>();
            List <BidAskSpread> BidSpreadList = new List <BidAskSpread>();

            for (int i = 0; i < 9; i++)
            {
                BidAskSpread bidAskSpread = new BidAskSpread();
                if (i == 4)
                {
                    int price  = apiModel.GetRequestValue <int>("매도" + (10 - i) + "차선호가");
                    int amount = apiModel.GetRequestValue <int>("매도" + (10 - i) + "우선잔량");
                    bidAskSpread.Price  = (price > 0) ? price : -price;
                    bidAskSpread.Amount = amount;
                    AskSpreadList.Add(bidAskSpread);
                }
                else
                {
                    int price  = apiModel.GetRequestValue <int>("매도" + (10 - i) + "차선호가");
                    int amount = apiModel.GetRequestValue <int>("매도" + (10 - i) + "차선잔량");
                    bidAskSpread.Price  = (price > 0) ? price : -price;
                    bidAskSpread.Amount = amount;
                    AskSpreadList.Add(bidAskSpread);
                }
            }

            BidAskSpread askSpreadFirst = new BidAskSpread();
            int          bidPrice       = apiModel.GetRequestValue <int>("매도최우선호가");
            int          bidAmount      = apiModel.GetRequestValue <int>("매도최우선잔량");

            askSpreadFirst.Price  = (bidPrice > 0) ? bidPrice : -bidPrice;
            askSpreadFirst.Amount = bidAmount;
            AskSpreadList.Add(askSpreadFirst);
            BidAskSpread bidSpreadFirst = new BidAskSpread();
            int          askPrice       = apiModel.GetRequestValue <int>("매수최우선호가");
            int          askAmount      = apiModel.GetRequestValue <int>("매수최우선잔량");

            bidSpreadFirst.Price  = (askPrice > 0) ? askPrice : -askPrice;
            bidSpreadFirst.Amount = askAmount;
            BidSpreadList.Add(bidSpreadFirst);

            for (int i = 0; i < 9; i++)
            {
                BidAskSpread bidAskSpread = new BidAskSpread();
                if (i == 4)
                {
                    int price  = apiModel.GetRequestValue <int>("매수" + (2 + i) + "우선호가");
                    int amount = apiModel.GetRequestValue <int>("매수" + (2 + i) + "우선잔량");
                    bidAskSpread.Price  = (price > 0) ? price : -price;
                    bidAskSpread.Amount = amount;
                    BidSpreadList.Add(bidAskSpread);
                }
                else
                {
                    int price  = apiModel.GetRequestValue <int>("매수" + (2 + i) + "차선호가");
                    int amount = apiModel.GetRequestValue <int>("매수" + (2 + i) + "차선잔량");
                    bidAskSpread.Price  = (price > 0) ? price : -price;
                    bidAskSpread.Amount = amount;
                    BidSpreadList.Add(bidAskSpread);
                }
            }
            //UpdateOrderBook(AskSpreadList, BidSpreadList);
        }