Inheritance: DataObject
示例#1
0
 public void Add(Group group)
 {
     group.Id = Interlocked.Increment(ref this.counter);
     GroupById.Add(group.Id, group);
     Groups.Add(group);
     group.Framework = this.framework;
     this.framework.EventServer.OnLog(group);
 }
示例#2
0
 public override object Read(BinaryReader reader, byte version)
 {
     var gname = reader.ReadString();
     var id = reader.ReadInt32();
     var group = new Group(gname);
     group.Id = id;
     int count = reader.ReadInt32();
     for (int i = 0; i < count; ++i)
     {
         var name = reader.ReadString();
         var type = reader.ReadByte();
         object obj = this.streamerManager.Deserialize(reader);
         group.Add(name, type, obj);
     }
     return group;
 }
示例#3
0
        protected override void OnStrategyStart()
        {
            //
            barChartGroup = new Group("Bars");

            barChartGroup.Add("Pad", 0);
            barChartGroup.Add("SelectorKey", Instrument.Symbol);

            //
            fillChartGroup = new Group("Fills");

            fillChartGroup.Add("Pad", 0);
            fillChartGroup.Add("SelectorKey", Instrument.Symbol);

            //
            GroupManager.Add(barChartGroup);
            GroupManager.Add(fillChartGroup);
        }
示例#4
0
        private void AddGroups()
        {
            // Create bars group.
            barsGroup = new Group("Bars");
            barsGroup.Add("Pad", DataObjectType.String, 0);
            barsGroup.Add("SelectorKey", Instrument.Symbol);

            // Create fills group.
            fillGroup = new Group("Fills");
            fillGroup.Add("Pad", 0);
            fillGroup.Add("SelectorKey", Instrument.Symbol);

            // Create equity group.
            equityGroup = new Group("Equity");
            equityGroup.Add("Pad", Instrument.Legs.Count + 1);
            equityGroup.Add("SelectorKey", Instrument.Symbol);

            // Add groups to manager.
            GroupManager.Add(barsGroup);
            GroupManager.Add(fillGroup);
            GroupManager.Add(equityGroup);
        }
示例#5
0
 public void Log(DateTime dateTime, string text, Group group)
 {
     EventServer.OnLog(new GroupEvent(new TextInfo(dateTime, text), group));
 }
示例#6
0
 public void Log(double value, Group group)
 {
     EventServer.OnLog(new GroupEvent(new TimeSeriesItem(Framework.Clock.DateTime, value), group));
 }
示例#7
0
 public void Log(DataObject data, Group group)
 {
     EventServer.OnLog(new GroupEvent(data, group));
 }
示例#8
0
 public void Log(DateTime dateTime, double value, Group group)
 {
     EventServer.OnLog(new GroupEvent(new TimeSeriesItem(dateTime, value), group));
 }
示例#9
0
 public GroupEvent(Event obj, Group group)
 {
     Obj     = obj;
     Group   = group;
     GroupId = group != null ? group.Id : -1;
 }
示例#10
0
 public void Log(Event e, Group group)
 {
     EventServer.OnLog(new GroupEvent(e, group));
 }
示例#11
0
 public GroupEvent(Event obj, Group group)
 {
     Obj = obj;
     Group = group;
     GroupId = group != null ? group.Id : -1;
 }
示例#12
0
        public override void OnStrategyStart()
        {
            barsChartGroup = new Group("Bars");

            barsChartGroup.Add("Pad", 0);
            barsChartGroup.Add("SelectorKey", Instrument.Symbol);

            // add fill group

            fillChartGroup = new Group("Fills");

            fillChartGroup.Add("Pad", 0);
            fillChartGroup.Add("SelectorKey", Instrument.Symbol);

            // add equity group

            equityChartGroup = new Group("Equity");

            equityChartGroup.Add("Pad", 1);
            equityChartGroup.Add("SelectorKey", Instrument.Symbol);

            // register groups

            GroupManager.Add(barsChartGroup);
            GroupManager.Add(fillChartGroup);
            GroupManager.Add(equityChartGroup);
        }
