public override void EndElement(string endElement) { if (this.PositionEventListener == null || !"position".Equals(endElement)) { return; } long longValue1; this.TryGetValue("accountId", out longValue1); long longValue2; this.TryGetValue("instrumentId", out longValue2); Decimal dec1; this.TryGetValue("openQuantity", out dec1); Decimal dec2; this.TryGetValue("openCost", out dec2); Decimal dec3; this.TryGetValue("cumulativeCost", out dec3); PositionBuilder positionBuilder = new PositionBuilder(); positionBuilder.AccountId(longValue1).InstrumentId(longValue2).OpenQuantity(dec1).OpenCost(dec2).CumulativeCost(dec3); Decimal dec4; if (this.TryGetValue("shortUnfilledCost", out dec4)) { positionBuilder.ShortUnfilledCost(dec4); } else { positionBuilder.ShortUnfilledCost(new Decimal(0)); } Decimal dec5; if (this.TryGetValue("longUnfilledCost", out dec5)) { positionBuilder.LongUnfilledCost(dec5); } else { positionBuilder.LongUnfilledCost(new Decimal(0)); } this.PositionEventListener(positionBuilder.NewInstance()); }
public override void EndElement(string endElement) { if (PositionEventListener != null && RootNode.Equals(endElement)) { long accountId; long instrumentId; decimal shortUnfilledCost; decimal longUnfilledCost; decimal openQuantity; decimal openCost; decimal cumulativeCost; TryGetValue(AccountId, out accountId); TryGetValue(InstrumentId, out instrumentId); TryGetValue(OpenQuantity, out openQuantity); TryGetValue(OpenCost, out openCost); TryGetValue(CumulativeCost, out cumulativeCost); PositionBuilder positionBuilder = new PositionBuilder(); positionBuilder.AccountId(accountId).InstrumentId(instrumentId).OpenQuantity(openQuantity).OpenCost(openCost).CumulativeCost(cumulativeCost); if (TryGetValue(ShortUnfilledCost, out shortUnfilledCost)) { positionBuilder.ShortUnfilledCost(shortUnfilledCost); } else { positionBuilder.ShortUnfilledCost(0); } if (TryGetValue(LongUnfilledCost, out longUnfilledCost)) { positionBuilder.LongUnfilledCost(longUnfilledCost); } else { positionBuilder.LongUnfilledCost(0); } PositionEventListener(positionBuilder.NewInstance()); } }