void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is InstrumentTicket) { m_InstrumentTickets.Add((InstrumentTicket)subElement); } }
public void AddSubElement(IStringifiable subElement) { if (subElement is TaskEventArg) { this.AddNewTask((TaskEventArg)subElement); } }
public void AddSubElement(IStringifiable subElement) { if (subElement is Fill) { m_FillsOpen.Add((Fill)subElement); } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is ParameterInfo) { this.ParameterList.Add((ParameterInfo)subElement); } }
//public new void SetAttributes(Dictionary<string, string> attributes, ref Dictionary<string, string> unusedAttributes) public new void AddSubElement(IStringifiable subElement) { Type type = subElement.GetType(); if (type == typeof(RejectedFills.RecentKeyList)) { m_RecentKeys = (RejectedFills.RecentKeyList)subElement; } else if (type == typeof(RejectedFills.RejectedFillEventArgs)) { RejectedFills.RejectedFillEventArgs reject = (RejectedFills.RejectedFillEventArgs)subElement; bool isDuplicate = false; int n = 0; while ((!isDuplicate) && (n < m_RejectedFills.Count)) { isDuplicate = reject.OriginalFillEventArg.IsSameAs(m_RejectedFills[n].OriginalFillEventArg); n++; } if (!isDuplicate) { reject.Name = this.Name;// Temp- to add information m_RejectedFills.Add(reject); } } else { base.AddSubElement(subElement); } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is EngineGui) { m_Engines.Add((EngineGui)subElement); } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is CurveDefinition) { this.CurveDefinitions.Add((CurveDefinition)subElement); } }
}// TryGetType() // // #endregion // TryGetType() #region Convert Node -> IStringifiable Object // // // ************************************************* // **** Create() **** // ************************************************* /// <summary> /// This is the new March 2013 approach. It converts a node into a IStringifiable object. /// Nodes are created by the StringifiableReader object. /// </summary> /// <param name="node">a node to Create</param> /// <returns>the newly created object</returns> public static IStringifiable Create(Node node) { IStringifiable newObject = null; Type t; if (TryGetType(node.Name, out t)) { IStringifiable obj = Activator.CreateInstance(t) as IStringifiable; obj.SetAttributes(node.Attributes); // sub elements foreach (IStringifiable subNode in node.SubElements) { if (subNode is Node) { IStringifiable subIStringifiable = Create((Node)subNode); obj.AddSubElement(subIStringifiable); } else { obj.AddSubElement(subNode); } } newObject = obj; } else { return(null); } return(newObject); }// Create()
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is Fill) { this.Fills.Add((Fill)subElement); } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is ZGraphPoint) { Points.Add((ZGraphPoint)subElement); } }
}// Start() // // // // ********************************************************* // **** Enqueue() **** // ********************************************************* /// <summary> /// Dropping snapshots of the fillHub or fills. /// </summary> public void Enqueue(IStringifiable iStringfiableObject) { string s = Stringifiable.Stringify(iStringfiableObject, m_StringifyOverrideTable); m_ArcBookWriter.RequestEnqueue(s); m_LocalTimeLast = m_FillHub.Log.GetTime(); // save time stamp of this latest entry. }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is ForeignConnection) { m_ForeignConnections.Add((ForeignConnection)subElement); } }
public void AddSubElement(IStringifiable subElement) { if (subElement is DatabaseInfo) { m_DataBaseInfo = (DatabaseInfo)subElement; } }
public override void AddSubElement(IStringifiable subElement) { base.AddSubElement(subElement); if (subElement is PriceLeg) { m_Legs.Add((PriceLeg)subElement); } }
public void AddSubElement(IStringifiable subElement) { if (subElement is UVSpreaderLeg) {// find all legs we are trying to use to create our spreader UVSpreaderLeg spreadLeg = (UVSpreaderLeg)subElement; m_UVSpreaderLegs.Add((UVSpreaderLeg)subElement); } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (this.Data == null) { Data = new List <IStringifiable>(); } this.Data.Add(subElement); }
public void AddSubElement(IStringifiable subElement) { Type type = subElement.GetType(); if (type == typeof(FillEventArgs)) { this.OriginalFillEventArg = (FillEventArgs)subElement; } }
public override void AddSubElement(IStringifiable subElement) { base.AddSubElement(subElement); if (subElement is CurveTrader) { // find all curve traders CurveTrader curveTrader = (CurveTrader)subElement; m_CurveTraders.Add(curveTrader); } }
public void AddSubElement(IStringifiable subElement) { if (subElement is IntegerArray) { IntegerArray a = (IntegerArray)subElement; if (a.Name.Equals("A")) { this.DataIntA = a.Data; } else if (a.Name.Equals("B")) { this.DataIntB = a.Data; } else if (a.Name.Equals("C")) { this.DataIntC = a.Data; } } else if (subElement is DoubleArray) { DoubleArray a = (DoubleArray)subElement; if (a.Name.Equals("A")) { this.DataA = a.Data; } else if (a.Name.Equals("B")) { this.DataB = a.Data; } else if (a.Name.Equals("C")) { this.DataC = a.Data; } } else if (subElement is ObjectString) { if (this.DataObjectList == null) { this.DataObjectList = new List <object>(); } ObjectString obj = (ObjectString)subElement; Type type; if (Stringifiable.TryGetType(obj.ClassName, out type)) { object o = UV.Lib.Utilities.ConvertType.ChangeType(type, obj.Data); this.DataObjectList.Add(o); } } else if (subElement is IStringifiable) // todo storage of values { if (this.DataObjectList == null) { this.DataObjectList = new List <object>(); } this.DataObjectList.Add(subElement); } }
public override void AddSubElement(IStringifiable subElement) { base.AddSubElement(subElement); Type elementType = subElement.GetType(); if (elementType == typeof(TradingNode)) { TradingNode tradingNode = (TradingNode)subElement; if (tradingNode.TradeLevel == 0) { switch (tradingNode.TradeSide) { case TradeSide.Unknown: break; case TradeSide.Buy: m_EntryLongNode = tradingNode; break; case TradeSide.Sell: m_EntryShortNode = tradingNode; break; } } if (tradingNode.TradeLevel == 1) { switch (tradingNode.TradeSide) { case TradeSide.Unknown: break; case TradeSide.Buy: m_FadeLongNode = tradingNode; break; case TradeSide.Sell: m_FadeShortNode = tradingNode; break; } } } if (elementType == typeof(KeltnerTradingVariables)) { KeltnerTradingVariables = (KeltnerTradingVariables)subElement; m_EntryQty = KeltnerTradingVariables.EntryQty; m_FadeQty = KeltnerTradingVariables.FadeQty; m_EntryWidth = KeltnerTradingVariables.EntryWidth; m_FadeWidth = KeltnerTradingVariables.FadeWidth; m_PukeWidth = KeltnerTradingVariables.PukeWidth; m_EMALength = KeltnerTradingVariables.EMALength; m_ATRLength = KeltnerTradingVariables.ATRLength; m_MOMLength = KeltnerTradingVariables.MomentumLength; m_MomentumEntry = KeltnerTradingVariables.MomentumEntryValue; m_MomentumPuke = KeltnerTradingVariables.MomentumPukeValue; } }
void IStringifiable.AddSubElement(IStringifiable subElement) { base.AddSubElement(subElement); if (subElement is HedgeRule) { HedgeRule HedgeRule = (HedgeRule)subElement; HedgeRule.HedgeRuleManager = this; m_HedgeRules.Add(HedgeRule); // add now we will sort later! } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is Engine) { // Add new Engine Engine engine = (Engine)subElement; TryAddEngine(engine, null); //int nId = m_Engines.Count; //m_Engines.Add(engine); } }
public virtual void AddSubElement(IStringifiable subElement) { Type elementType = subElement.GetType(); if (elementType == typeof(TradingNode)) { TradingNode tradingNode = (TradingNode)subElement; this.TryAddTradingNode(tradingNode); } }
// // #endregion//Constructors #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** // // // ******************************************************************* // **** Read To End() **** // ******************************************************************* /// <summary> /// Returns list of IStringifiable objects created from the entire XML file. /// </summary> /// <param name="createNode"></param> /// <returns></returns> public List <IStringifiable> ReadToEnd(bool createNode = false) { List <IStringifiable> newObjectList = new List <IStringifiable>(); IStringifiable nextObject = null; while (TryReadNext(out nextObject, createNode)) { newObjectList.Add(nextObject); } return(newObjectList); } // ReadToEnd()
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is AlertUser) { AlertUser newAlertUser = (AlertUser)subElement; if (!m_AlertUsers.Contains(newAlertUser)) { m_AlertUsers.Add(newAlertUser); } } }
} // DropFillBooks() // // // // // ********************************************************* // **** TryLoadBooks() **** // ********************************************************* public bool TryLoadBooks() { List <IStringifiable> nodeList = ReadLocalFillBook(); string fillHubTypeName = m_FillHub.GetType().FullName; // Now convert these nodes into real objects. List <IStringifiable> objectList = new List <IStringifiable>(); foreach (IStringifiable iNode in nodeList) { Node node = (Node)iNode; if (node.Name.Equals(fillHubTypeName)) { // We need to take the sub elements of the FillHub, and pull them out. Dictionary <string, string> unused = new Dictionary <string, string>(); ((IStringifiable)m_FillHub).SetAttributes(node.Attributes, ref unused); foreach (IStringifiable subElem in node.SubElements) { IStringifiable obj = Stringifiable.DeStringify((Node)subElem); objectList.Add(obj); } } else { // These are fill events and other things. IStringifiable obj = Stringifiable.DeStringify((Node)iNode); objectList.Add(obj); } } // if (objectList != null && objectList.Count > 0) { foreach (IStringifiable obj in objectList) // load all InstrumentMapEntries first - needed to create books { if (obj is InstrumentMapEntry) { ((IStringifiable)m_FillHub).AddSubElement(obj); } } foreach (IStringifiable obj in objectList) // load everything else now. { if (!(obj is InstrumentMapEntry)) { ((IStringifiable)m_FillHub).AddSubElement(obj); } } return(true); } else { return(false); } }// TryLoadBooks()
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is PriceLeg) { if (m_PriceLeg == null) { m_PriceLeg = ((PriceLeg)subElement); } else { throw new Exception("Implemented Order Engine can only handle 1 leg, however more than 1 has been assigned"); } } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is IOrderEngine) { // This is my primary order engine. // Perhaps there should be only one of these. Here is where I send // order requests. IOrderEngine = (IOrderEngine)subElement; } if (subElement is Engine) { // Here we store all engines (including order engine). Engine engine = (Engine)subElement; EngineList.Add(engine.EngineID, engine); } }
public void AddSubElement(IStringifiable subElement) { if (subElement is TaskEventArg) { this.TryToAddChild((TaskEventArg)subElement); } else { if (this.InData == null) { this.InData = new List <object>(); } this.InData.Add(subElement); } }
void IStringifiable.AddSubElement(IStringifiable subElement) { if (subElement is PriceLeg) { m_Legs.Add((PriceLeg)subElement); } else if (subElement is TradePage) { TradePage page = (TradePage)subElement; if (page.PageType == TradePageType.Entry) { this.Entry.Add(page.InstrumentName, page); } } }