Ejemplo n.º 1
0
        static void testMarket1()
        {
            AMarket   market = AMarket.GetInstance(MarketVendor.Exchange);
            ASecurity s1     = new ETF("510050", Exchange.SHE);   //50ETF
            ASecurity s2     = new ETF("510180", Exchange.SHE);   //100ETF
            ASecurity s3     = new Stock("601318", Exchange.SHE); //中国平安
            ASecurity s4     = new Stock("600104", Exchange.SHE); //上汽集团

            List <ASecurity> seclist = new List <ASecurity>();

            seclist.Add(s1);
            seclist.Add(s2);
            seclist.Add(s3);
            seclist.Add(s4);

            List <Option> optionlist = market.GetOptionSet(seclist);

            //ASecurity s = (ASecurity)market.htUnderlyingSets["510050"];
            //s.name = "更改";

            if (optionlist != null)
            {
                foreach (Option o in optionlist)
                {
                    o.DebugPrint();
                }
            }
            market.Dispose();
        }
Ejemplo n.º 2
0
 public virtual void AddOptions(ASecurity underlying)
 {
     try
     {
         if (underlying.category == SecurityCategory.OPTION)
         {
             //添加期权合约本身
             this.AddOptions((Option)underlying);
         }
         else
         {
             //添加标的对应的期权合约
             List <Option> optionlist = _optionengine.GetOptionSet(underlying);
             this.AddOptions(optionlist);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
        static void testMM1()
        {
            string acc   = "1104";
            string combi = "11040201";

            List <ASecurity> underlyinglist = new List <ASecurity>();

            //underlyinglist.Add(new ETF("510050", Exchange.SHE));
            underlyinglist.Add(new ETF("510180", Exchange.SHE));
            underlyinglist.Add(new Stock("601318", Exchange.SHE));
            //underlyinglist.Add(new Stock("600104", Exchange.SHE));

            AMarket       mkt        = AMarket.GetInstance(MarketVendor.Exchange);
            List <Option> optionlist = mkt.GetOptionSet(underlyinglist);

            foreach (Option o in optionlist)
            {
                QueryPara param = new QueryPara();
                param.fundcode     = acc;
                param.portfolio    = combi;
                param.securitycode = o.code;

                AEntrust et = AEntrust.GetInstance(EntrustVendor.Hundsun);
                et.OptionEntrustQuery(param, o.entrustbook);
                bool flg = o.makemarketstat.IsValid();

                if (o.entrustbook != null && o.entrustbook.Count > 0)
                {
                    foreach (EntrustBook eb in o.entrustbook)
                    {
                        eb.DebugPrint();
                    }
                }

                //Debug.Print(string.Format("spread, code={2},name={3},价差={0},{1}", o.makemarketstat.currminspreadpct.ToString("P2"), o.makemarketstat.message, o.code,o.name));
            }
        }