public DataFile(string name, StreamerManager streamerManager) { this.name = name; StreamerManager = streamerManager; this.mstream = new MemoryStream(); this.writer = new BinaryWriter(this.mstream); }
private Framework(string name, FrameworkMode mode, bool createServers, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer) { Name = name; this.mode = mode; LoadConfiguration(); // Setup events compoents setup EventBus = new EventBus(this); OutputManager = new OutputManager(this); Clock = new Clock(this, ClockType.Local); EventBus.LocalClockEventQueue = Clock.ReminderQueue; ExchangeClock = new Clock(this, ClockType.Exchange); EventBus.ExchangeClockEventQueue = ExchangeClock.ReminderQueue; if (externalBus != null) { externalBus.Attach(EventBus); } EventServer = new EventServer(this, EventBus); EventManager = new EventManager(this, EventBus); // Setup streamers StreamerManager = new StreamerManager(); StreamerManager.AddDefaultStreamers(); // Create Servers var iServer = instrumentServer ?? new FileInstrumentServer(this, Configuration.InstrumentFileName); var dServer = dataServer ?? new FileDataServer(this, Configuration.DataFileName); var oServer = new FileOrderServer(this, Configuration.OrderFileName); var pServer = new FilePortfolioServer(this, Configuration.PortfolioFileName); InstrumentManager = new InstrumentManager(this, iServer); InstrumentServer = iServer; InstrumentManager.Load(); DataManager = new DataManager(this, dServer); DataServer = dServer; OrderManager = new OrderManager(this, oServer); OrderServer = oServer; PortfolioManager = new PortfolioManager(this, pServer); PortfolioServer = pServer; UserServer = new XmlUserServer(this); UserManager = new UserManager(this, UserServer); UserManager.Load(); // Create Providers ProviderManager = new ProviderManager(this); // Other stuff EventLoggerManager = new EventLoggerManager(); SubscriptionManager = new SubscriptionManager(this); ScenarioManager = new ScenarioManager(this); StrategyManager = new StrategyManager(this); StatisticsManager = new StatisticsManager(this); GroupManager = new GroupManager(this); AccountDataManager = new AccountDataManager(this); LicenseManager = new LicenseManager(); CurrencyConverter = new CurrencyConverter(this); DataFileManager = new DataFileManager(Installation.DataDir.FullName); instance = instance ?? this; }
public override void Write(BinaryWriter writer, object obj) { var ol = (OnLoggedIn)obj; writer.Write(ol.DateTime.Ticks); writer.Write(ol.UserId); writer.Write(ol.UserName); writer.Write(ol.DefaultAlgoId); StreamerManager.Serialize(writer, ol.Fields); }
public override void Write(BinaryWriter writer, object obj) { var array = (object[])obj; writer.Write(array.Length); for (int i = 0; i < array.Length; i++) { StreamerManager.Serialize(writer, array[i]); } }
public override object Read(BinaryReader reader, byte version) { int length = reader.ReadInt32(); var array = new object[length]; for (int i = 0; i < length; i++) { array[i] = StreamerManager.Deserialize(reader); } return(array); }
public override object Read(BinaryReader reader, byte version) { var dateTime = new DateTime(reader.ReadInt64()); return(new OnLoggedIn(dateTime) { UserId = reader.ReadInt32(), UserName = reader.ReadString(), DefaultAlgoId = reader.ReadInt32(), Fields = (ObjectTable)StreamerManager.Deserialize(reader) }); }
public override void Write(BinaryWriter writer, object obj) { var p = (Parameter)obj; writer.Write(p.Name); StreamerManager.Serialize(writer, p.Value); writer.Write(p.TypeName); writer.Write(p.Attributes.Length); var attributes = p.Attributes; for (int i = 0; i < attributes.Length; i++) { StreamerManager.Serialize(writer, attributes[i]); } }
public override void Write(BinaryWriter writer, object obj) { var list = (ParameterList)obj; var ps = list.Parameters().Select(p => StreamerManager.HasStreamer(p.Value.GetType())); writer.Write(list.Name); writer.Write(ps.Count()); writer.Write(list.Methods.Count); foreach (var p in ps) { StreamerManager.Serialize(writer, p); } foreach (string m in list.Methods) { writer.Write(m); } }
public override object Read(BinaryReader reader, byte version) { var list = new ParameterList(); list.Name = reader.ReadString(); int pCount = reader.ReadInt32(); int mCount = reader.ReadInt32(); for (int i = 0; i < pCount; i++) { list.Add(StreamerManager.Deserialize(reader) as Parameter); } for (int j = 0; j < mCount; j++) { list.Methods.Add(reader.ReadString()); } return(list); }
public override object Read(BinaryReader reader, byte version) { var name = reader.ReadString(); var value = StreamerManager.Deserialize(reader); var typeName = reader.ReadString(); int count = reader.ReadInt32(); var attributes = new List <Attribute>(); for (int i = 0; i < count; i++) { var attribute = StreamerManager.Deserialize(reader) as Attribute; if (attribute != null) { attributes.Add(attribute); } } return(new Parameter(name, value, typeName, attributes.ToArray())); }
public override object Read(BinaryReader reader, byte version) { var datetime = new DateTime(reader.ReadInt64()); var type = (AccountDataType)reader.ReadInt32(); var account = reader.ReadString(); var providerId = reader.ReadByte(); var route = reader.ReadByte(); var accountData = new AccountData(datetime, type, account, providerId, route); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { var name = reader.ReadString(); var currency = reader.ReadString(); object value = StreamerManager.Deserialize(reader); accountData.Fields.Add(name, currency, value); } return(accountData); }
// Token: 0x060008B1 RID: 2225 RVA: 0x0002EC6C File Offset: 0x0002CE6C public override void Write(BinaryWriter writer, object obj) { var ou = (OnUnsubscribe)obj; writer.Write(ou.DateTime.Ticks); writer.Write(ou.Symbol); if (this.version >= 1) { writer.Write(ou.Subscription != null); if (ou.Subscription != null) { writer.Write(ou.Subscription.SourceId); writer.Write(ou.Subscription.ProviderId); writer.Write(ou.Subscription.RouteId); writer.Write(ou.Subscription.RequestId); writer.Write(ou.Subscription.Symbol); StreamerManager.Serialize(writer, ou.Subscription.Instrument); } } }
public override object Read(BinaryReader reader, byte version) { var ou = new OnUnsubscribe(); ou.DateTime = new DateTime(reader.ReadInt64()); ou.Symbol = reader.ReadString(); if (version >= 1 && reader.ReadBoolean()) { ou.Subscription = new Subscription { SourceId = reader.ReadInt32(), ProviderId = reader.ReadInt32(), RouteId = reader.ReadInt32(), RequestId = reader.ReadInt32(), Symbol = reader.ReadString(), Instrument = (Instrument)StreamerManager.Deserialize(reader) }; } return(ou); }
public override void Write(BinaryWriter writer, object obj) { var data = (AccountData)obj; writer.Write(data.DateTime.Ticks); writer.Write((int)data.Type); writer.Write(data.Account); writer.Write(data.ProviderId); writer.Write(data.Route); var list = new List <AccountDataField>(); foreach (AccountDataField field in data.Fields) { var type = field.Value.GetType(); if (StreamerManager.HasStreamer(type)) { list.Add(field); } else if (type == typeof(object[])) { var array = (object[])field.Value; for (int i = 0; i < array.Length; i++) { StreamerManager.HasStreamer(array[i].GetType()); } list.Add(field); } } writer.Write(list.Count); foreach (var field in list) { writer.Write(field.Name); writer.Write(field.Currency); StreamerManager.Serialize(writer, field.Value); } }
private Framework(string name, FrameworkMode mode, bool createServers, EventBus externalBus, InstrumentServer instrumentServer, DataServer dataServer, string fileServerPath) { Name = name; this.mode = mode; LoadConfiguration(); // Setup events compoents setup EventBus = new EventBus(this); OutputManager = new OutputManager(this, Configuration.IsOutputLogEnabled ? Configuration.OutputLogFileName : null); Clock = new Clock(this, ClockType.Local, false); EventBus.LocalClockEventQueue = Clock.ReminderQueue; ExchangeClock = new Clock(this, ClockType.Exchange, false); EventBus.ExchangeClockEventQueue = ExchangeClock.ReminderQueue; externalBus?.Attach(EventBus); EventServer = new EventServer(this, EventBus); EventManager = new EventManager(this, EventBus); // Setup streamers StreamerManager = new StreamerManager(); StreamerManager.AddDefaultStreamers(); // Create Servers var iServer = instrumentServer ?? new FileInstrumentServer(this, Configuration.InstrumentFileName); var dServer = dataServer ?? new FileDataServer(this, Configuration.DataFileName); var oServer = new FileOrderServer(this, Configuration.OrderFileName); var pServer = new FilePortfolioServer(this, Configuration.PortfolioFileName); InstrumentManager = new InstrumentManager(this, iServer); InstrumentServer = iServer; InstrumentManager.Load(); DataManager = new DataManager(this, dServer); DataServer = dServer; OrderManager = new OrderManager(this, oServer); OrderServer = oServer; PortfolioManager = new PortfolioManager(this, pServer); PortfolioServer = pServer; UserServer = new XmlUserServer(this); UserManager = new UserManager(this, UserServer); UserManager.Load(); // Create Providers ProviderManager = new ProviderManager(this); // Other stuff EventLoggerManager = new EventLoggerManager(); SubscriptionManager = new SubscriptionManager(this); ScenarioManager = new ScenarioManager(this); StrategyManager = new StrategyManager(this); StatisticsManager = new StatisticsManager(this); GroupManager = new GroupManager(this); AccountDataManager = new AccountDataManager(this); LicenseManager = new LicenseManager(); CurrencyConverter = new CurrencyConverter(this); DataFileManager = new DataFileManager(Installation.DataDir.FullName); instance = instance ?? this; }
public NetDataFile(string name, string host, int port, StreamerManager streamerManager = null) : base(name, streamerManager) { throw new NotImplementedException(); }