Skip to content

Ticker/Symbol Search

Synchronous Fetch

Alphavantage.api()
  .search()
  .keywords("tesla")
  .onSuccess(response -> onData(response.getBestMatches()))
  .fetch();
Alphavantage.api()
    .search()
    .keywords("tesla")
    .onSuccess { response -> onData(response.bestMatches) }
    .fetch()

Asynchronous Fetch

SearchResponse response = Alphavantage.api()
  .search()
  .keywords("tesla")
  .fetchSync();
val response = Alphavantage.api()
    .search()
    .keywords("tesla")
    .fetchSync()

Response SearchResponse

public void onData(List<Match> matches){
    matches.forEach(match -> {
        System.out.println(match.getSymbol());
        System.out.println(match.getName());
        System.out.println(match.getType());
        System.out.println(match.getRegion());
        System.out.println(match.getMarketOpen());
        System.out.println(match.getMarketClose());
        System.out.println(match.getTimezone());
        System.out.println(match.getCurrency());
        System.out.println(match.getMatchScore());
    });
}
fun onData(matches: List<Match>) {
    matches.forEach { match ->
        println(match.symbol)
        println(match.name)
        println(match.type)
        println(match.region)
        println(match.marketOpen)
        println(match.marketClose)
        println(match.timezone)
        println(match.currency)
        println(match.matchScore)
    }
}