예제 #1
0
 //c'tor - gets ref to initiating cBot
 public Strategy(Object[] parameters, MultiStage3 value)
 {
     this.cBot = value;
     //this.Name = this.GetType().Name;
     this.Parameters = parameters;
     this.Code       = this.Name + string.Concat(parameters);
 }
 //c'tor overload
 public SortedPositions(String symbol, MultiStage3 cBot)
 {//for use in dictionary making class, allows use of AddPosition() to incrementally build,
     //and calling UpdateAll() when done
     this.cBot               = cBot;
     this.Symbol             = symbol;
     this.CompositePositions = null; //to be built in UpdateAll()
     this.LongPositions      = new List <Position>();
     this.ShortPositions     = new List <Position>();
     this.ShortExposureVol   = 0L;
     this.LongExposureVol    = 0L;
 }
 //c'tor
 public SortedPositions(List <Position> compositePositions, MultiStage3 cBot)
 {//requires all positions in composite list to be of same symbol
     Contract.Requires <ArgumentNullException>(compositePositions != null);
     this.CompositePositions = compositePositions;
     this.cBot             = cBot;
     this.Symbol           = null;
     this.LongPositions    = new List <Position>();
     this.ShortPositions   = new List <Position>();
     this.ShortExposureVol = 0L;
     this.LongExposureVol  = 0L;
     UpdateAll();
 }
예제 #4
0
        }                                                   //level to rebalance at
        //public int sRcushionTicks { get; set; }//# of ticks b4 s/r as cushion for target

        //c'tor
        public PingPongStrategy(Object[] parameters, MultiStage3 cBot) : base(parameters, cBot)
        {//can add another c'tor to take params minAF, etc.
            this.ticksBeyondVWAEforRebalance = 100;
            //this.sRcushionTicks = 50;
            this.Name = "pingpong";
        }
예제 #5
0
 //c'tor
 public PsarStrategy(MultiStage3 value) : base(value)
 {//can add another c'tor to take params minAF, etc.
     this.minAF = 0.002;
     this.maxAF = 0.02;
 }
예제 #6
0
        internal Dictionary <string, SortedPositions> GetSortedPositionsDictionary(List <Position> psns, MultiStage3 cBot)
        {//from pos. ref. list, returns dictionary of sorted psns by symbol as key
            var dic = new Dictionary <string, SortedPositions>();

            foreach (var pos in psns)
            {
                if (!dic.ContainsKey(pos.SymbolCode))
                {//if this symbol does not exist in dictionary, create a SortedPositions obj for it
                    dic.Add(pos.SymbolCode, new SortedPositions(pos.SymbolCode, cBot));
                }
                else
                {//if this symbol key exists in dictionary, add this position to the SortedPosition obj
                    SortedPositions sp;
                    var             result = dic.TryGetValue(pos.SymbolCode, out sp);
                    if (result)
                    {
                        sp.AddPosition(pos);
                    }
                    dic[pos.SymbolCode] = sp;
                }
            }
            foreach (SortedPositions sp in dic.Values)
            {//now that all S.P. obj are populated, call UpdateAll() on each to calc. stats.
                sp.UpdateAll();
            }
            return(dic);
            //GetSortedPositionsDictionary
        }
 //c'tor
 public DataOps(MultiStage3 cBot)
 {
     this.cBot = cBot;
     pdto      = new PositionsDataTableOps(this); //dependency for dfo
     pdfo      = new PositionsDataFileOps(this, pdto);
 }