예제 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                session = Session.getInstance();
                XmlSerializer xs = new XmlSerializer(typeof(Session));

                using (Stream str = File.OpenRead(this.Config))
                    session = (Session)xs.Deserialize(str);


                procSpread           = SpreadProc.getInstance();
                procSpread.OnUpdate += new EventHandler <UpdateEventArgs>(procSpread_OnUpdate);

                procStrategy = StrategyProc.getInstance(session.spread);

                //procStrategy.OnZscoreEvt += this.OnZscore;

                pgInstrumentA.SelectedObject = session.instrumentA;
                pgInstrumentB.SelectedObject = session.instrumentB;
                pgSpread.SelectedObject      = session.spread;
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        private StrategyProc(Spread spread)
        {
            this.spread = spread;

            orders    = new List <SpreadOrder>();
            lastfill  = new Dictionary <string, double>();
            closeouts = new Dictionary <string, Thread>();
            offOrders = new Dictionary <string, Order>();
            fillbugs  = new Dictionary <string, SpreadOrder>();

            scratchLegs = new Queue <Order>();

            procSpread = SpreadProc.getInstance();

            procSpread.OnFill   += this.OnFill;
            procSpread.OnUpdate += this.OnUpdate;
        }
예제 #3
0
        public Zscore(Spread spread)
        {
            procSpread = SpreadProc.getInstance();

            this.tickers = new string[] { procSpread.productOne.Product
                                          , procSpread.productTwo.Product };
            this.multipliers = new double[] { procSpread.productOne.InstrumentMultiplier
                                              , procSpread.productTwo.InstrumentMultiplier };
            this.ratio = new int[] { procSpread.productOne.Size, procSpread.productTwo.Size };


            market       = Market.getInstance(tickers);
            this.spreads = new List <Quote>();
            this.zslist  = new List <double>();

            this.threshold   = spread.Threshold;
            this.trendfollow = spread.TrendFollow;
            this.pricelength = spread.PriceLength;
            this.signame     = spread.Signal;

            this.signame = signame.ToUpper();
        }