コード例 #1
0
        /// <summary>
        /// Request detail data for one security that is not option.
        /// The same like "RequestContinousContractData" but for 1 security.
        /// </summary>
        public async void RequestSecurityContractDetails(SecurityData securityData)
        {
            ContractBase contractBase = securityData.GetContract();

            if (contractBase.SecurityType == SecurityType.Option)
            {
                throw new Exception("This method is for securities other than options!!!");
            }

            Contract ibContract = contractBase.ToIbContract();

            _handler.AddManagedSecurity(ibContract);
            Logger.Info($"{nameof(RequestSecurityContractDetails)} " +
                        $"called, requesting {ibContract}");
            int reqId = GenerateRequestId();

            _clientSocket.reqContractDetails(reqId, ibContract);
            var contracts = await _handler.WaitForContractDetails(reqId);

            contracts.ForEach(RequestMarketData);
        }