How barchart/marketdata-api-js works
This SDK lets an application connect to Barchart quote servers over WebSocket, subscribe to symbols, and receive DDF market-data updates. Connection handles authentication, subscriptions, inbound parsing, dispatch, and snapshot requests; MarketState turns messages into accessible profile and quote state. Separate snapshot helpers retrieve quotes, profile extensions, and exchange metadata over HTTP. Environment strategies select browser or Node WebSocket/XML implementations. Utilities parse symbols and format market values. The README establishes the user workflow; some internal wiring is supported by the SOURCE INDEX, while unsampled implementation details are not inferred.
Main entry points: Connection.js Connection · Environment.js Environment strategy · ConnectionBase.js Connection base · retrieveSnapshots.js Quote snapshots
Components 19
Connection and transport
- Connection
lib/connection/Connection.js - Connection base
lib/connection/ConnectionBase.js - Environment strategy
lib/environment/Environment.js - WebSocket adapter
lib/connection/adapter/WebSocketAdapter.js - Browser environment
lib/environment/EnvironmentForBrowsers.js - Node environment
lib/environment/EnvironmentForNode.js - Diagnostics controller
lib/connection/diagnostics/DiagnosticsControllerBase.js - Logging factory
lib/logging/LoggerFactory.js
Snapshots and metadata
- Quote snapshots
lib/connection/snapshots/quotes/retrieveSnapshots.js - Profile extensions
lib/connection/snapshots/profiles/retrieveExtensions.js - Exchange metadata
lib/connection/snapshots/exchanges/retrieveExchanges.js
Market state
- Market state
lib/marketState/MarketState.js - Profile and quote models
lib/marketState/Quote.js
Parsing and utilities
- DDF message parser
lib/utilities/parse/ddf/message.js - Symbol parser
lib/utilities/parsers/SymbolParser.js - Price unit codes
lib/utilities/data/UnitCode.js
Other components
- SDK consumer
- Barchart quote servers
- Barchart HTTP services
Connections 22
- SDK consumer → Connection: connects and subscribes
- Connection → Connection base: extends
lib/connection/Connection.js - Connection base → Environment strategy: uses strategy
lib/connection/ConnectionBase.js - Environment strategy → WebSocket adapter: provides factory
lib/environment/Environment.js - Browser environment → Environment strategy: specializes
lib/environment/EnvironmentForBrowsers.js - Node environment → Environment strategy: specializes
lib/environment/EnvironmentForNode.js - Connection → Barchart quote servers: streams via WebSocket
- Barchart quote servers → Connection: sends DDF stream
- Connection → DDF message parser: parses messages
lib/connection/Connection.js - Connection base → Market state: creates state
lib/connection/ConnectionBase.js - Market state → Profile and quote models: manages models
lib/marketState/MarketState.js - Connection → Quote snapshots: requests snapshots
lib/connection/Connection.js - Connection → Profile extensions: retrieves extensions
lib/connection/Connection.js - Connection → Exchange metadata: retrieves exchanges
lib/connection/Connection.js - Quote snapshots → Barchart HTTP services: requests HTTP data
lib/connection/snapshots/quotes/retrieveSnapshots.js - Profile extensions → Barchart HTTP services: requests HTTP data
lib/connection/snapshots/profiles/retrieveExtensions.js - Exchange metadata → Barchart HTTP services: requests HTTP data
lib/connection/snapshots/exchanges/retrieveExchanges.js - Profile extensions → Symbol parser: classifies symbols
lib/connection/snapshots/profiles/retrieveExtensions.js - Quote snapshots → Symbol parser: resolves symbols
lib/connection/snapshots/quotes/retrieveSnapshots.js - Connection → Diagnostics controller: implements diagnostics
lib/connection/Connection.js - Connection → Logging factory: obtains logger
lib/connection/Connection.js - Symbol parser → Price unit codes