示例#13
0
 private void ProcessGroup(IGroupListener listener, Group group)
 {
     if (listener.OnNewGroup(group))
     {
         var list = this.listenersByGroupId[group.Id] = this.listenersByGroupId[group.Id] ?? new List<IGroupListener>();
         list.Add(listener);
         this.groupIdsByListener[listener].Add(group.Id);
         foreach (var e in group.Events)
             listener.Queue.Enqueue(e);
     }
 }
示例#14
0
        private void AddGroups()
        {
            int pad = 0;

            foreach (Leg leg in spread.Legs)
            {
                ++pad;
                groups[leg.Instrument] = new Group[2];

                // Create bars group.
                Group barsGroup = new Group("Bars");
                barsGroup.Add("Pad", DataObjectType.Int32, pad);
                barsGroup.Add("SelectorKey", DataObjectType.String, spread.Symbol);

                // Create fills group.
                Group fillGroup = new Group("Fills");
                fillGroup.Add("Pad", DataObjectType.Int32, pad);
                fillGroup.Add("SelectorKey", DataObjectType.String, spread.Symbol);

                // Add groups to manager.
                GroupManager.Add(barsGroup);
                GroupManager.Add(fillGroup);

                groups[leg.Instrument][0] = barsGroup;
                groups[leg.Instrument][1] = fillGroup;
            }
        }
示例#15
0
        protected override void OnStrategyStart()
        {
            //
            barChartGroup = new Group("Bars");

            barChartGroup.Add("Pad", DataObjectType.Int, 0);
            barChartGroup.Add("SelectorKey", DataObjectType.String, "VWAP " + Instrument.Symbol);

            //
            fillChartGroup = new Group("Fills");

            fillChartGroup.Add("Pad", DataObjectType.Int, 0);
            fillChartGroup.Add("SelectorKey", DataObjectType.String, "VWAP " + Instrument.Symbol);

            //
            GroupManager.Add(barChartGroup);
            GroupManager.Add(fillChartGroup);
        }
示例#16
0
        private void AddGroups()
        {
            // Create bars group.
            barsGroup = new Group("Bars");
            barsGroup.Add("Pad", DataObjectType.String, 0);
            barsGroup.Add("SelectorKey", Instrument.Symbol);

            //// Create fills group.
            fillGroup = new Group("Fills");
            fillGroup.Add("Pad", 0);
            fillGroup.Add("SelectorKey", Instrument.Symbol);

            // Create equity group.
            equityGroup = new Group("Equity");
            equityGroup.Add("Pad", 1);
            equityGroup.Add("SelectorKey", Instrument.Symbol);

            // Create sma1 values group.
            sma1Group = new Group("SMA1");
            sma1Group.Add("Pad", 0);
            sma1Group.Add("SelectorKey", Instrument.Symbol);
            sma1Group.Add("Color", Color.Green);

            // Create sma2 values group.
            sma2Group = new Group("SMA2");
            sma2Group.Add("Pad", 0);
            sma2Group.Add("SelectorKey", Instrument.Symbol);
            sma2Group.Add("Color", Color.Red);

            // Create log monitor groups.
            closeMonitorGroup = new Group("Close");
            closeMonitorGroup.Add("LogName", "Close");
            closeMonitorGroup.Add("StrategyName", "MyStrategy");
            closeMonitorGroup.Add("Symbol", Instrument.Symbol);

            openMonitorGroup = new Group("Open");
            openMonitorGroup.Add("LogName", "Open");
            openMonitorGroup.Add("StrategyName", "MyStrategy");
            openMonitorGroup.Add("Symbol", Instrument.Symbol);

            positionMonitorGroup = new Group("Position");
            positionMonitorGroup.Add("LogName", "Position");
            positionMonitorGroup.Add("StrategyName", "MyStrategy");
            positionMonitorGroup.Add("Symbol", Instrument.Symbol);

            // Add groups to manager.
            GroupManager.Add(barsGroup);
            GroupManager.Add(fillGroup);
            GroupManager.Add(equityGroup);
            GroupManager.Add(sma1Group);
            GroupManager.Add(sma2Group);
            GroupManager.Add(closeMonitorGroup);
            GroupManager.Add(openMonitorGroup);
            GroupManager.Add(positionMonitorGroup);
        }
