Skip to main content

OnDemand Historical APIs

Java, JavaScript APIs, and web services

dxFeed Java API

dxFeed Java API gives control over the full functionality of dxFeed real-time, historical and aggregated data (including market replay). Samples package is the best way to quickly get things working.

Your basic code to connect to a data source and start receiving quotes will be under 10 LOCs:

public class OnDemandSample {
        public static void main(String[] args) throws ParseException, InterruptedException {
            // create subscription for a specific event type on default feed
            DXFeedSubscription<Quote> sub = DXFeed.getInstance().createSubscription(Quote.class);
            // define listener for events
            sub.addEventListener(new DXFeedEventListener<Quote>() {
                public void eventsReceived(List<Quote> events) {
                    for (Quote quote : events)
                    System.out.println(quote);
                }
            });

            // add symbols to start receiving events
            sub.addSymbols("GOOG", "AAPL");
        }
}

Historical market replay sample (see com.dxfeed.sample.ondemand) is not much longer and provides an example of switching to market replay by switching the endpoint to onDemand and setting the start date/time and replay speed:

public class OnDemandSample {
        public static void main(String[] args) throws ParseException, InterruptedException {
                // get on-demand-only data feed
                OnDemandService onDemand = OnDemandService.getInstance();
                DXFeed feed = onDemand.getEndpoint().getFeed();

                // subscribe to Accenture symbol ACN to print its quotes
                DXFeedSubscription<Quote> sub = feed.createSubscription(Quote.class);
                sub.addEventListener(new DXFeedEventListener<Quote>() {
                        public void eventsReceived(List<Quote> events) {
                                for (Quote quote : events) {
                                        System.out.println(quote.getEventSymbol() +
                                                " bid " + quote.getBidPrice() + " /" +
                                                " ask " + quote.getAskPrice());
                                }
                        }
                });
                sub.addSymbols("ACN");

                // Watch Accenture drop under $1 on May 6, 2010 "Flashcrash"
        // from 14:47:48 to 14:48:02 EST
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss 'EST'");
                format.setTimeZone(TimeZone.getTimeZone("America/New_York"));
                Date from = format.parse("2010-05-06 14:47:48 EST");
                Date to = format.parse("2010-05-06 14:48:02 EST");

                // switch into historical on-demand data replay mode
                onDemand.replay(from);

                // replaying events until end time reached
                while (onDemand.getTime().getTime() < to.getTime()) {
                        System.out.println("Current state is " +
                    onDemand.getEndpoint().getState() + "," +
                                    " on-demand time is " + format.format(onDemand.getTime()));
                        Thread.sleep(1000);
                }

                // close endpoint completely to release resources and shutdown JVM
                onDemand.getEndpoint().closeAndAwaitTermination();
        }
}

dxFeed web service and Javascript API

JavaScript API mirrors dxFeed Java API in JavaScript and provides easy widgets and shortcuts to integrate streaming market data into web apps.

The console for dxFeed web service with test data is deployed here. It provides samples and diagnostic tools for streaming data subscriptions, building charts, using widgets, and using REST services for snapshot queries.

REST web services

IPF web service

Instrument profile web service providing essential symbol attributes and symbol discovery:

Usage: /ipf?<parameters>
Available parameters to filter instrument profiles output, returning instrument profiles only for:
  mode          'batch' (default) for bulk retrieval, 'ui' for symbol lookup
  date          ipf for the business day specified as YYYYMMDD (not available in 'ui' mode)
  types         list of type patterns, e.g. INDEX, STOCK
  symbols       list of symbol patterns, e.g. IBM or *DJI*
  underlyings   list of underlyings patterns
  products      list of products patterns, e.g. /ESZ3 is returned for /ES
  lists         list of list name patterns, e.g. index constituents of SP500
  text          text for full-text search (only available and required in 'ui' mode)
  limit         limit result to <n> rows (only available and required in 'ui' mode)
  compression   'plain' (default) for uncompressed, 'zip' or 'gzip' for compressed output

Note: 'list of patterns' denotes a comma-separated list of glob patterns like * or /ES,/ES??

Additional help and listing commands:
  ?help         prints this message
  ?help&lists   list of available lists in CSV format

Examples:
  /ipf?date=20131210          ipf for 2013-12-20
  /ipf?types=INDEX,STOCK      output only INDEX and STOCK types
  /ipf?symbols=IBM,AAPL,SPY   instrument profiles for IBM,AAPL,SPY only
  /ipf?underlyings=/*         instrument profiles for futures options only (underlyings starting with "/" are futures)
  /ipf?products=/ES           instrument profiles for futures series for /ES - S&P500 futures on CME
  /ipf?lists=SP500,DJ*        instrument profiles for constituents of S&P500 and all DowJones indices

Examples

Note

Use demo/demo credentials to check examples.

onDemand tick data extraction web service

Extracts tick data for given symbols, time, and event types from our cloud storage. All instrument types are available for you to test.

URL: http://tools.dxfeed.com/onDemand/data

Usage: /onDemand/data?categories=<category-list>&symbols=<symbol-list>&start=<start-time>&end=<end-time>
Optional parameters: &fields=<field-list>&conflate=<conflate-period>&format=csv

  <category-list>   is a comma-separated list of 3-letter categories like F-M or E-Q,E-T,E-H
                    1st letter: E=Equities, F=Futures, O=Options, Q=Future Options, X=Forex
                    2nd letter: -=Composite, .=Regional
                    3rd letter: Q=Quote, T=Trade, S=Summary, P=Profile, H=TradeHistory, M=MarketMaker
                    Glob patterns with * and ? can be used.
  <symbol-list>     is a comma-separated list of symbol glob patterns like * or /ES,/ES?? or IBM,AAPL,SPY
  <start-time>      is a timestamp when to start data extraction like 20110509-0830
  <end-time>        is a timestamp when to stop data extraction like 20110509-1600
                    timestamps are specified in Eastern Standard Time timezone
  <field-list>      is a comma-separated list of globs like Symbol,EventTime,*Price
  <conflate-period> is a time-period for conflation like 1s or 1m

It is possible and recommended to launch separate instances of a tool to extract data
for different categories or different category groups (e.g. equities, futures).
It is also recommended to use separate launches for extraction of large amounts of data.
Note that extracted data is reordered in chunks, for original order sorting by timestamp is required.

Examples

onDemand tick data audit web service

Extracts data from onDemand cloud storage for given symbols, events, and timeframes in order. Used for trade audit purposes primarily, currently provides access only to 1 month of data on all symbols except OPRA regional options data where the limitation is 1 week. Limitations are configurable.

URL: http://tools.dxfeed.com/tickdata

Usage: /tickdata?help
  Prints this help screen.

Usage: /tickdata?<parameters>
  Extracts data for the specified parameters as a tape in the specified format.
  Available parameters:
    records         record names pattern (e.g. Quote,Trade)
    symbols         comma-separated list of symbols (e.g. AAPL,GOOG)
    start           start time as YYYYMMDD-HHMMSS[.sss][zone]
    stop            stop time as YYYYMMDD-HHMMSS[.sss][zone]
    format          output format - text, csv or binary (optional, text by default)
    compression     output compression - none, zip or gzip (optional, none by default)

Examples

Documentation

Please follow the links below for online docs on dxFeed API and supporting information: