Example #1
0
        public EntityResponse <OptionQuotation> GetOptionQuotation(string optionNo)
        {
            EntityResponse <OptionQuoteInfo> r = GetOptionQuote(optionNo);

            if (!r.IsSuccess)
            {
                return(EntityResponse <OptionQuotation> .Error(r));
            }

            OptionQuotation optionQuotation = ConvertToOptionQuotation(r);

            return(optionQuotation);
        }
        private OptionViewModel AutoMapperConverterOptionQuotation(OptionQuotation optionQuotation)
        {
            OptionViewModel ovm = new OptionViewModel();

            ovm.Ask                      = optionQuotation.Ask;
            ovm.Ask2                     = optionQuotation.Ask2;
            ovm.Ask3                     = optionQuotation.Ask3;
            ovm.Ask4                     = optionQuotation.Ask4;
            ovm.Ask5                     = optionQuotation.Ask5;
            ovm.AskVolume                = optionQuotation.AskVolume;
            ovm.AskVolume2               = optionQuotation.AskVolume2;
            ovm.AskVolume3               = optionQuotation.AskVolume3;
            ovm.AskVolume4               = optionQuotation.AskVolume4;
            ovm.AskVolume5               = optionQuotation.AskVolume5;
            ovm.AuctionReferencePrice    = optionQuotation.AuctionReferencePrice;
            ovm.AuctionReferenceQuantity = optionQuotation.AuctionReferenceQuantity;
            ovm.Bid                      = optionQuotation.Bid;
            ovm.Bid2                     = optionQuotation.Bid2;
            ovm.Bid3                     = optionQuotation.Bid3;
            ovm.Bid4                     = optionQuotation.Bid4;
            ovm.Bid5                     = optionQuotation.Bid5;
            ovm.BidVolume                = optionQuotation.BidVolume;
            ovm.BidVolume2               = optionQuotation.BidVolume2;
            ovm.BidVolume3               = optionQuotation.BidVolume3;
            ovm.BidVolume4               = optionQuotation.BidVolume4;
            ovm.BidVolume5               = optionQuotation.BidVolume5;
            ovm.Change                   = optionQuotation.Change;
            ovm.ChangePercentage         = optionQuotation.ChangePercentage;
            ovm.Greeks                   = optionQuotation.Greeks;
            ovm.HighestPrice             = optionQuotation.HighestPrice;
            ovm.LatestTradedPrice        = optionQuotation.LatestTradedPrice;
            ovm.LowestPrice              = optionQuotation.LowestPrice;

            ovm.OpeningPrice            = optionQuotation.OpeningPrice;
            ovm.OptionCode              = optionQuotation.OptionCode;
            ovm.OptionName              = optionQuotation.OptionName;
            ovm.OptionNumber            = optionQuotation.OptionNumber;
            ovm.PreviousSettlementPrice = optionQuotation.PreviousSettlementPrice;
            ovm.SecurityCode            = optionQuotation.SecurityCode;
            ovm.TradeDate = optionQuotation.TradeDate;
            ovm.Turnover  = optionQuotation.Turnover;
            ovm.UncoveredPositionQuantity = optionQuotation.UncoveredPositionQuantity;
            ovm.Volume = optionQuotation.Volume;
            //lstOvm.Add(ovm);
            //}
            return(ovm);
        }
Example #3
0
        private static OptionQuotation ConvertToOptionQuotation(OptionQuoteInfo info)
        {
            OptionQuotation result = new OptionQuotation(info.OptionNumber)
            {
                PreviousSettlementPrice   = (double)info.PreviousSettlementPrice,
                UncoveredPositionQuantity = info.UncoveredPositionQuantity,
                Turnover                 = (double)info.Turnover,
                OpeningPrice             = (double)info.OpeningPrice,
                AuctionReferencePrice    = (double)info.AuctionReferencePrice,
                AuctionReferenceQuantity = info.AuctionReferenceQuantity,
                HighestPrice             = (double)info.HighestPrice,
                LowestPrice              = (double)info.LowestPrice,
                LatestTradedPrice        = (double)info.LatestTradedPrice,

                Volume = info.TradeQuantity,

                Ask       = (double)info.SellPrice1,
                AskVolume = info.SellQuantity1,
                Bid       = (double)info.BuyPrice1,
                BidVolume = info.BuyQuantity1,

                Ask2       = (double)info.SellPrice2,
                AskVolume2 = info.SellQuantity2,
                Bid2       = (double)info.BuyPrice2,
                BidVolume2 = info.BuyQuantity2,

                Ask3       = (double)info.SellPrice3,
                AskVolume3 = info.SellQuantity3,
                Bid3       = (double)info.BuyPrice3,
                BidVolume3 = info.BuyQuantity3,

                Ask4       = (double)info.SellPrice4,
                AskVolume4 = info.SellQuantity4,
                Bid4       = (double)info.BuyPrice4,
                BidVolume4 = info.BuyQuantity4,

                Ask5       = (double)info.SellPrice5,
                AskVolume5 = info.SellQuantity5,
                Bid5       = (double)info.BuyPrice5,
                BidVolume5 = info.BuyQuantity5,

                TradeDate = info.TradeDate,
            };

            return(result);
        }
Example #4
0
        public Option GetOptionTradingInformation(string optionNo)
        {
            // Get OptionBasicInfo
            EntityResponse <List <OptionBasicInformation> > r = _marketDataProvider.GetOptionBasicInformation(null, optionNo);

            if (!r.IsSuccess)
            {
                return(null);
            }
            OptionBasicInformation optionBasicInformation = r.Entity.Single();

            // Get OptionQuotation
            List <string> optionNums = new List <string>();

            optionNums.Add(optionNo);
            EntityResponse <List <OptionQuotation> > optionQuotesResponse = GetOptionQuotesByOptionNumbers(optionNums);
            OptionQuotation optionQuotation = optionQuotesResponse.Entity.Single();

            // Combine the Quotation with BasicInfo
            Option option = new Option(null, optionBasicInformation.OptionNumber, optionBasicInformation.OptionCode)
            {
                Name          = optionBasicInformation.OptionName,
                OptionName    = optionBasicInformation.OptionName,
                OpenInterest  = optionBasicInformation.UncoveredPositionQuantity,
                SecurityCode  = optionBasicInformation.OptionUnderlyingCode,
                PreviousClose = (double)optionBasicInformation.PreviousClosingPrice,

                // Additional Information from OptionBasicInformation
                TypeOfOption         = optionBasicInformation.OptionType,
                LimitDownPrice       = optionBasicInformation.LimitDownPrice,
                LimitUpPrice         = optionBasicInformation.LimitUpPrice,
                OptionUnit           = optionBasicInformation.OptionUnit,
                OptionUnderlyingCode = optionBasicInformation.OptionUnderlyingCode,
                OptionUnderlyingName = optionBasicInformation.OptionUnderlyingName,
            };

            Mapper.Map(optionQuotation, option);

            return(option);
        }