Hi,
When I run your code to get prices for a month, it appears the mapping isn't quite right. You can see the code I'm using (per your instructions), and the results (screenshots below. What is returned is not what is in the json file from the api.
fun getMonthlyQuotesForSecurity(security: String): MutableList<StockUnit> {
var stocks = emptyList<StockUnit>()
return runBlocking {
run {
AlphaVantage.api()
.init(Config.builder()
.key(PriceProcesses.alphaVantageKey)
.timeOut(10)
.build())
AlphaVantage.api()
.timeSeries()
.monthly()
.forSymbol(security)
.onSuccess { r: TimeSeriesResponse ->
stocks = r.stockUnits
}
.onFailure { e: AlphaVantageException? ->
(PriceProcesses.logger.error { "There was an error with the API: => $e.localizedMessage" })
}
.fetch()
}
val deferredResult = async {
var counter: Long = 0
while (stocks.isEmpty() && counter < 10000) {
counter += 1000
delay(counter)
}
return@async stocks.toMutableList()
}
return@runBlocking deferredResult.await()
}
Hi, When I run your code to get prices for a month, it appears the mapping isn't quite right. You can see the code I'm using (per your instructions), and the results (screenshots below. What is returned is not what is in the json file from the api.