Exemple #1
0
		public static STIPriceTypes ToSterlingPriceType(this OrderTypes type, SterlingOrderCondition condition)
		{
			switch (type)
			{
				case OrderTypes.Limit:
					return STIPriceTypes.ptSTILmt;
				case OrderTypes.Market:
					return STIPriceTypes.ptSTIMkt;
				case OrderTypes.Conditional:
				{
					if (condition == null)
						throw new ArgumentNullException(nameof(condition));

					switch (condition.ExtendedOrderType)
					{
						case SterlingExtendedOrderTypes.MarketOnClose:
							return STIPriceTypes.ptSTIMktClo;
						case SterlingExtendedOrderTypes.MarketOrBetter:
							return STIPriceTypes.ptSTIMktOb;
						case SterlingExtendedOrderTypes.MarketNoWait:
							return STIPriceTypes.ptSTIMktWow;
						case SterlingExtendedOrderTypes.LimitOnClose:
							return STIPriceTypes.ptSTILmtClo;
						case SterlingExtendedOrderTypes.Stop:
							return STIPriceTypes.ptSTILmtStp;
						case SterlingExtendedOrderTypes.StopLimit:
							return STIPriceTypes.ptSTILmtStpLmt;
						case SterlingExtendedOrderTypes.LimitOrBetter:
							return STIPriceTypes.ptSTILmtOb;
						case SterlingExtendedOrderTypes.LimitNoWait:
							return STIPriceTypes.ptSTILmtWow;
						case SterlingExtendedOrderTypes.Nyse:
							return STIPriceTypes.ptSTIBas;
						case SterlingExtendedOrderTypes.Close:
							return STIPriceTypes.ptSTIClo;
						case SterlingExtendedOrderTypes.Pegged:
							return STIPriceTypes.ptSTIPegged;
						case SterlingExtendedOrderTypes.ServerStop:
							return STIPriceTypes.ptSTISvrStp;
						case SterlingExtendedOrderTypes.ServerStopLimit:
							return STIPriceTypes.ptSTISvrStpLmt;
						case SterlingExtendedOrderTypes.TrailingStop:
							return STIPriceTypes.ptSTITrailStp;
						case SterlingExtendedOrderTypes.NoWait:
							return STIPriceTypes.ptSTIWow;
						case SterlingExtendedOrderTypes.Last:
							return STIPriceTypes.ptSTILast;
						case null:
							throw new ArgumentException(LocalizedStrings.Str3803, nameof(condition));
						default:
							throw new ArgumentOutOfRangeException(nameof(condition), condition.ExtendedOrderType, LocalizedStrings.Str2500);
					}
				}
				default:
					throw new ArgumentOutOfRangeException(nameof(type));
			}
		}
Exemple #2
0
 internal SterlingOptionOrderCondition(SterlingOrderCondition condition)
 {
     _condition = condition;
 }
Exemple #3
0
        public static STIPriceTypes ToSterlingPriceType(this OrderTypes type, SterlingOrderCondition condition)
        {
            switch (type)
            {
            case OrderTypes.Limit:
                return(STIPriceTypes.ptSTILmt);

            case OrderTypes.Market:
                return(STIPriceTypes.ptSTIMkt);

            case OrderTypes.Conditional:
            {
                if (condition == null)
                {
                    throw new ArgumentNullException(nameof(condition));
                }

                switch (condition.ExtendedOrderType)
                {
                case SterlingExtendedOrderTypes.MarketOnClose:
                    return(STIPriceTypes.ptSTIMktClo);

                case SterlingExtendedOrderTypes.MarketOrBetter:
                    return(STIPriceTypes.ptSTIMktOb);

                case SterlingExtendedOrderTypes.MarketNoWait:
                    return(STIPriceTypes.ptSTIMktWow);

                case SterlingExtendedOrderTypes.LimitOnClose:
                    return(STIPriceTypes.ptSTILmtClo);

                case SterlingExtendedOrderTypes.Stop:
                    return(STIPriceTypes.ptSTILmtStp);

                case SterlingExtendedOrderTypes.StopLimit:
                    return(STIPriceTypes.ptSTILmtStpLmt);

                case SterlingExtendedOrderTypes.LimitOrBetter:
                    return(STIPriceTypes.ptSTILmtOb);

                case SterlingExtendedOrderTypes.LimitNoWait:
                    return(STIPriceTypes.ptSTILmtWow);

                case SterlingExtendedOrderTypes.Nyse:
                    return(STIPriceTypes.ptSTIBas);

                case SterlingExtendedOrderTypes.Close:
                    return(STIPriceTypes.ptSTIClo);

                case SterlingExtendedOrderTypes.Pegged:
                    return(STIPriceTypes.ptSTIPegged);

                case SterlingExtendedOrderTypes.ServerStop:
                    return(STIPriceTypes.ptSTISvrStp);

                case SterlingExtendedOrderTypes.ServerStopLimit:
                    return(STIPriceTypes.ptSTISvrStpLmt);

                case SterlingExtendedOrderTypes.TrailingStop:
                    return(STIPriceTypes.ptSTITrailStp);

                case SterlingExtendedOrderTypes.NoWait:
                    return(STIPriceTypes.ptSTIWow);

                case SterlingExtendedOrderTypes.Last:
                    return(STIPriceTypes.ptSTILast);

                case null:
                    throw new ArgumentException(LocalizedStrings.Str3803, nameof(condition));

                default:
                    throw new ArgumentOutOfRangeException(nameof(condition), condition.ExtendedOrderType, LocalizedStrings.Str2500);
                }
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(type));
            }
        }
			internal SterlingOptionOrderCondition(SterlingOrderCondition condition)
			{
				_condition = condition;
			}