0

I want to use this library AlphaVantage.NET. I've tried the demo

string apiKey = "1"; // enter your API key here

var client = new AlphaVantageStocksClient(apiKey);

// retrieve daily time series for stocks of Apple Inc.:
StockTimeSeries timeSeries = await client.RequestDailyTimeSeriesAsync("AAPL", TimeSeriesSize.Compact, adjusted: false);
foreach (var dataPoint in timeSeries.DataPoints)
{
    Console.WriteLine($"{dataPoint.Time}: {dataPoint.ClosingPrice}");
}

// retrieve stocks batch quotes for Apple Inc. and Facebook Inc.:
ICollection<StockQuote> batchQuotes = await client.RequestBatchQuotesAsync(new[] { "AAPL", "FB" });
foreach (var stockQuote in batchQuotes)
{
    Console.WriteLine($"{stockQuote.Symbol}: {stockQuote.Price}");
}

But...is there any option to add a Proxy like in Using-WebClient? For example:

using (WebClient wc = new WebClient())
{
    IWebProxy proxy = WebRequest.GetSystemWebProxy();
    proxy.Credentials = CredentialCache.DefaultCredentials;

    wc.Proxy = proxy;
    var json = wc.DownloadString(@"https://www.alphavantage.co/query?function=TIME_SERIES_WEEKLY&symbol=BLDP&apikey=#############");
}

Sorry for my bad english :/

4

1 回答 1

1

不幸的是没有。

查看库的源代码,无法拦截/注入正在使用的底层 http 客户端。客户端对库是私有的,并在此处作为核心项目中的静态更新:https://github.com/LutsenkoKirill/AlphaVantage.Net/blob/master/AlphaVantage.Net/src/AlphaVantage.Net。核心/AlphaVantageCoreClient.cs#L24

于 2020-01-02T11:33:19.813 回答