예제 #1
0
        /// <summary>
        /// create a new IEXCloudClient
        /// </summary>
        /// <param name="publishableToken">publishable token</param>
        /// <param name="secretToken">secret token (only used for SCALE and GROW users)</param>
        /// <param name="signRequest">only SCALE and GROW users should set this to true</param>
        /// <param name="useSandBox">whether or not to use the sandbox endpoint</param>
        /// <param name="version">whether to use stable or beta endpoint</param>
        /// <param name="retryPolicy">which backoff policy to use - applies only REST calls (not SSE)</param>
        public IEXCloudClient(string publishableToken, string secretToken, bool signRequest, bool useSandBox,
                              APIVersion version = APIVersion.stable, RetryPolicy retryPolicy = RetryPolicy.Exponential)
        {
            if (string.IsNullOrWhiteSpace(publishableToken))
            {
                throw new ArgumentException("publishableToken cannot be null");
            }

            this.publishableToken = publishableToken;
            this.secretToken      = secretToken;
            this.signRequest      = signRequest;

            var baseAddress = useSandBox
                                ? "https://sandbox.iexapis.com/"
                                : "https://cloud.iexapis.com/";

            baseAddress += version.ToString() + "/";
            baseSSEURL   = useSandBox
                                ? "https://sandbox-sse.iexapis.com/"
                                : "https://cloud-sse.iexapis.com/";
            baseSSEURL += version.ToString() + "/";
            client      = new HttpClient
            {
                BaseAddress = new Uri(baseAddress)
            };
            client.DefaultRequestHeaders.Add("User-Agent", "VSLee.IEXSharp IEX Cloud .Net");

            executor = new ExecutorREST(client, publishableToken, secretToken,
                                        signRequest, retryPolicy);
            executorSSE = new ExecutorSSE(baseSSEURL, publishableToken, secretToken);
        }
예제 #2
0
 internal SocialSentimentService(ExecutorREST executor, ExecutorSSE executorSSE)
 {
     this.executor    = executor;
     this.executorSSE = executorSSE;
 }
예제 #3
0
 internal StockPricesService(ExecutorREST executor, ExecutorSSE executorSSE)
 {
     this.executor    = executor;
     this.executorSSE = executorSSE;
 }
예제 #4
0
 internal NewsService(ExecutorREST executor, ExecutorSSE executorSSE)
 {
     this.executor    = executor;
     this.executorSSE = executorSSE;
 }
 internal InvestorsExchangeDataService(ExecutorREST executor, ExecutorSSE executorSSE)
 {
     this.executor    = executor;
     this.executorSSE = executorSSE;
 }
예제 #6
0
 public CryptoService(ExecutorREST executor, ExecutorSSE executorSSE)
 {
     this.executor    = executor;
     this.executorSSE = executorSSE;
 }
예제 #7
0
 public SSEService(string baseSSEURL, string sk, string pk)
 {
     this.pk     = pk;
     executorSSE = new ExecutorSSE(baseSSEURL: baseSSEURL, sk: sk, pk: pk);
 }