See how to use the client in your project here
- getQuote
- getFuturesOptions
- getShortDatedFuturesOptions
- getProfile
- getFinancialHighlights
- getFinancialRatios
- getIncomeStatements
- getBalanceSheets
- getCompetitors
- getInsiders
- getRatings
- getIndexMembers
- getCorporateActions
- getEarningsEstimates
- getLeaders
- getHighsLows
- getInstrumentDefinition
- getFuturesSpecifications
- getFuturesExpirations
- getWeather
private final BarchartOnDemandClient onDemand = new BarchartOnDemandClient.Builder().apiKey("CHANGE-ME").build();
/* build a new getQuotes request */
final QuoteRequest.Builder builder = new QuoteRequest.Builder();
/* add symbols to request */
builder.symbols(new String[] { "AAPL", "GOOG" });
/* set mode to real-time */
builder.mode(QuoteRequestMode.REAL_TIME);
/* add optional request fields */
builder.fields(new QuoteRequestField[] { QuoteRequestField._52_WEEK_HIGH_DATE });
/* fetch results */
final Quotes quotes = (Quotes) onDemand.fetch(builder.build());
for (Quote q : quotes.all()) {
System.out.println("Quote for : " + q.getSymbol() + " = " + q);
}
System.out.println("Quote by symbol = " + JsonUtil.intoJson(quotes.bySymbol("AAPL")));
Download the latest version here
<dependency>
<groupId>com.barchart.base</groupId>
<artifactId>barchart-ondemand-client</artifactId>
<version>1.0.3</version>
</dependency>