Пример #1
0
        public void OrderTypeToOrderType_LimitTest()
        {
            IB.OrderType ibordertype = IB.OrderType.Limit;
            OQ.OrderType oqordertype;
            bool         result = Helpers.OrderTypeToOrderType(ibordertype, out oqordertype);

            Assert.IsTrue(result);
            Assert.AreEqual(OQ.OrderType.Limit, oqordertype);
        }
Пример #2
0
        public static bool OrderTypeToOrderType(IB.OrderType ibordertype, out OQ.OrderType oqordertype)
        {
            oqordertype = OQ.OrderType.Market;
            switch (ibordertype)
            {
            case IB.OrderType.Limit:
            case IB.OrderType.LimitOnClose:
                oqordertype = OQ.OrderType.Limit;
                break;

            case IB.OrderType.Market:
                oqordertype = OQ.OrderType.Market;
                break;

            case IB.OrderType.MarketOnClose:
                oqordertype = OQ.OrderType.MarketOnClose;
                break;

            case IB.OrderType.Stop:
                oqordertype = OQ.OrderType.Stop;
                break;

            case IB.OrderType.StopLimit:
                oqordertype = OQ.OrderType.StopLimit;
                break;

            case IB.OrderType.TrailingStop:
                oqordertype = OQ.OrderType.Trail;
                break;

            case IB.OrderType.TrailingStopLimit:
                oqordertype = OQ.OrderType.TrailLimit;
                break;

            default:
            case IB.OrderType.Volatility:
            case IB.OrderType.VolumeWeightedAveragePrice:
            case IB.OrderType.Scale:
            case IB.OrderType.Relative:
            case IB.OrderType.PeggedToMarket:
            case IB.OrderType.Default:
            case IB.OrderType.Empty:
                return(false);
            }
            return(true);
        }
Пример #3
0
        public static bool OQOrderTypeToIBOrderType(OQ.OrderType oqtype, out IB.OrderType ibtype)
        {
            ibtype = IB.OrderType.Empty;
            switch (oqtype)
            {
            case OQ.OrderType.Limit:
                ibtype = IB.OrderType.Limit;
                break;

            case OQ.OrderType.Market:
                ibtype = IB.OrderType.Market;
                break;

            case OQ.OrderType.MarketOnClose:
                ibtype = IB.OrderType.MarketOnClose;
                break;

            case OQ.OrderType.Stop:
                ibtype = IB.OrderType.Stop;
                break;

            case OQ.OrderType.StopLimit:
                ibtype = IB.OrderType.StopLimit;
                break;

            case OQ.OrderType.Trail:
                ibtype = IB.OrderType.TrailingStop;
                break;

            case OQ.OrderType.TrailLimit:
                ibtype = IB.OrderType.TrailingStopLimit;
                break;

            default:
                return(false);
            }
            return(true);
        }