This package provides access to dxFeed market data. The library is built as a language-specific wrapper over the dxFeed Graal Native library, which was compiled with GraalVM Native Image and dxFeed Java API (our flagman API).
dxFeed Graal Go API allows developers to create efficient applications in Go language. This enables developers to leverage all the benefits of native app development, resulting in maximum performance and usability for end users.
We are working diligently to ensure that this new repository meets all of our standards for performance, security, and scalability. We will be providing regular updates throughout the development process.
If you have any questions, please contact us via our customer portal.
Features planned with high priority:
- refactroing public API
- deployment and publication artifacts in JFrog (to simplify the integration of the package into client applications)
- add all market events
- provide more tools and samples
- generate documentation
We use GraalVM Native Image technology and specially written code that wraps Java methods into native ones to get dynamically linked libraries for different platforms (Linux, macOS, and Windows) based on the latest Java API package.
Then, the resulting dynamic link library (dxFeed Graal-native) is used through C ABI (application binary interface), and we write programming interfaces that describe our business model (similar to Java API).
As a result, we get a full-featured, similar performance as with Java API. Regardless of the language, writing the final application logic using API calls will be very similar (only the syntax will be amended, "best practices", specific language restrictions)
Below is a scheme of this process:
Find useful information in our self-service dxFeed Knowledge Base or Go API documentation:
Only x64 versions are supported.
OS | Version | Architectures |
---|---|---|
Windows | 8, 8.1 | x64 |
Windows 10 | Version 1607+ | x64 |
Windows 11 | Version 22000+ | x64 |
Windows Server | 2012+ | x64 |
Windows Server Core | 2012+ | x64 |
Nano Server | Version 1809+ | x64 |
Only x64 versions are supported.
OS | Version | Architectures |
---|---|---|
macOS | 10.13+ | x64 |
macOS | 11+ | Arm64 |
Is supported in the Rosetta 2 x64 emulator.
sudo apt-get update
sudo apt-get install build-essential
go get github.com/dxFeed/dxFeed-graal-go-api
cd ~/go/pkg/mod/github.com/dxfeed/dxfeed-graal-go-api@<version>
go run .
package main
import (
"fmt"
"github.com/dxfeed/dxfeed-graal-go-api/pkg/api"
"github.com/dxfeed/dxfeed-graal-go-api/pkg/events/eventcodes"
"github.com/dxfeed/dxfeed-graal-go-api/pkg/events/quote"
"math"
"time"
)
type PrintEvents func(events []interface{})
func (pr PrintEvents) Update(events []any) {
pr(events)
}
func main() {
// For token-based authorization, use the following address format:
// "demo.dxfeed.com:7300[login=entitle:token]"
endpoint, err := api.NewEndpoint(api.Feed)
if err != nil {
panic(err)
}
defer func(endpoint *api.DXEndpoint) {
_ = endpoint.Close()
}(endpoint)
err = endpoint.Connect("demo.dxfeed.com:7300")
if err != nil {
panic(err)
}
feed, err := endpoint.GetFeed()
if err != nil {
panic(err)
}
subscription, err := feed.CreateSubscription(eventcodes.Quote)
if err != nil {
panic(err)
}
defer subscription.Close()
err = subscription.AddListener(PrintEvents(func(events []interface{}) {
for _, event := range events {
switch v := event.(type) {
case *quote.Quote:
fmt.Printf("%s\n", v.String())
}
}
}))
err = subscription.AddSymbol("AAPL")
if err != nil {
panic(err)
}
time.Sleep(time.Duration(math.MaxInt64))
}
Output
I 231130 124734.411 [main] QD - Using QDS-3.325+file-UNKNOWN, (C) Devexperts
I 231130 124734.415 [main] QD - Using scheme com.dxfeed.api.impl.DXFeedScheme slfwemJduh1J7ibvy9oo8DABTNhNALFQfw0KmE40CMI
I 231130 124734.418 [main] MARS - Started time synchronization tracker using multicast 239.192.51.45:5145 with dPyAu
I 231130 124734.422 [main] MARS - Started JVM self-monitoring
I 231130 124734.423 [main] QD - monitoring with collectors [Ticker, Stream, History]
I 231130 124734.424 [main] QD - monitoring DXEndpoint with dxfeed.address=demo.dxfeed.com:7300
I 231130 124734.425 [main] ClientSocket-Distributor - Starting ClientSocketConnector to demo.dxfeed.com:7300
I 231130 124734.425 [demo.dxfeed.com:7300-Reader] ClientSocketConnector - Resolving IPs for demo.dxfeed.com
I 231130 124734.427 [demo.dxfeed.com:7300-Reader] ClientSocketConnector - Connecting to 208.93.103.170:7300
I 231130 124734.530 [demo.dxfeed.com:7300-Reader] ClientSocketConnector - Connected to 208.93.103.170:7300
D 231130 124734.634 [demo.dxfeed.com:7300-Reader] QD - Distributor received protocol descriptor multiplexor@fFLro [type=qtp, version=QDS-3.319, opt=hs, mars.root=mdd.demo-amazon.multiplexor-demo1] sending [TICKER, STREAM, HISTORY, DATA] from 208.93.103.170
Quote{AAPL, eventTime=0, time=20231130-123206.000, timeNanoPart=0, sequence=0, bidTime=20231130-123206.000, bidExchange=P, bidPrice=189.36, bidSize=3.0, askTime=20231130-123129.000, askExchange=P, askPrice=189.53, askSize=10.0}
package main
import (
"fmt"
"github.com/dxfeed/dxfeed-graal-go-api/pkg/api"
"github.com/dxfeed/dxfeed-graal-go-api/pkg/events/eventcodes"
"github.com/dxfeed/dxfeed-graal-go-api/pkg/events/quote"
"math"
"time"
)
type PrintEvents func(events []interface{})
func (pr PrintEvents) Update(events []any) {
pr(events)
}
func main() {
// The experimental property must be enabled.
api.SetSystemProperty("dxfeed.experimental.dxlink.enable", "true")
// Set scheme for dxLink.
api.SetSystemProperty("scheme", "ext:opt:sysprops,resource:dxlink.xml")
// For token-based authorization, use the following address format:
// "dxlink:wss://demo.dxfeed.com/dxlink-ws[login=dxlink:token]"
endpoint, err := api.NewEndpoint(api.Feed)
if err != nil {
panic(err)
}
defer func(endpoint *api.DXEndpoint) {
_ = endpoint.Close()
}(endpoint)
err = endpoint.Connect("dxlink:wss://demo.dxfeed.com/dxlink-ws")
if err != nil {
panic(err)
}
feed, err := endpoint.GetFeed()
if err != nil {
panic(err)
}
subscription, err := feed.CreateSubscription(eventcodes.Quote)
if err != nil {
panic(err)
}
defer subscription.Close()
err = subscription.AddListener(PrintEvents(func(events []interface{}) {
for _, event := range events {
switch v := event.(type) {
case *quote.Quote:
fmt.Printf("%s\n", v.String())
}
}
}))
err = subscription.AddSymbol("AAPL")
if err != nil {
panic(err)
}
time.Sleep(time.Duration(math.MaxInt64))
}
Output
I 231130 124929.817 [main] QD - Using QDS-3.325+file-UNKNOWN, (C) Devexperts
I 231130 124929.821 [main] QD - Using scheme com.dxfeed.api.impl.DXFeedScheme slfwemJduh1J7ibvy9oo8DABTNhNALFQfw0KmE40CMI
I 231130 124929.824 [main] MARS - Started time synchronization tracker using multicast 239.192.51.45:5145 with sWipb
I 231130 124929.828 [main] MARS - Started JVM self-monitoring
I 231130 124929.828 [main] QD - monitoring with collectors [Ticker, Stream, History]
I 231130 124929.829 [main] QD - monitoring DXEndpoint with dxfeed.address=dxlink:wss://demo.dxfeed.com/dxlink-ws
I 231130 124929.831 [main] DxLinkClientWebSocket-Distributor - Starting DxLinkClientWebSocketConnector to wss://demo.dxfeed.com/dxlink-ws
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
I 231130 124929.831 [wss://demo.dxfeed.com/dxlink-ws-Writer] DxLinkClientWebSocket-Distributor - Connecting to wss://demo.dxfeed.com/dxlink-ws
I 231130 124930.153 [wss://demo.dxfeed.com/dxlink-ws-Writer] DxLinkClientWebSocket-Distributor - Connected to wss://demo.dxfeed.com/dxlink-ws
D 231130 124931.269 [oioEventLoopGroup-2-1] QD - Distributor received protocol descriptor [type=dxlink, version=0.1-0.18-20231017-133150, keepaliveTimeout=120, acceptKeepaliveTimeout=5] sending [] from wss://demo.dxfeed.com/dxlink-ws
D 231130 124931.271 [oioEventLoopGroup-2-1] QD - Distributor received protocol descriptor [type=dxlink, version=0.1-0.18-20231017-133150, keepaliveTimeout=120, acceptKeepaliveTimeout=5, authentication=] sending [] from wss://demo.dxfeed.com/dxlink-ws
Quote{AAPL, eventTime=0, time=20231130-123421.000, timeNanoPart=0, sequence=0, bidTime=20231130-123421.000, bidExchange=Q, bidPrice=189.47, bidSize=4.0, askTime=20231130-123421.000, askExchange=P, askPrice=189.53, askSize=10.0}
To familiarize with the dxLink protocol, please click here.
Tools is a collection of utilities that allow you to subscribe to various market events for the specified symbols. The tools can be downloaded from Release
- Connect connects to the specified address(es) and subscribes to the specified events with the specified symbol
- Dump dumps all events received from address. This was designed to retrieve data from a file
- PerfTest connects to the specified address(es) and calculates performance counters (events per second, memory usage, CPU usage, etc.)
- LatencyTest connects to the specified address(es) and calculates latency
To run tools on macOS, it may be necessary to unquarantine them:
sudo /usr/bin/xattr -r -d com.apple.quarantine <directory_with_tools>
- ConvertTapeFile demonstrates how to convert one tape file to another tape file with optional intermediate processing or filtering
- DxFeedFileParser is a simple demonstration of how events are read form a tape file
- DxFeedSample is a simple demonstration of how to create multiple event listeners and subscribe to
Quote
andTrade
events - PrintQuoteEvents
is a simple demonstration of how to subscribe to the
Quote
event, using aDxFeed
instance singleton anddxfeed.properties
file - WriteTapeFile is a simple demonstration of how to write events to a tape file
- DxFeedIpfConnect is a simple demonstration of how to get Instrument Profiles
- DXFeedLiveIpfSample is a simple demonstration of how to get live updates for Instrument Profiles
- DxFeedPublishProfiles is a simple demonstration of how to publish market events
- ScheduleSample is a simple demonstration of how to get various scheduling information for instruments
- DXFeedconnect is a simple demonstration of how to subscribe to different events using TimeSeriesSubscription
-
FEED connects to the remote data feed provider and is optimized for real-time or delayed data processing, this is a default role
-
STREAM_FEED is similar to
Feed
and also connects to the remote data feed provider but is designed for bulk data parsing from files -
PUBLISHER connects to the remote publisher hub (also known as multiplexor) or creates a publisher on the local host
-
STREAM_PUBLISHER is similar to
Publisher
and also connects to the remote publisher hub, but is designed for bulk data publishing -
LOCAL_HUB is a local hub without the ability to establish network connections. Events published via
Publisher
are delivered to localFeed
only -
ON_DEMAND_FEED is similar to
Feed
, but it is designed to be used with OnDemandService for historical data replay only
-
Order is a snapshot of the full available market depth for a symbol
-
SpreadOrder is a snapshot of the full available market depth for all spreads
-
AnalyticOrder is an
Order
extension that introduces analytic information, such as adding iceberg-related information to a given order -
Trade is a snapshot of the price and size of the last trade during regular trading hours and an overall day volume and day turnover
-
TradeETH is a snapshot of the price and size of the last trade during extended trading hours and the extended trading hours day volume and day turnover
-
Candle event with open, high, low, and close prices and other information for a specific period
-
Quote is a snapshot of the best bid and ask prices and other fields that change with each quote
-
Profile is a snapshot that contains the security instrument description
-
Summary is a snapshot of the trading session, including session highs, lows, etc.
-
TimeAndSale represents a trade or other market event with price, such as the open/close price of a market, etc.
-
Greeks is a snapshot of the option price, Black-Scholes volatility, and greeks
-
Series is a snapshot of computed values available for all options series for a given underlying symbol based on options market prices
-
TheoPrice is a snapshot of the theoretical option price computation that is periodically performed by dxPrice model-free computation
-
Underlying is a snapshot of computed values available for an option underlying symbol based on the market’s option prices
-
OptionSale represents a trade or another market event with the price (for example, market open/close price, etc.) for each option symbol listed under the specified
Underlying
-
Configuration is an event with an application-specific attachment
-
Message is an event with an application-specific attachment
-
String is a string representation of the symbol
-
TimeSeriesSubscriptionSymbol represents subscription to time-series events
-
IndexedEventSubscriptionSymbol represents subscription to a specific source of indexed events
-
WildcardSymbol.ALL represents a wildcard subscription to all events of the specific event type
-
CandleSymbol is a symbol used with DXFeedSubscription class to subscribe for Candle events
-
DXFeedSubscription is a subscription for a set of symbols and event types
-
DXFeedTimeSeriesSubscription extends
DXFeedSubscription
to conveniently subscribe to time series events for a set of symbols and event types -
ObservableSubscription is an observable set of subscription symbols for the specific event type (Java API sample)
-
GetLastEvent returns the last event for the specified event instance (Java API sample)
-
GetLastEvents returns the last events for the specified event instances list
-
GetLastEventPromise requests the last event for the specified event type and symbol (Java API sample)
-
GetLastEventsPromises requests the last events for the specified event type and symbol collection
-
GetLastEventIfSubscribed returns the last event for the specified event type and symbol if there’s a subscription for it
-
GetIndexedEventsPromise requests an indexed events list for the specified event type, symbol, and source
-
GetIndexedEventsIfSubscribed returns a list of indexed events for the specified event type, symbol, and source, if there’s a subscription for it
-
GetTimeSeriesPromise requests time series events for the specified event type, symbol, and time range (Java API sample)
-
GetTimeSeriesIfSubscribed requests time series events for the specified event type, symbol, and time range if there’s a subscription for it
-
TimeSeriesEventModel is a model of a list of time series events (Java API sample)
-
IndexedEventModel is an indexed event list model (Java API sample)
-
OrderBookModel is a model of convenient Order Book management (Java API sample)
-
InstrumentProfile represents basic profile information about a market instrument (Java API sample)
-
InstrumentProfileReader reads instrument profiles from the stream using Instrument Profile Format (IPF)
-
InstrumentProfileCollector collects instrument profile updates and provides the live instrument profiles list (Java API sample)
-
InstrumentProfileConnection connects to an instrument profile URL and reads instrument profiles with support of streaming live updates
-
Schedule provides API to retrieve and explore various exchanges’ trading schedules and different financial instrument classes (Java API sample)
-
Option Series is a series of call and put options with different strike sharing the same attributes of expiration, last trading day, spc, multiplies, etc. (Java API sample)
- OnDemandService provides on-demand historical tick data replay controls (Java API sample)