/// <summary> /// Modifies the quantity received from IB based on the security type /// </summary> public static int AdjustQuantity(SecurityType type, int size) { switch (type) { case SecurityType.Equity: return size * 100; default: return size; } }
/// <summary> /// Maps SecurityType enum /// </summary> private static string ConvertSecurityType(SecurityType type) { switch (type) { case SecurityType.Equity: return IB.SecurityType.Stock; case SecurityType.Option: return IB.SecurityType.Option; case SecurityType.Commodity: return IB.SecurityType.Commodity; case SecurityType.Forex: return IB.SecurityType.Cash; case SecurityType.Future: return IB.SecurityType.Future; case SecurityType.Base: throw new ArgumentException("InteractiveBrokers does not support SecurityType.Base"); default: throw new InvalidEnumArgumentException("type", (int)type, typeof(SecurityType)); } }