barchart.streaming.client

Barchart Java Library for Streaming Market Data

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.barchart
ArtifactId

ArtifactId

barchart-streaming-client
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

barchart.streaming.client
Barchart Java Library for Streaming Market Data
Project URL

Project URL

https://github.com/barchart/streaming-marketdata-java
Source Code Management

Source Code Management

https://github.com/barchart/streaming-marketdata-java

Download barchart-streaming-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.barchart/barchart-streaming-client/ -->
<dependency>
    <groupId>com.barchart</groupId>
    <artifactId>barchart-streaming-client</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.barchart/barchart-streaming-client/
implementation 'com.barchart:barchart-streaming-client:0.2.1'
// https://jarcasting.com/artifacts/com.barchart/barchart-streaming-client/
implementation ("com.barchart:barchart-streaming-client:0.2.1")
'com.barchart:barchart-streaming-client:jar:0.2.1'
<dependency org="com.barchart" name="barchart-streaming-client" rev="0.2.1">
  <artifact name="barchart-streaming-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.barchart', module='barchart-streaming-client', version='0.2.1')
)
libraryDependencies += "com.barchart" % "barchart-streaming-client" % "0.2.1"
[com.barchart/barchart-streaming-client "0.2.1"]

Dependencies

compile (2)

Group / Artifact Type Version
io.socket : socket.io-client jar 0.7.0
org.slf4j : slf4j-api jar 1.7.6

Project Modules

There are no modules declared in this project.

streaming-marketdata-java

A Java library for accessing Barchart's streaming market data feed

A remote server vends Barchart's market data feed. This client library uses socket.io to access the feed and allows clients to:

  • Request basic Profile data for individual symbols
  • Subscribe to Quote updates for individual symbols

Setup

The project can be built with maven. Please refer to the pom.xml file in the barchart-streaming-client directory.

cd [project-directory]/barchart-streaming-client
mvn clean
mvn install

Example

A simple example can be found in the barchart-streaming-client-test directory. There is no need to include this project with your application.

Please refer to the main method of:

com.barchart.streaming.test.StreamingTestClient

Usage

The Barchart market data server uses socket.io[http://socket.io] endpoints. This library is a convenience-wrapper. So, instead of making the socket.io connection directly, consumers can make single-line method calls to perform asynchronous operations (e.g. subscribe quotes, subscribe prices, get profile).

Simple Java Example

MarketSocketConnection c = new MarketSocketConnection();
c.connect();

final MutableQuote tsla = new BasicMutableQuote("TSLA");
			
c.subscribeToPriceChanges(tsla.getSymbol(), new Action<Synchronizer<MutableQuote>>() {
	@Override
	public void execute(Synchronizer<MutableQuote> synchronizer) {
		synchronizer.synchronize(tsla);
	}
});

Object Model

com.barchart.streaming.connection.MarketSocketConnection

Manages the underlying connection to the JERQ market data server, gracefully handling any network connectivity issues.

Three primary operations exist:

  • subscribeToQuotes - Creates a subscription for a symbol. Changes are published when any property of the Quote changes. This method updates very frequently.
  • subscribeToPriceChanges - Creates a subscription for a symbol. Changes are published only when a trade occurs at a different price level. This method updates far less frequently than the "subscribeToQuotes" method.
  • requestProfile - Asynchronous lookup symbol metadata.

All operations are thread-safe.

com.barchart.streaming.data.MutableQuote

The contract for an instrument quote that can be updated.

Each time the quote changes, a Synchronizer will be generated. This synchronizer will update any properties of the MutableQuote which have changed.

The implementation of this interface is the responsibility of the client. In a user interface, setter methods could be written to perform data-binding.

com.barchart.common.data.Synchronizer

A thread-safe mechanism for updating a data structure.

Environments

Staging

The staging environment can be used for testing.

jerq-aggregator-stage.aws.barchart.com

Production

The production environment has not been defined.

Questions

Please email [email protected].

com.barchart

Barchart, Inc.

Versions

Version
0.2.1
0.2.0