public void TestMapping() { var fsm = new FuturesSymbolMapper(); const string platform = "TEST"; const string bloombergRoot = "SF"; const string platformReceiveRoot = "6S"; const string platformSendRoot = "SFSS"; // Setup our test data fsm.AddBloombergMapping(platform, bloombergRoot, platformReceiveRoot, platformSendRoot, 10); var mappedBloomberg = fsm.ConvertPlatformReceiving(platform, platformReceiveRoot, false); Assert.AreEqual(mappedBloomberg, bloombergRoot); var ricRoot = fsm.LookupPlatformSendingRoot(platform, bloombergRoot, false); Assert.AreEqual(ricRoot, platformSendRoot); var mappedPlatform = fsm.LookupPlatformRoot(platform, bloombergRoot, false); Assert.AreEqual(mappedPlatform, platformReceiveRoot); var toBloomberg = fsm.LookupToBloombergPriceMultiplier(platform, bloombergRoot); Assert.AreEqual(toBloomberg, 10); var toPlatform = fsm.LookupToPlatformPriceMultiplier(platform, bloombergRoot); Assert.AreEqual(toPlatform, decimal.One / 10); // Test logic for converting exchange to bloomberg pricing and vice versa // multiply by 10 var bbPrice = (decimal)0.7268 * toBloomberg; Assert.AreEqual(bbPrice, 7.268); // multiply by 1/10 var platformPrice = (decimal)72.68 * toPlatform; Assert.AreEqual(platformPrice, 7.268); var bbSymbol = fsm.MapPlatformRootToBloombergSymbol(platform, platformReceiveRoot, "200906"); Assert.AreEqual(bbSymbol, "SFM9"); // Do the RIC to Bloomberg mapping // We are using TRADS for the platform to cheat, ensure we have it fsm.AddBloombergMapping("TRADS", bloombergRoot, platformReceiveRoot, platformSendRoot, 10); var sfRoot = fsm.ConvertRicRoot("SFSS"); Assert.AreEqual("SF", sfRoot); var fredRoot = fsm.ConvertRicRoot("1FRED"); Assert.IsNull(fredRoot); }
public void TestProcessOrderEvent() { var fsm = new FuturesSymbolMapper(); // Setup our test data fsm.AddBloombergMapping("TRADS", "TY", "TY", "ZN", 1); var positionManager = new TradingScreenPositionManager(fsm); var fileOrders = MessageUtilTest.LoadTestOrders(); var confirmed = false; positionManager.ReceiveOrders("Multiple", fileOrders, 1, ref confirmed); var orderEventIds = positionManager.OrderEventIds; Assert.IsNotNull(orderEventIds); Assert.Contains(1, (ICollection)orderEventIds); var positions = positionManager.Positions; Assert.IsNotNull(positions); Assert.AreEqual(5, positions.Count); // ensure the RIC are converted correctly var tym0Position = FindPosition("TYM0", positions); Assert.IsNotNull(tym0Position); }