Exemplo n.º 1
0
        private void SendContractDetailsRequest(string symbol)
        {
            var contract = new Contract
            {
                Symbol         = symbol,
                SecurityType   = TWSUtils.SecurityTypeConverter(SelectedType),
                Exchange       = SelectedExchange == "All" ? "" : SelectedExchange,
                IncludeExpired = IncludeExpired
            };

            if (ExpirationDate.HasValue)
            {
                contract.Expiry = ExpirationDate.Value.ToString("yyyyMM");
            }

            if (!string.IsNullOrEmpty(Strike))
            {
                double strike;
                bool   success = double.TryParse(Strike, out strike);
                if (success)
                {
                    contract.Strike = strike;
                }
            }

            if (!string.IsNullOrEmpty(Currency))
            {
                contract.Currency = Currency;
            }
            SearchUnderway = true; //disables the search commands
            _client.RequestContractDetails(_nextRequestID, contract);
        }
Exemplo n.º 2
0
        private void SendContractDetailsRequest(string symbol)
        {
            var contract = new Contract
            {
                Symbol         = symbol,
                SecurityType   = TWSUtils.SecurityTypeConverter(SelectedType),
                Exchange       = SelectedExchange == "All" ? "" : SelectedExchange,
                IncludeExpired = IncludeExpired,
                Currency       = Currency
            };

            if (ExpirationDate.HasValue)
            {
                contract.Expiry = ExpirationDate.Value.ToString("yyyyMM");
            }

            if (Strike.HasValue)
            {
                contract.Strike = Strike.Value;
            }

            SearchUnderway = true; //disables the search commands
            _client.RequestContractDetails(_nextRequestID, contract);
        }