Skip to content

dxFeed/dxfeed-net-api

Repository files navigation

This package provides access to dxFeed market data. The library is build as a thin wrapper over dxFeed C API library.

Release License Downloads

Table of Сontents

Documentation

Find useful information in self-service dxFeed Knowledge Base, or .NET API framework documentation:

Installation

Windows

System requirements: Visual C++ Redistributable 2015, .NET Framework 4.5.2+, Visual Studio.

  1. Download the latest version of dxFeed .NET API (dxfeed-net-api-x.x.x-windows.zip).
  2. Extract archive.
  3. Copy dxf_api.dll, dxf_native.dll, DXFeed.dll, DXFeed_64.dll, DXFeedd.dll, DXFeedd_64.dll, libcrypto-41.dll, libcrypto-41_64.dll, libssl-43.dll, libssl-43_64.dll, libtls-15.dll, libtls-15_64.dll to \lib folder of your Project.
  4. Open Visual Studio.
  5. Open Solution Explorer 🠒 Project (.csproj file) 🠒 References 🠒 Add Reference 🠒 Browse 🠒 Add. Then choose dxf_api.dll, dxf_native.dll libraries to add them to your Project.
  6. Open Solution Explorer 🠒 Project (.csproj file) 🠒 Add 🠒 Existing Item 🠒 Add As Link. Then choose DXFeed.dll, DXFeed_64.dll, DXFeedd.dll, DXFeedd_64.dll, libcrypto-41.dll, libcrypto-41_64.dll, libssl-43.dll, libssl-43_64.dll, libtls-15.dll, libtls-15_64.dll libraries to add them to your Project.
  7. Add using directive in class (.cs file):
using com.dxfeed.api;
using com.dxfeed.native;
  1. Look through the usage section and code samples.

Linux

Coming soon


macOS

Coming soon

Key features

Event types

# EventType Short description Examples of original feed events Interface
1 Trade The price and size of the last trade during regular trading hours, an overall day volume and day turnover Trade (last sale), trade conditions change messages, volume setting events, index value IDxTrade
2 TradeETH The price and size of the last trade during extended trading hours, and the extended trading hours day volume and day turnover Trade (last sale), trade conditions change messages, volume setting events IDxTradeETH
3 TimeAndSale The trade or other market event with price that provides information about trades in a continuous time slice (unlike Trade events, which are supposed to provide a snapshot of the current last trade) Trade, index value IDxTimeAndSale
4 Quote The best bid and ask prices and other fields that may change with each quote. It represents the most recent information that is available about the best quote on the market BBO Quote (bid/ask), regional Quote (bid/ask) IDxQuote
5 Order Depending on the Scope flag it may be: composite BBO from the whole market or regional BBO from a particular exchange or aggregated information (e.g. PLB - price level book) or individual order (FOD - full order depth) Regional Quote (bid/ask), depth (order books, price levels, market maker quotes), market depth IDxOrder
6 SpreadOrder Multi-leg order Regional Quote (bid/ask), depth (order books, price levels, market maker quotes), market depth IDxSpreadOrder
7 Candle OHLCV candle Charting aggregations IDxCandle
8 Profile The most recent information that is available about the traded security on the market Instrument definition, trading halt/resume messages IDxProfile
9 Summary The most recent OHLC information about the trading session on the market OHLC setting events (trades, explicit hi/lo update messages, explicit summary messages) IDxSummary
10 Greeks Differential values that show how the price of an option depends on other market parameters Greeks and Black-Scholes implied volatility IDxGreeks
11 TheoPrice The theoretical option price Theoretical prices IDxTheoPrice
12 Underlying Calculated values that are available for an option underlying symbol based on the option prices on the market VIX methodology implied volatility, P/C ratios IDxUnderlying
13 Series Properties of the underlying VIX methodology implied volatility, P/C ratios IDxSeries
ℹ️ CODE SAMPLE: take a look at EventType usage in dxf_events_sample, dxf_candle_sample
✅ READ MORE: Events to be published for different feed types, feed types and events matrix

Contracts

There are three types of delivery contracts: Ticker, Stream and History. You can set up the contract type by EventSubscriptionFlag as a parameter of NativeConnection.

Ticker

The main task of this contract is to reliably deliver the latest value for an event (for example, for the last trade of the selected symbol). Queued older events could be conflated to conserve bandwidth and resources.

Stream

A stream contract guaranteedly delivers a stream of events without conflation.

History

History contract first delivers a snapshot (set of previous events) for the specified time range (subject to limitations). After the snapshot is transmitted, the history contract delivers a stream of events.

ℹ️ NOTE: if EventSubscriptionFlag is not set, the default contract type will be enabled.

Default contracts for events (in most cases):

Ticker Stream History
Trade TimeAndSale Order
TradeETH SpreadOrder
Quote Candle
Profile Series
Summary Greeks
Greeks
TheoPrice
Underlying
ℹ️ CODE SAMPLE: take a look at EventSubscriptionFlag usage in dxf_client
✅ READ MORE: Event delivery contracts

Subscription types

# Subscription type Description Code sample
1 CreateSubscription Creates subscription to an event dxf_events_sample
2 CreateSnapshotSubscription Creates a snapshot subscription dxf_snapshot_sample
3 CreateIncOrderSnapshotSubscription Creates the new native subscription to Order snapshot with incremental updates dxf_inc_order_snapshot_sample
4 CreatePriceLevelBook Creates the new price level book (10 levels) for the specified symbol and sources dxf_price_level_book_sample
5 CreateRegionalBook Creates a regional price level book (10 levels) dxf_regional_book_sample