示例#17
0
        private void AddGroups()
        {
            // Create bars group.
            Group barGroup = new Group("Bars");
            barGroup.Add("Pad", DataObjectType.Int, legIndex + 2);
            barGroup.Add("SelectorKey", DataObjectType.String, rootInstrument.Symbol);

            // Create fills group.
            Group fillGroup = new Group("Fills");
            fillGroup.Add("Pad", DataObjectType.Int, legIndex + 2);
            fillGroup.Add("SelectorKey", DataObjectType.String, rootInstrument.Symbol);

            // Add groups to manager.
            GroupManager.Add(fillGroup);
            GroupManager.Add(barGroup);

            // Add groups to dictionary.
            fillGroups[currentFuturesContract] = fillGroup;
            barsGroups[currentFuturesContract] = barGroup;
        }
示例#18
0
 public void Log(string text, Group group)
 {
     EventServer.OnLog(new GroupEvent(new TextInfo(Framework.Clock.DateTime, text), group));
 }
示例#19
0
 internal void OnGroup(Group e)
 {
     // noop
 }
示例#20
0
 public GroupEventAgrs(Group group)
 {
     Group = group;
 }
示例#21
0
        private void AddGroups()
        {
            // Create bars group.
            barsGroup = new Group("Bars");
            barsGroup.Add("Pad", DataObjectType.String, 0);
            barsGroup.Add("SelectorKey", Instrument.Symbol);

            // Create fills group.
            fillGroup = new Group("Fills");
            fillGroup.Add("Pad", 0);
            fillGroup.Add("SelectorKey", Instrument.Symbol);

            // Create equity group.
            equityGroup = new Group("Equity");
            equityGroup.Add("Pad", 1);
            equityGroup.Add("SelectorKey", Instrument.Symbol);

            // Create fast sma values group.
            fastSmaGroup = new Group("FastSMA");
            fastSmaGroup.Add("Pad", 0);
            fastSmaGroup.Add("SelectorKey", Instrument.Symbol);
            fastSmaGroup.Add("Color", Color.Green);

            // Create slow sma values group.
            slowSmaGroup = new Group("SlowSMA");
            slowSmaGroup.Add("Pad", 0);
            slowSmaGroup.Add("SelectorKey", Instrument.Symbol);
            slowSmaGroup.Add("Color", Color.Red);

            // Add groups to manager.
            GroupManager.Add(barsGroup);
            GroupManager.Add(fillGroup);
            GroupManager.Add(equityGroup);
            GroupManager.Add(fastSmaGroup);
            GroupManager.Add(slowSmaGroup);
        }
示例#22
0
        private void AddGroups()
        {
            // Create bars group.
            barsGroup = new Group("Bars");
            barsGroup.Add("Pad", DataObjectType.String, 0);
            barsGroup.Add("SelectorKey", Instrument.Symbol);

            // Create fills group.
            fillGroup = new Group("Fills");
            fillGroup.Add("Pad", 0);
            fillGroup.Add("SelectorKey", Instrument.Symbol);

            // Create equity group.
            equityGroup = new Group("Equity");
            equityGroup.Add("Pad", 1);
            equityGroup.Add("SelectorKey", Instrument.Symbol);

            // Create channel's highest values group.
            highestGroup = new Group("Highest");
            highestGroup.Add("Pad", 0);
            highestGroup.Add("SelectorKey", Instrument.Symbol);
            highestGroup.Add("Color", Color.Green);

            // Create channel's lowest values group.
            lowestGroup = new Group("Lowest");
            lowestGroup.Add("Pad", 0);
            lowestGroup.Add("SelectorKey", Instrument.Symbol);
            lowestGroup.Add("Color", Color.Red);

            // Add groups to manager.
            GroupManager.Add(barsGroup);
            GroupManager.Add(fillGroup);
            GroupManager.Add(equityGroup);
            GroupManager.Add(highestGroup);
            GroupManager.Add(lowestGroup);
        }
