public ExpirationDate(DateTime date, OptionExpirationTime time, string root) { Date = date; Time = time; RootSymbol = root; }
private double[] GetStrikes(string token, string underlyingSymbol, DateTime expiration, OptionExpirationTime time) { string expiryString = expiration.ToString("yyyy-MM-dd"); //string address = string.Format("Chains/GetStrikes?underlyingSymbol={0}&expiration={1}&time={2}", underlyingSymbol, expiryString, time); string address = string.Format("Chains/GetStrikes?underlyingSymbol={0}&expiration={1}", underlyingSymbol, expiryString); string resultString; using (var client = CreateClient(token)) { resultString = client.DownloadString(address); } ResponseContainer <double[]> response = JsonConvert.DeserializeObject <ResponseContainer <double[]> >(resultString); if (response.ResponseCode == (int)enumResponseCode.Success) { Console.WriteLine(string.Format("Received {0} strikes for underlyingSymbol {1} with expiration {2}", response.Payload.Length, underlyingSymbol, expiryString)); } else { Console.WriteLine(string.Format("Failed to receive strikes for underlyingSymbol {0} with expiration {1}. Code: {2}", response.ResponseCode, expiryString, response.ResponseCode)); } return(response.Payload); }