Giter VIP home page Giter VIP logo

marketdata-api-js's Introduction

@barchart/marketdata-api-js

AWS CodeBuild NPM

Overview

Barchart offers streaming market data for a wide range of asset classes which trade on exchanges around the world. Review our market data catalog for details.

This SDK enables your applications to consume real-time market data, as follows:

  • A WebSocket connection is established between your application and Barchart's quote servers, then
  • Your application requests market data for one or more symbols, then
  • Your application receives a market data stream for subscribed symbols.

Openfeed

This library receives market data using a proprietary protocol called DDF. For new development, Barchart has switched to an open-source protocol called Openfeed to transfer market data. Consequently, this library will be marked as deprecated in the near future. You can access new SDK libraries for Openfeed here.

Documentation

Complete documentation for this SDK can be accessed here:

Demos

Working demos are available for web browser and Node.js environments. Please refer to the documentation.

Package Managers

This library has been published to NPM as @barchart/marketdata-api-js. Install as follows:

npm install @barchart/marketdata-api-js -S

Build

Source code is written in ES2018. Consequently, transpilation is recommended for use in web browsers.

marketdata-api-js's People

Contributors

bryaningl3 avatar ddotlic avatar dzmitryafanasenka avatar eapikat avatar igor-losev avatar mvberg avatar s-widerberg avatar tomsisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

marketdata-api-js's Issues

Parsing Futures Options yields nothing

In order to figure out if certain symbol is a future or not, HTML5 charts use the following method from the API: util.ParseSymbolType(symbol)

When I pass ESZ2660C to the method, I get back nothing. This in turn means that chart cannot figure out how to parse historical data, because it does not know how many fields to expect (which it deduces based on the symbol type).

We end up with empty charts for completely valid symbols.

Related issue, coming from Webstation team

Getting a profile for some symbols does nothing

Users started reporting weird formatting of prices in the HTML5 chart product for some symbols (yet everything worked fine for most of the other symbols).

The issue with more context demonstrating the problem is this one.

The actual problem is that for the symbol in question GMM.AX I'm not getting anything back when I call getProfile. This reproduces with the latest (at this moment) version of the API which is 3.0.3.

If this helps, when I change the symbol from TWTR to GMM.AX the following gets traced to the console:

GO GMM.AX=s
Connection.js:516:5
STOP TWTR=Ssc
Connection.js:516:5

I suspect letters behind = indicate what to do - more the better? - so while for Twitter there is Ssc for the problematic symbol we get only s (hope this helps).

Typings

@mvberg @bryaningl3 Could you please add index.d.ts file to the root folder?

declare module "@barchart/marketdata-api-js" {
    type EventType = 'events' | 'marketDepth' | 'marketUpdate' | 'cumulativeVolume' | 'timestamp' | string;

    type MarketDataCallback = (data: any) => void;

    class ConnectionBase {
        connect(server: string, username: string, password: string): void;
        disconnect(): void;
        pause(): void;
        resume(): void;
        on(eventType: EventType, callback: MarketDataCallback, symbol?: string): void;
        off(eventType: EventType, callback: MarketDataCallback, symbol?: string): void;
        getActiveSymbolCount(): any;
        getPollingFrequency(): number | null;
        setPollingFrequency(pollingFrequency: number | null): void;
        getMarketState(): MarketState;
        getServer(): string | null;
        getPassword(): string | null;
        getUsername(): string | null;
        toString(): string;
    }

    class Connection extends ConnectionBase {
        toString(): string;
    }

    class MarketState {
        constructor(handleProfileRequest?: (symbol: string) => void);
        getBook(symbol: string): any;
        getCumulativeVolume(symbol: string, callback: Function): Promise<any>;
        getProfile(symbol: string, callback: Function): Promise<any>;
        getQuote(symbol: string): any;
        getTimestamp(): Date;
    }

    const Util: any;
    const util: any;

    const MessageParser: any;
    const messageParser: any;

    const version: string;

    export {
        Connection,
        MarketState,
        Util,
        util,
        MessageParser,
        messageParser,
        version
    }
}

Without this file, I can't compile @barchart/demo-chart. And it will also add Intellisense for other repositories, that use this library.

We need a way to optionally specify base URL of (at least) the profile server

For the case where the library is used/hosted in the server not managed by Barchart, we should not use the (hardcoded) relative URL proxies/instruments to fetch data. The base URL should be configurable.

Please see related discussion here.

Note that the setting has been added to the chart component, though it's not used there. We might opt to configure it only there and just pass it on to the API, or to configure the API separately.

@bryaningl3 let me know what you think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.