Example #1
0
        public static StrategyProc getInstance(Spread spread)
        {
            if (instance == null)
            {
                instance = new StrategyProc(spread);
            }

            return (instance);
        }
Example #2
0
        public Session()
        {
            spread = new Spread();
            instrumentA = new Instrument();
            instrumentB = new Instrument();

            instruments = new List<Instrument>();
            instruments.Add(instrumentA);
            instruments.Add(instrumentB);
        }
Example #3
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;
        }
Example #4
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();
        }
Example #5
0
 public void resetStrategy(Session session)
 {
     signal.resetparams( new object[] { session.spread.Threshold
                                       ,session.spread.TrendFollow
                                       ,session.spread.PriceLength
                                       ,session.spread.Signal });
     spread = session.spread;
 }
Example #6
0
 public SignalFactory(Spread spread)
 {
     this.spread = spread;
     this.signalName = spread.Signal.ToUpper();
 }