示例#23
0
 private void ConstructParametersName(Strategy strategy, string name, Group group)
 {
     name += string.IsNullOrEmpty(name) ? strategy.Name : "\\" + strategy.Name;
     var parameters = strategy.GetParameters();
     parameters.Name = name;
     parameters.DateTime = DateTime.Now;
     this.framework.EventServer.OnLog(new GroupEvent(parameters, group));
     foreach (Strategy s in strategy.Strategies)
         ConstructParametersName(s, name, group);
 }
示例#24
0
 private Group FindOrCreateGroup(string name)
 {
     var group = FindGroup(name);
     if (group == null)
     {
         group = new Group(name);
         group.dateTime = DateTime.Now;
         this.framework.GroupManager.Add(group);
     }
     else
     {
         this.framework.EventServer.OnLog(group);
     }
     return group;
 }
示例#25
0
        private void AddGroups()
        {
            // Create bars group.
            barsGroup = new Group("Bars");
            barsGroup.Add("Pad", DataObjectType.String, 0);
            barsGroup.Add("SelectorKey", Instrument.Symbol);

            // Create fills group.
            fillGroup = new Group("Fills");
            fillGroup.Add("Pad", 0);
            fillGroup.Add("SelectorKey", Instrument.Symbol);

            // Create equity group.
            equityGroup = new Group("Equity");
            equityGroup.Add("Pad", 2);
            equityGroup.Add("SelectorKey", Instrument.Symbol);

            // Create RSI values group.
            rsiGroup = new Group("RSI");
            rsiGroup.Add("Pad", 1);
            rsiGroup.Add("SelectorKey", Instrument.Symbol);
            rsiGroup.Add("Color", Color.Blue);

            // Create BuyLevel values group.
            buyLevelGroup = new Group("BuyLevel");
            buyLevelGroup.Add("Pad", 1);
            buyLevelGroup.Add("SelectorKey", Instrument.Symbol);
            buyLevelGroup.Add("Color", Color.Red);

            // Create SellLevel values group.
            sellLevelGroup = new Group("SellLevel");
            sellLevelGroup.Add("Pad", 1);
            sellLevelGroup.Add("SelectorKey", Instrument.Symbol);
            sellLevelGroup.Add("Color", Color.Red);

            // Add groups to manager.
            GroupManager.Add(barsGroup);
            GroupManager.Add(fillGroup);
            GroupManager.Add(equityGroup);
            GroupManager.Add(rsiGroup);
            GroupManager.Add(buyLevelGroup);
            GroupManager.Add(sellLevelGroup);
        }
示例#26
0
        private void AddGroups()
        {
            // Create bars group.
            barsGroup = new Group("Bars");
            barsGroup.Add("Pad", DataObjectType.String, 0);
            barsGroup.Add("SelectorKey", Instrument.Symbol);

            // Create fills group.
            fillGroup = new Group("Fills");
            fillGroup.Add("Pad", 0);
            fillGroup.Add("SelectorKey", Instrument.Symbol);

            // Create equity group.
            equityGroup = new Group("Equity");
            equityGroup.Add("Pad", 1);
            equityGroup.Add("SelectorKey", Instrument.Symbol);

            // Create BBU group.
            bbuGroup = new Group("BBU");
            bbuGroup.Add("Pad", 0);
            bbuGroup.Add("SelectorKey", Instrument.Symbol);
            bbuGroup.Add("Color", Color.Blue);

            // Create BBL group.
            bblGroup = new Group("BBL");
            bblGroup.Add("Pad", 0);
            bblGroup.Add("SelectorKey", Instrument.Symbol);
            bblGroup.Add("Color", Color.Blue);

            // Create SMA group.
            smaGroup = new Group("SMA");
            smaGroup.Add("Pad", 0);
            smaGroup.Add("SelectorKey", Instrument.Symbol);
            smaGroup.Add("Color", Color.Yellow);

            // Add groups to manager.
            GroupManager.Add(barsGroup);
            GroupManager.Add(fillGroup);
            GroupManager.Add(equityGroup);
            GroupManager.Add(bbuGroup);
            GroupManager.Add(bblGroup);
            GroupManager.Add(smaGroup);
        }
示例#27
0
 internal void OnGroup(Group e)
 {
     // noop
 }