This package grants you access to dxFeed market data. The library is designed as a С-library and was compiled using GraalVM Native Image and our flagship dxFeed Java API, making it easily integrable into your projects.
Our Java API serves as the cornerstone of our technology, and with our SDK, you can seamlessly integrate it into any language, leveraging it as a native library, even on IOS platforms.
- 🚀 Increased performance
- 🌌 Wider functionality
- ♊ Identical programming interfaces to our best API
- 👍 Higher quality of support and service
Our team is committed to continuously improving the library by regularly releasing updates to our Java API and implementing them in the native library.
To maintain consistency, we've established a naming convention for C functions that involves using the dxfg prefix followed by the java-class and method name. However, there may be situations where exceptions to this rule are necessary, such as when dealing with service functions or using generic names for java-class names. If a method name can be used for different types of arguments, we add a number to the end. It also helps to find the appropriate java-doc to get more information about the use of a particular function.
C-structures can be classified into two categories: those that serve as reference holders for Java objects and those that act as field containers for data transferred between Java and C. Reference holders are only necessary for invoking methods of the associated Java object through corresponding C functions. Furthermore, it is ensured that the garbage collector will not collect the Java object until the appropriate release method for the reference holder is called.
When a C function returns a pointer to a c-structure, it indicates that the object's memory was allocated in Java. It is essential to release this memory using the corresponding release method after using the object. All memory allocated in C should be released in C.
It's important to keep in mind that if an object is passed to C code as a function parameter, it will be automatically released after the function is executed. Additionally, when a listener is added to dxFeed, it will be called from Java threads and the C code may be notified of its removal in Java. To account for this, a finalizer function can be passed when adding a listener. This ensures that the finalizer function will be called when the listener is no longer needed.
In case of any exceptions occurring when calling the method, the method returns a null-pointer (in case of returned pointer type) or -1 (in case of returned int and long type). To retrieve and clear an exception from the thread-local variable, use the corresponding method: dxfg_get_and_clear_thread_exception_t.
To return boolean values, we use int where 0 represents false and 1 represents true. The value -1 is reserved for exceptions in both int and long types.
dxfg_endpoint_t* endpoint = dxfg_DXEndpoint_create(thread);
dxfg_DXEndpoint_connect(thread, endpoint, "********");
dxfg_feed_t* feed = dxfg_DXEndpoint_getFeed(thread, endpoint);
dxfg_subscription_t* subscriptionQuote = dxfg_DXFeed_createSubscription(thread, feed, DXFG_EVENT_QUOTE);
dxfg_feed_event_listener_t *listener = dxfg_DXFeedEventListener_new(thread, &c_print, nullptr);
dxfg_DXFeedSubscription_addEventListener(thread,subscriptionQuote, listener, finalize, nullptr);
dxfg_string_symbol_t symbolAAPL;
symbolAAPL.supper.type = STRING;
symbolAAPL.symbol = "AAPL";
dxfg_DXFeedSubscription_setSymbol(thread, subscriptionQuote, &symbolAAPL.supper);
usleep(2000000);
dxfg_DXFeedSubscription_close(thread, subscriptionQuote);
dxfg_DXEndpoint_close(thread, endpoint);
dxfg_JavaObjectHandler_release(thread, &subscriptionQuote->handler);
dxfg_JavaObjectHandler_release(thread, &listener->handler);
dxfg_JavaObjectHandler_release(thread, &feed->handler);
dxfg_JavaObjectHandler_release(thread, &endpoint->handler);
There are the following usage examples:
- live IPF
- reader IPF
- finalize Listener
- executor Base On Concurrent Linked Queue
- dxEndpoint Subscription
- dxEndpoint TimeSeriesSubscription
- system Properties
- exception
- order Book Model
- indexed Event Model
- promise
- last Event If Subscribed
- promises All Of
- indexed Events Promise
- get Last Event
- schedule
Or our ready-made wrappers:
You can find artifacts here:
- https://dxfeed.jfrog.io/artifactory/maven-open/com/dxfeed/graal-native-sdk/
- https://dxfeed.jfrog.io/artifactory/nuget-open/com/dxfeed/graal-native/
Find useful information in our self-service dxFeed Knowledge Base:
- 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 represents an extension of Order introducing analytic information, e.g., adding iceberg-related information to this 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, like market open/close price, 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 is a 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
- TimeSeriesSubscriptionSymbol - represents subscription to time-series events
- IndexedSubscriptionSymbol - represents subscription to a specific source of indexed events
- WildcardSymbol.ALL - represents a wildcard subscription to all events of the specific event type
- CandleSymbol - symbol used with DXFeedSubscription class to subscribe for Candle events
- CreateSubscription creates a new subscription for multiple event types attached to a specified feed
- CreateTimeSeriesSubscription extends DXFeedSubscription to conveniently subscribe to time series of events for a set of symbols and event types (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 requests an indexed events list for the specified event type, symbol, and source if there’s a subscription for it
- GetTimeSeriesPromise requests time series of events for the specified event type, symbol, and time range (Java API sample)
- GetTimeSeriesIfSubscribed requests time series of 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 a model of a list of indexed events (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)
- InstrumentProfileCollector collects instrument profile updates and provides the live instrument profiles list (Java API sample)
- Schedule provides API to retrieve and explore various exchanges’ trading schedules and different financial instrument classes (Java API sample)
- OnDemandService provides on-demand historical tick data replay controls (Java API sample)
- 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
- LOCAL_HUB is a local hub without the ability to establish network connections. Events published via publisher are delivered to local feed only.
- PUBLISHER connects to the remote publisher hub (also known as multiplexor) or creates a publisher on the local host (Java API sample)
- STREAM_PUBLISHER is similar to PUBLISHER and also connects to the remote publisher hub, but is designed for bulk data publishing
- ON_DEMAND_FEED is similar to FEED, but it is designed to be used with OnDemandService for historical data replay only
GraalVM Community Edition 22.3.1
- File | Project structure | SDKs - add JDK graalvm-11
- File | Project structure | Project / SDK - choose JDK graalvm-11
- Preferences | Build, Execution, Deployment | Build Tools | Maven | Importing | JDK for importer - choose JDK graalvm-11
- Preferences | Build, Execution, Deployment | Build Tools | Maven | Runner | JRE - choose JDK graalvm-11
add a new case to src/test/java/com/dxfeed/NativeLibMain.java and execute it
export M2_HOME=~/.m2
$JAVA_HOME/bin/java -Dtoken=<TOKEN> -agentlib:native-image-agent=config-output-dir=META-INF/native-image -Dfile.encoding=UTF-8 -classpath ./target/test-classes:./target/classes:$M2_HOME/repository/com/devexperts/qd/qds/3.312/qds-3.312.jar:$M2_HOME/repository/com/devexperts/qd/dxlib/3.312/dxlib-3.312.jar:$M2_HOME/repository/com/devexperts/qd/dxfeed-api/3.312/dxfeed-api-3.312.jar:$M2_HOME/repository/com/devexperts/mdd/auther-api/441/auther-api-441.jar:$M2_HOME/repository/com/devexperts/qd/qds-tools/3.313/qds-tools-3.313.jar:$M2_HOME/repository/com/devexperts/qd/qds-file/3.313/qds-file-3.313.jar:$M2_HOME/repository/org/graalvm/sdk/graal-sdk/22.1.0/graal-sdk-22.1.0.jar:$M2_HOME/repository/org/graalvm/nativeimage/svm/22.1.0/svm-22.1.0.jar:$M2_HOME/repository/org/graalvm/nativeimage/objectfile/22.1.0/objectfile-22.1.0.jar:$M2_HOME/repository/org/graalvm/nativeimage/pointsto/22.1.0/pointsto-22.1.0.jar:$M2_HOME/repository/org/graalvm/compiler/compiler/22.1.0/compiler-22.1.0.jar:$M2_HOME/repository/org/graalvm/truffle/truffle-api/22.1.0/truffle-api-22.1.0.jar:$M2_HOME/repository/org/graalvm/nativeimage/native-image-base/22.1.0/native-image-base-22.1.0.jar com.dxfeed.NativeLibMain
We use teamcity.
- Run the "build PATCH and deploy linux" configuration to release a version of PATCH or "build MAJOR.MINOR.PATCH and deploy linux" (set env.RELEASE_VERSION in run parameters) to release a version of MAJOR or MINOR. A linux version of the artifact will also be deployed.
- The "deploy osx", "deploy windows", "deploy nuget" builds will start automatically, after which you can see the new artifacts in artifactory. The "deploy osx" configuration builds and deploys artifacts under amd, arm architecture osx and arm under IOS.
cd ~
# xcode command line tools
xcode-select --install
#ARCH64
curl -LO https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java11-darwin-aarch64-22.3.1.tar.gz
sudo xattr -rd com.apple.quarantine graalvm-ce-java11-darwin-aarch64-22.3.1.tar.gz
tar -xzvf graalvm-ce-java11-darwin-aarch64-22.3.1.tar.gz
sudo mv graalvm-ce-java11-22.3.1 /Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-arm64
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-arm64/Contents/Home/bin/gu install native-image
#IOS https://www.graalvm.org/22.2/reference-manual/native-image/LLVMBackend/
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-arm64/Contents/Home/bin/gu install llvm-toolchain
ln -s /Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-arm64/Contents/Home ~/.jenv/versions/graalvm-ce-java11-22.3.1-arm64
#AMD64
curl -LO https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java11-darwin-amd64-22.3.1.tar.gz
sudo xattr -rd com.apple.quarantine graalvm-ce-java11-darwin-amd64-22.3.1.tar.gz
tar -xzvf graalvm-ce-java11-darwin-amd64-22.3.1.tar.gz
sudo mv graalvm-ce-java11-22.3.1 /Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-amd64
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-amd64/Contents/Home/bin/gu install native-image
#IOS https://www.graalvm.org/22.2/reference-manual/native-image/LLVMBackend/
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-amd64/Contents/Home/bin/gu install llvm-toolchain
ln -s /Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1-amd64/Contents/Home ~/.jenv/versions/graalvm-ce-java11-22.3.1-amd64
mvn clean
jenv shell graalvm-ce-java11-22.3.1-arm64
mvn -DmacIos=true deploy
For the simulator we need to support both amd64 and arm64 platforms. a-files are generated as fat-files for both platforms. To get an o-file also fat (for both platforms) we first build a regular iOS artifact and save the resulting o-file. Then we build o-file for amd64 and glue them with lipo utilities. In the final archive for the simulator we put a- and o-files as fat for both platforms.
mvn clean
jenv shell graalvm-ce-java11-22.3.1-arm64
mvn -DmacIos=true package
jenv shell graalvm-ce-java11-22.3.1-amd64
arch -x86_64 mvn -DmacIosSimulator=true deploy
Our support team on our customer portal is ready to answer any questions and help with the transition.
cd ~
curl -LO https://github.com/graalvm/labs-openjdk-11/releases/download/jvmci-22.3-b13/labsjdk-ce-11.0.18+10-jvmci-22.3-b13-darwin-amd64.tar.gz
curl -LO https://github.com/graalvm/labs-openjdk-11/releases/download/jvmci-22.3-b13/labsjdk-ce-11.0.18+10-jvmci-22.3-b13-darwin-aarch64.tar.gz
sudo xattr -rd com.apple.quarantine labsjdk-ce-11.0.18+10-jvmci-22.3-b13-darwin-amd64.tar.gz
sudo xattr -rd com.apple.quarantine labsjdk-ce-11.0.18+10-jvmci-22.3-b13-darwin-aarch64.tar.gz
tar -xzvf labsjdk-ce-11.0.18+10-jvmci-22.3-b13-darwin-amd64.tar.gz
mv labsjdk-ce-11.0.18-jvmci-22.3-b13 labsjdk-ce-11.0.18-jvmci-22.3-b13_amd64
tar -xzvf labsjdk-ce-11.0.18+10-jvmci-22.3-b13-darwin-aarch64.tar.gz
mv labsjdk-ce-11.0.18-jvmci-22.3-b13 labsjdk-ce-11.0.18-jvmci-22.3-b13_aarch64
sudo mv labsjdk-ce-11.0.18-jvmci-22.3-b13_amd64 /Library/Java/JavaVirtualMachines/
sudo mv labsjdk-ce-11.0.18-jvmci-22.3-b13_aarch64 /Library/Java/JavaVirtualMachines/
ln -s /Library/Java/JavaVirtualMachines/labsjdk-ce-11.0.18-jvmci-22.3-b13_amd64/Contents/Home ~/.jenv/versions/labsjdk-ce-11.0.18-jvmci-22.3-b13_amd64
ln -s /Library/Java/JavaVirtualMachines/labsjdk-ce-11.0.18-jvmci-22.3-b13_aarch64/Contents/Home ~/.jenv/versions/labsjdk-ce-11.0.18-jvmci-22.3-b13_aarch64
jenv shell labsjdk-ce-11.0.18-jvmci-22.3-b13_amd64
java -version
git clone https://github.com/dxFeed/labs-openjdk-11.git
cd labs-openjdk-11
git checkout -b jvmci/22.3-b13-fix-sun-management origin/release/jvmci/22.3-b13-fix-sun-management
git remote add oracle https://github.com/graalvm/labs-openjdk-11.git
git fetch oracle
arch -x86_64 python3 build_labsjdk.py --jvmci-version 22.3-b13 --configure-option=--disable-warnings-as-errors
xcodebuild -sdk iphoneos -arch arm64 -project jdk-11-ios.xcodeproj -scheme jdk-arm64-release
xcodebuild -sdk iphonesimulator -project jdk-11-ios.xcodeproj -scheme jdk-arm64-release
lipo -info xcode/jdk-arm64-ios-r.a
#Non-fat file: xcode/jdk-arm64-ios-r.a is architecture: arm64
lipo -info xcode/jdk-arm64-ios-simulator-r.a
#Architectures in the fat file: xcode/jdk-arm64-ios-simulator-r.a are: arm64 x86_64
ln -s ~/labs-openjdk-11/java_home ~/.jenv/versions/labs-openjdk-11_graal_amd64
jenv shell labs-openjdk-11_graal_amd64
cd ~
git clone https://github.com/dxFeed/graal.git
cd graal
git checkout -b release/graal-vm/22.3.1 origin/release/graal-vm/22.3.1
cd substratevm
arch -x86_64 mx build
mkdir xcode
xcodebuild -sdk iphoneos -arch arm64 -project graal-svm-ios.xcodeproj -scheme graal-svm-arm64-release
xcodebuild -sdk iphonesimulator -arch arm64 -project graal-svm-ios.xcodeproj -scheme graal-svm-arm64-release
arch -x86_64 xcodebuild -sdk iphonesimulator -arch x86_64 -project graal-svm-ios.xcodeproj -scheme graal-svm-x86-64-release
lipo -create xcode/graal-svm-arm64-ios-simulator-r.a xcode/graal-svm-x86-64-ios-simulator-r.a -output xcode/graal-svm-x86-64-ios-simulator-r-f.a
lipo -info xcode/graal-svm-x86-64-ios-simulator-r-f.a
#Architectures in the fat file: xcode/graal-svm-x86-64-ios-simulator-r-f.a are: x86_64 arm64
MPL-2.0