public FieldValue Copy() { var value_Renamed = new SequenceValue(sequence); for (int i = 0; i < elements.Count; i++) { value_Renamed.Add((GroupValue)elements[i].Copy()); } return(value_Renamed); }
private bool equals(SequenceValue other) { if (Length != other.Length) { return(false); } for (int i = 0; i < Length; i++) { if (!elements[i].Equals(other.elements[i])) { return(false); } } return(true); }
private bool equals(SequenceValue other) { if (Length != other.Length) { return false; } for (int i = 0; i < Length; i++) { if (!elements[i].Equals(other.elements[i])) { return false; } } return true; }
public FieldValue Copy() { var value_Renamed = new SequenceValue(sequence); for (int i = 0; i < elements.Count; i++) { value_Renamed.Add((GroupValue) elements[i].Copy()); } return value_Renamed; }
public void TestComplexMessage() { var template = new MessageTemplate("Company", new Field[] { new Scalar("Name", FASTType.STRING, Operator.NONE, ScalarValue.UNDEFINED, false), new Scalar("Id", FASTType.U32, Operator.INCREMENT, ScalarValue.UNDEFINED, false), new Sequence("Employees", new Field[] { new Scalar("First Name", FASTType.STRING, Operator.COPY, ScalarValue.UNDEFINED, false), new Scalar("Last Name", FASTType.STRING, Operator.COPY, ScalarValue.UNDEFINED, false), new Scalar("Age", FASTType.U32, Operator.DELTA, ScalarValue.UNDEFINED, false) }, false), new Group("Tax Information", new Field[] { new Scalar("EIN", FASTType.STRING, Operator.NONE, ScalarValue.UNDEFINED, false) }, false) }); var aaaInsurance = new Message(template); aaaInsurance.SetFieldValue(1, new StringValue("AAA Insurance")); aaaInsurance.SetFieldValue(2, new IntegerValue(5)); var employees = new SequenceValue(template.GetSequence( "Employees")); employees.Add(new FieldValue[] { new StringValue("John"), new StringValue("Doe"), new IntegerValue(45) }); employees.Add(new FieldValue[] { new StringValue("Jane"), new StringValue("Doe"), new IntegerValue(48) }); aaaInsurance.SetFieldValue(3, employees); aaaInsurance.SetFieldValue(4, new GroupValue(template.GetGroup("Tax Information"), new FieldValue[] { new StringValue("99-99999999") })); var outStream = new MemoryStream(); var output = new MessageOutputStream(outStream); output.RegisterTemplate(1, template); output.WriteMessage(aaaInsurance); var abcBuilding = new Message(template); abcBuilding.SetFieldValue(1, new StringValue("ABC Building")); abcBuilding.SetFieldValue(2, new IntegerValue(6)); employees = new SequenceValue(template.GetSequence("Employees")); employees.Add(new FieldValue[] { new StringValue("Bob"), new StringValue("Builder"), new IntegerValue(3) }); employees.Add(new FieldValue[] { new StringValue("Joe"), new StringValue("Rock"), new IntegerValue(59) }); abcBuilding.SetFieldValue(3, employees); abcBuilding.SetFieldValue(4, new GroupValue(template.GetGroup("Tax Information"), new FieldValue[] { new StringValue("99-99999999") })); output.WriteMessage(abcBuilding); var input = new MessageInputStream(new MemoryStream( outStream.ToArray())); input.RegisterTemplate(1, template); GroupValue message = input.ReadMessage(); Assert.AreEqual(aaaInsurance, message); message = input.ReadMessage(); Assert.AreEqual(abcBuilding, message); }
public void TestMultipleMessages() { var outStream = new MemoryStream(); var output = new MessageOutputStream(outStream); output.RegisterTemplate(ObjectMother.ALLOC_INSTRCTN_TEMPLATE_ID, ObjectMother.AllocationInstruction()); var allocations = new SequenceValue(ObjectMother.AllocationInstruction() .GetSequence("Allocations")); allocations.Add(ObjectMother.NewAllocation("fortyFiveFund", 22.5, 75.0)); allocations.Add(ObjectMother.NewAllocation("fortyFund", 24.6, 25.0)); Message ai1 = ObjectMother.NewAllocInstrctn("ltg0001", 1, 100.0, 23.4, ObjectMother.NewInstrument("CTYA", "200910"), allocations); allocations = new SequenceValue(ObjectMother.AllocationInstruction() .GetSequence("Allocations")); allocations.Add(ObjectMother.NewAllocation("fortyFiveFund", 22.5, 75.0)); allocations.Add(ObjectMother.NewAllocation("fortyFund", 24.6, 25.0)); Message ai2 = ObjectMother.NewAllocInstrctn("ltg0001", 1, 100.0, 23.4, ObjectMother.NewInstrument("CTYA", "200910"), allocations); allocations = new SequenceValue(ObjectMother.AllocationInstruction() .GetSequence("Allocations")); allocations.Add(ObjectMother.NewAllocation("fortyFiveFund", 22.5, 75.0)); allocations.Add(ObjectMother.NewAllocation("fortyFund", 24.6, 25.0)); Message ai3 = ObjectMother.NewAllocInstrctn("ltg0001", 1, 100.0, 23.4, ObjectMother.NewInstrument("CTYA", "200910"), allocations); output.WriteMessage(ai1); output.WriteMessage(ai2); output.WriteMessage(ai3); byte[] bytes = outStream.ToArray(); var input = new MessageInputStream(new MemoryStream( bytes)); input.RegisterTemplate(ObjectMother.ALLOC_INSTRCTN_TEMPLATE_ID, ObjectMother.AllocationInstruction()); Message message = input.ReadMessage(); Assert.AreEqual(ai1, message); message = input.ReadMessage(); Assert.AreEqual(ai2, message); Assert.AreEqual(ai3, input.ReadMessage()); }
private static SequenceValue BasicAllocations() { var value = new SequenceValue(AllocationInstruction().GetSequence("Allocations")); value.Add(NewAllocation("general", 101.0, 15.0)); value.Add(NewAllocation("specific", 103.0, 10.0)); return value; }
public static Message NewAllocInstrctn(String id, int side, double quantity, double averagePrice, GroupValue instrument, SequenceValue allocations) { var allocInstrctn = new Message(AllocationInstruction()); allocInstrctn.SetFieldValue(1, allocations); allocInstrctn.SetFieldValue(2, instrument); allocInstrctn.SetFieldValue(3, new StringValue(id)); allocInstrctn.SetFieldValue(4, new IntegerValue(side)); allocInstrctn.SetFieldValue(5, new DecimalValue(quantity)); allocInstrctn.SetFieldValue(6, new DecimalValue(averagePrice)); return allocInstrctn; }