dxFeed API
C and .NET APIs
With dxFeed C and .NET APIs you can start receiving your market events writing only several lines of code.
Name
System Requirements
Source
Documentation
dxFeed .NET API Example
using (var con = new NativeConnection("demo.dxfeed.com:7300", connection => { })) { using (var sub = con.CreateSubscription(EventType.Quote, new EventPrinter())) { sub.AddSymbols("IBM", "GOOG", "AAPL", "SPY"); Console.WriteLine("Press enter to stop"); Console.ReadLine(); } }
dxFeed C API Example
#include <stdio.h> #include <time.h> #include "DXFeed.h" void print_timestamp(dxf_long_t timestamp) { wchar_t timefmt[80]; struct tm* timeinfo; time_t tmpint = (time_t)(timestamp / 1000); timeinfo = localtime(&tmpint); wcsftime(timefmt, 80, L"%Y%m%d-%H%M%S", timeinfo); wprintf(L"%ls", timefmt); } void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wprintf(L"%Quote{symbol=%ls, ", symbol_name); dxf_quote_t* q = (dxf_quote_t*)data; wprintf(L"bidTime="); print_timestamp(q->bid_time); wprintf(L" bidExchangeCode=%c, bidPrice=%f, bidSize=%i, ", q->bid_exchange_code, q->bid_price, q->bid_size); wprintf(L"askTime="); print_timestamp(q->ask_time); wprintf(L" askExchangeCode=%c, askPrice=%f, askSize=%i, scope=%d}\n", q->ask_exchange_code, q->ask_price, q->ask_size, (int)q->scope); } int main(int argc, char* argv[]) { dxf_connection_t con; dxf_subscription_t sub; dxf_create_connection("demo.dxfeed.com:7300", NULL, NULL, NULL, NULL, NULL, &con); dxf_create_subscription(con, DXF_ET_QUOTE, &sub); dxf_const_string_t symbols2[] = {L"IBM", L"GOOG", L"AAPL", L"SPY"}; dxf_attach_event_listener(sub, listener, NULL); dxf_add_symbols(sub, symbols2, sizeof(symbols2) / sizeof(symbols2[0])); wprintf(L"Press enter to stop"); getchar(); dxf_close_subscription(sub); dxf_close_connection(con); return 0; }