barchart/barchart-ondemand-client-java


A Java client for Barchart OnDemand http://barchartondemand.com/api.php

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.barchart:barchart-ondemand-client-java:barchart-ondemand-client-2.0.7'
	}
	dependencies {
		implementation("com.github.barchart:barchart-ondemand-client-java:barchart-ondemand-client-2.0.7")
	}
	<dependency>
	    <groupId>com.github.barchart</groupId>
	    <artifactId>barchart-ondemand-client-java</artifactId>
	    <version>barchart-ondemand-client-2.0.7</version>
	</dependency>

                            
    libraryDependencies += "com.github.barchart" % "barchart-ondemand-client-java" % "barchart-ondemand-client-2.0.7"
        
        

                            
    :dependencies [[com.github.barchart/barchart-ondemand-client-java "barchart-ondemand-client-2.0.7"]]
        
        

Readme


Java client for Barchart OnDemand

Check out some examples here

See how to use the client in your project here

Currently supports

  • getQuote
  • getQuoteEod
  • getEquitiesByExchange
  • getFuturesByExchange
  • getFuturesOptions
  • getShortDatedFuturesOptions
  • getProfile
  • getFinancialHighlights
  • getFinancialRatios
  • getIncomeStatements
  • getBalanceSheets
  • getCompetitors
  • getInsiders
  • getRatings
  • getIndexMembers
  • getCorporateActions
  • getEarningsEstimates
  • getLeaders
  • getHighsLows
  • getInstrumentDefinition
  • getFuturesSpecifications
  • getFuturesExpirations
  • getWeather
  • getUSDAGrainPrices

Example Code

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 = 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")));

Adding to your project

Plain Jar

Download the latest version here

Maven
<!-- version 2 (latest) -->
<dependency>
	<groupId>com.barchart.base</groupId>
	<artifactId>barchart-ondemand-client</artifactId>
	<version>2.0.2</version>
</dependency>

<!-- version 1 (deprecated & frozen) -->
<dependency>
	<groupId>com.barchart.base</groupId>
	<artifactId>barchart-ondemand-client</artifactId>
	<version>1.0.20</version>
</dependency>