Order sources

Order source identifies source of IDxOrder and IDxSpreadOrder events. You can set Order source by SetSource() method of IDxSubscription. Several supported sources are listed below. Please find the full list here.

Aggregated:

Full order depth:

  • BATE - Cboe EU BXE (BATE)
  • BYX - Cboe BYX
  • BZX - Cboe BZX
  • BXTR - Cboe EU SI (Systematic Internaliser)
  • BI20 - BIST Top20 Orders (Level2+)
  • CHIX - Cboe EU CXE (Chi-X)
  • CEUX - Cboe EU DXE
  • CFE - Cboe CFE
  • C2OX - Cboe C2
  • DEA - Cboe EDGA
  • DEX - Cboe EDGX
  • ERIS - ErisX
  • ESPD - Nasdaq E-speed
  • FAIR - FairX
  • GLBX - Globex
  • ICE - ICE Futures US/EU
  • IST - Borsa Istanbul
  • MEMX - Members Exchange
  • NTV - Nasdaq TotalView
  • NFX - Nasdaq NFX
  • SMFE - SmallEx
  • XNFI - Nasdaq NFI
  • XEUR - Eurex

Price level book:

ℹ️ CODE SAMPLE: take a look at OrderSource usage in dxf_price_level_book_sample
✅ READ MORE: Order sources

Usage

Create connection

//creating connection handler
var connection = new NativeConnection("demo.dxfeed.com:7300", _ => { });

Create subscription

//creating subscription handler
var subscription = connection.CreateSubscription(EventType.Quote, new EventPrinter());

Setting up contract type

//creating subscription handler with Ticker contract
var subscription = connection.CreateSubscription(EventType.Quote, EventSubscriptionFlag.ForceTicker, new EventPrinter());

Setting up symbol

//adding single symbol
subscription.AddSymbols("AAPL");
//adding array of symbols
subscription.AddSymbols(new string[] { "AAPL", "MSFT" });
//adding all available symbols
subscription.AddSymbols("*");

Setting up Order source

//setting Nasdaq TotalView FOD source
 subscription.SetSource("NTV");

Quote subscription

//creating connection handler
using (var connection = new NativeConnection("demo.dxfeed.com:7300", DisconnectHandler))
           {
           //creating subscription handler,
           //passing object of type 'EventPrinter' as an argument 
           //to invoke callback method when data received 
               using (var subscription = connection.CreateSubscription(EventType.Quote, new EventPrinter()))
               {
               	   //adding subscription to 'AAPL' symbol
                   subscription.AddSymbols("AAPL");
                   Console.WriteLine("Press enter to stop");
                   Console.ReadLine();
               }
           }
//implementation of 'DisconnectHandler' method which passed as an argument
//in 'NativeConnection' constructor
private static void DisconnectHandler(IDxConnection _) => 
	Console.WriteLine("Disconnected");
//implementation of class 'EventPrinter' which object passed as an argument
//in 'CreateSubscription' method
public class EventPrinter: IDxFeedListener
{
	//implementation of callback method 'OnQuote' of 'IDxFeedListener' interface
        public void OnQuote<TB, TE>(TB buf)
            where TB : IDxEventBuf<TE>
            where TE : IDxQuote {
            foreach (var q in buf)
                Console.WriteLine($"{buf.Symbol} {q}");
        }
}

Output:

AAPL Quote: {AAPL, AskExchangeCode: 'U', Ask: [email protected], AskTime: 2021-07-29T12:42:21.0000000Z, BidExchangeCode: 'U', Bid: [email protected], BidTime: 2021-07-29T12:44:06.0000000Z, Scope: Regional}
AAPL Quote: {AAPL, AskExchangeCode: 'V', Ask: [email protected], AskTime: 2021-07-29T12:46:47.0000000Z, BidExchangeCode: 'V', Bid: [email protected], BidTime: 2021-07-29T12:47:17.0000000Z, Scope: Regional}
AAPL Quote: {AAPL, AskExchangeCode: 'W', Ask: [email protected], AskTime: 2017-07-04T02:44:04.0000000Z, BidExchangeCode: 'W', Bid: [email protected], BidTime: 2017-07-04T02:44:04.0000000Z, Scope: Regional}
AAPL Quote: {AAPL, AskExchangeCode: 'X', Ask: [email protected], AskTime: 2021-07-29T12:46:19.0000000Z, BidExchangeCode: 'X', Bid: [email protected], BidTime: 2021-07-29T12:42:07.0000000Z, Scope: Regional}
AAPL Quote: {AAPL, AskExchangeCode: 'Y', Ask: [email protected], AskTime: 2021-07-29T12:44:50.0000000Z, BidExchangeCode: 'Y', Bid: [email protected], BidTime: 2021-07-29T12:42:06.0000000Z, Scope: Regional}
AAPL Quote: {AAPL, AskExchangeCode: 'Z', Ask: [email protected], AskTime: 2021-07-29T12:46:51.0000000Z, BidExchangeCode: 'Z', Bid: [email protected], BidTime: 2021-07-29T12:47:28.0000000Z, Scope: Regional}
AAPL Quote: {AAPL, AskExchangeCode: 'K', Ask: [email protected], AskTime: 2021-07-29T12:47:28.0000000Z, BidExchangeCode: 'K', Bid: [email protected], BidTime: 2021-07-29T12:47:29.0000000Z, Scope: Composite}

Samples

dxf_client - demonstrates some commonly used .NET API functions

https://github.com/dxFeed/dxfeed-net-api/tree/master/samples: