Пример #1
0
        public static bool InstrumentTypeToSecurityType(OQ.InstrumentType instrType, out IB.SecurityType secType)
        {
            secType = SecurityType.Undefined;
            switch (instrType)
            {
            case InstrumentType.Bond:
                secType = SecurityType.Bond;
                break;

            case InstrumentType.ETF:
                secType = SecurityType.Stock;
                break;

            case InstrumentType.FX:
                secType = SecurityType.Cash;
                break;

            case InstrumentType.FutOpt:
                secType = SecurityType.FutureOption;
                break;

            case InstrumentType.Futures:
                secType = SecurityType.Future;
                break;

            case InstrumentType.Index:
                secType = SecurityType.Index;
                break;

            case InstrumentType.Option:
                secType = SecurityType.Option;
                break;

            case InstrumentType.Stock:
                secType = SecurityType.Stock;
                break;

            case InstrumentType.MultiLeg:
            default:
                return(false);
            }
            return(true);
        }
Пример #2
0
            public static string Convert(OpenQuant.API.InstrumentType value)
            {
                switch (value)
                {
                case OpenQuant.API.InstrumentType.Stock:
                    return("CS");

                case OpenQuant.API.InstrumentType.Futures:
                    return("FUT");

                case OpenQuant.API.InstrumentType.Option:
                    return("OPT");

                case OpenQuant.API.InstrumentType.FutOpt:
                    return("FOP");

                case OpenQuant.API.InstrumentType.Bond:
                    return("TBOND");

                case OpenQuant.API.InstrumentType.Index:
                    return("IDX");

                case OpenQuant.API.InstrumentType.ETF:
                    return("ETF");

                case OpenQuant.API.InstrumentType.FX:
                    return("FOR");

                case OpenQuant.API.InstrumentType.MultiLeg:
                    return("MLEG");

                case OpenQuant.API.InstrumentType.Commodity:
                    return("CMDTY");

                default:
                    throw new ArgumentException(string.Format("Unknown InstrumentType - {0}", value));
                }
            }