API Reference

Core functions

class dxfeed.core.DXFeedPy.ConnectionClass

Data structure that contains connection

get_sub_refs()

Method to get list of references to all subscriptions related to current connection

Returns:List of weakref objects. Empty list if no refs
Return type:list
class dxfeed.core.DXFeedPy.SubscriptionClass

Data structure that contains subscription and related fields

get_data()

Method returns list with data, specified in event listener and returned data will be removed from object buffer

Returns:List with data
Return type:list
to_dataframe()

Method converts data to the Pandas DataFrame

Parameters:keep (bool) – When True copies data to dataframe, otherwise pops. Default True
Returns:df
Return type:pandas DataFrame
dxfeed.core.DXFeedPy.dxf_add_symbols()

Adds symbols to subscription

Parameters:
  • sc (SubscriptionClass) – SubscriptionClass with information about subscription
  • symbols (list) – List of symbols to add
dxfeed.core.DXFeedPy.dxf_attach_custom_listener()

Attaches custom listener

Parameters:
  • sc (SubscriptionClass) – SubscriptionClass with information about subscription
  • fw (FuncWrapper) – c function wrapped in FuncWrapper class with Cython
  • columns (list) – Columns for internal data of SubscriptionClass
  • data (dict) – Dict with new internal data structure of SubscriptionClass
dxfeed.core.DXFeedPy.dxf_attach_listener()

Function attaches default listener according to subscription type

Parameters:sc (SubscriptionClass) – SubscriptionClass with information about subscription
dxfeed.core.DXFeedPy.dxf_clear_symbols()

Removes all symbols from the subscription

Parameters:sc (SubscriptionClass) – SubscriptionClass with information about subscription
dxfeed.core.DXFeedPy.dxf_close_connection()

Closes connection

Parameters:cc (ConnectionClass) – Variable with connection information
dxfeed.core.DXFeedPy.dxf_close_subscription()

Closes subscription

Parameters:sc (SubscriptionClass) – SubscriptionClass with information about subscription
dxfeed.core.DXFeedPy.dxf_create_connection()

Function creates connection to dxfeed given url address

Parameters:address (str) – dxfeed url address
Returns:cc – Cython ConnectionClass with information about connection
Return type:ConnectionClass
dxfeed.core.DXFeedPy.dxf_create_connection_auth_bearer()

Function creates connection to dxfeed given url address and token

Parameters:
  • address (str) – dxfeed url address
  • token (str) – dxfeed token
Returns:

cc – Cython ConnectionClass with information about connection

Return type:

ConnectionClass

dxfeed.core.DXFeedPy.dxf_create_subscription()

Function creates subscription and writes all relevant information to SubscriptionClass

Parameters:
  • cc (ConnectionClass) – Variable with connection information
  • event_type (str) – Event types: ‘Trade’, ‘Quote’, ‘Summary’, ‘Profile’, ‘Order’, ‘TimeAndSale’, ‘Candle’, ‘TradeETH’, ‘SpreadOrder’, ‘Greeks’, ‘TheoPrice’, ‘Underlying’, ‘Series’, ‘Configuration’ or ‘’
  • candle_time (str) – String of %Y-%m-%d %H:%M:%S datetime format for retrieving candles. By default set to now
  • data_len (int) – Sets maximum amount of events, that are kept in Subscription class
Returns:

sc – Cython SubscriptionClass with information about subscription

Return type:

SubscriptionClass

dxfeed.core.DXFeedPy.dxf_detach_listener()

Detaches any listener

Parameters:sc (SubscriptionClass) – SubscriptionClass with information about subscription
dxfeed.core.DXFeedPy.dxf_get_current_connected_address()

Returns current connected address

Parameters:cc (ConnectionClass) – Variable with connection information
Returns:address – Current connected address
Return type:str
dxfeed.core.DXFeedPy.dxf_get_current_connection_status()

Returns one of four possible statuses

Parameters:
  • cc (ConnectionClass) – Variable with connection information
  • return_str (bool) – When True returns connection status in string format, otherwise internal c representation as integer
dxfeed.core.DXFeedPy.dxf_get_subscription_event_types()

Gets subscription event type

Parameters:
  • sc (SubscriptionClass) – SubscriptionClass with information about subscription
  • return_str (bool) – When True returns event type in string format, otherwise internal c representation as integer
Returns:

Subscription type

Return type:

str or int

dxfeed.core.DXFeedPy.dxf_get_symbols()

Retrieves the list of symbols currently added to the subscription.

Parameters:sc (SubscriptionClass) – SubscriptionClass with information about subscription
Returns:List of unicode strings of subscription symbols
Return type:list
dxfeed.core.DXFeedPy.dxf_initialize_logger()

Initializes the internal logger. Various actions and events, including the errors, are being logged throughout the library. They may be stored into the file.

Parameters:
  • file_name (str) – A full path to the file where the log is to be stored
  • rewrite_file (bool) – A flag defining the file open mode if it’s True then the log file will be rewritten
  • show_timezone_info (bool) – A flag defining the time display option in the log file if it’s True then the time will be displayed with the timezone suffix
  • verbose (bool) – A flag defining the logging mode if it’s True then the verbose logging will be enabled
dxfeed.core.DXFeedPy.dxf_remove_symbols()

Removes several symbols from the subscription

Parameters:
  • sc (SubscriptionClass) – SubscriptionClass with information about subscription
  • symbols (list) – List of symbols to remove
dxfeed.core.DXFeedPy.process_last_error()

Function retrieves last error

Parameters:verbose (bool) – If True error description is printed
Returns:error_code – Error code is returned
Return type:int

Utils functions

dxfeed.core.utils.helpers.event_type_convert()

The function converts event type given as string to int, used in C dxfeed dxfeed

Parameters:event_type (str) –
Event type: ‘Trade’, ‘Quote’, ‘Summary’, ‘Profile’, ‘Order’, ‘TimeAndSale’, ‘Candle’, ‘TradeETH’, ‘SpreadOrder’,
’Greeks’, ‘TheoPrice’, ‘Underlying’, ‘Series’, ‘Configuration’ or ‘’
Returns:Integer that corresponds to event type in C dxfeed dxfeed
Return type:int
dxfeed.core.utils.helpers.get_include()

Function returns paths to header files of dxfeed-c-api library. Used for writing custom listeners

Returns:out_dir – List of paths to header files
Return type:list
class dxfeed.core.utils.data_class.DequeWithLock(iterable=(), maxlen=None)

Class that provides lock mechanism to deque from collections for append, copy and get operations

safe_append(data: Any)

Method appends data while locked

Parameters:data (any) – Data to append
safe_get()

Method that pops all the data with subsequent clearing

Returns:list_to_return – List filled with data
Return type:list