Trading API for C  7.0.0.309536
ctl.h File Reference

Go to the source code of this file.

Data Structures

struct  ctl_app_listener
 Listener interface that should be registered to receive notification of tradechannel creation and closing. More...
 
struct  ctl_channel_listener
 Listener interface that should be registered if you wish to receive notification of trade creation and closing. More...
 
struct  ctl_trade_listener
 Listener interface that should be registered if you wish to receive events for a trade. More...
 

Typedefs

typedef void(* ctl_audit_log_cb) (void *ctx, ctl_provider *provider, const char *id, ctl_trade *trade, ctl_tradeevent *ev)
 Definition of the function that you should implement to receive audit logging. More...
 
typedef struct ctl_channel_s ctl_channel
 Opaque handle representing a trade channel. More...
 
typedef void(* ctl_log_cb) (void *ctx, ctl_loglevel level, const char *fmt, va_list ap)
 Callback type for logging. More...
 
typedef struct ctl_provider_s ctl_provider
 Opaque handle representing a trading provider. More...
 
typedef struct ctl_trade_s ctl_trade
 Opaque handle representing a trade. More...
 
typedef struct ctl_tradeevent_s ctl_tradeevent
 Opaque handle representing a trade event. More...
 

Enumerations

Functions

CTL_EXPORT void * ctl_calloc (size_t nmemb, size_t size)
 Allocate and zero an array of elements. More...
 
CTL_EXPORT void ctl_channel_close (ctl_provider *provider, ctl_channel *channel)
 Forcibly close the trade channel. More...
 
CTL_EXPORT ctl_tradectl_channel_create_trade (ctl_provider *provider, ctl_channel *channel, const char *model)
 Create a trade on the specified trade channel. More...
 
CTL_EXPORT ctl_tradectl_channel_create_trade_with_requestid (ctl_provider *provider, ctl_channel *channel, const char *model, const char *requestid)
 Create a trade on the specified trade channel. More...
 
CTL_EXPORT const char * ctl_channel_get_subject (ctl_provider *provider, ctl_channel *channel)
 Get the subject of the TradeChannel. More...
 
CTL_EXPORT void * ctl_channel_get_user_pointer (ctl_provider *provider, ctl_channel *channel)
 Gets the user pointer on the ctl_trade object. More...
 
CTL_EXPORT const char * ctl_channel_get_username (ctl_provider *provider, ctl_channel *channel)
 Get the name of the user that opened the specified channel. More...
 
CTL_EXPORT void ctl_channel_set_listener (ctl_provider *provider, ctl_channel *channel, ctl_channel_listener *listener, void *context)
 Set the listener on the trade channel. More...
 
CTL_EXPORT void ctl_channel_set_user_pointer (ctl_provider *provider, ctl_channel *channel, void *ptr)
 Set a user pointer on the ctl_channel object. More...
 
CTL_EXPORT char * ctl_channel_tostring (ctl_channel *channel, char *buf, size_t buflen)
 Create a string representation of a ctl_channel object. More...
 
CTL_EXPORT ctl_providerctl_create_ds_client_provider (int num_models, const char *const *models)
 Create a DataSource client Trading provider. More...
 
CTL_EXPORT ctl_providerctl_create_ds_provider (ctl_app_listener *listener, void *context, int num_models, const char *const *models, const char *namespacePattern)
 Create a DataSource trading provider. More...
 
CTL_EXPORT ctl_providerctl_create_sl_provider (streamlink *sl, int num_models, const char *const *models)
 Create a StreamLink trading provider. More...
 
CTL_EXPORT const char * ctl_error_tostring (ctl_error error)
 Return a textual description for the given error code. More...
 
CTL_EXPORT void ctl_free (void *ptr)
 Free the supplied memory block. More...
 
CTL_EXPORT void ctl_log (ctl_provider *provider, ctl_loglevel level, const char *fmt,...)
 Log a message to the logfile for the provider. More...
 
CTL_EXPORT const char * ctl_loglevel_tostring (ctl_loglevel level)
 Return a textual description for the given log level. More...
 
CTL_EXPORT void * ctl_malloc (size_t size)
 Allocate a chunk of memory. More...
 
CTL_EXPORT ctl_channelctl_provider_create_channel (ctl_provider *provider, const char *subject, ctl_channel_listener *listener, void *context)
 Create a trade channel using the supplied provider. More...
 
CTL_EXPORT void ctl_provider_dealloc (ctl_provider *provider)
 Deallocate the trading provider. More...
 
CTL_EXPORT void ctl_provider_set_application_listener (ctl_provider *provider, ctl_app_listener *listener, void *context)
 Set the application listener for the supplied provider. More...
 
CTL_EXPORT void ctl_provider_set_audit_dslog (ctl_provider *provider, ds_log_t *log)
 Set the logfile that audit logs will be written to. More...
 
CTL_EXPORT void ctl_provider_set_audit_logger (ctl_provider *provider, ctl_audit_log_cb callback, void *ctx)
 Set the callback function for the audit logger. More...
 
CTL_EXPORT void ctl_provider_set_use_generic_messages (ctl_provider *provider, int use_generic_messages)
 Set whether the Trading provider will use generic messages. More...
 
CTL_EXPORT void * ctl_realloc (void *orig, size_t size)
 Reallocate the supplied memory. More...
 
CTL_EXPORT void ctl_set_allocator (void *(*realloc_func)(void *ctx, void *orig, size_t size), void(*free_func)(void *ctx, void *), void *ctx)
 Set the allocator that will be used by the library. More...
 
CTL_EXPORT void ctl_set_log_callback (ctl_provider *provider, ctl_log_cb callback, void *ctx)
 Set the log callback function. More...
 
CTL_EXPORT char * ctl_strdup (const char *orig)
 Duplicate the supplied string. More...
 
CTL_EXPORT ctl_tradeeventctl_trade_create_tradeevent (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, const char *type)
 Create a new trade event. More...
 
CTL_EXPORT const char * ctl_trade_get_field (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, const char *fieldname)
 Get a field that is stored on the trade. More...
 
CTL_EXPORT const char * ctl_trade_get_protocol (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
 Get the name of the trade model that is in use for the specified trade. More...
 
CTL_EXPORT const char * ctl_trade_get_requestid (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
 Get the client generated identifier that is in use for the specified trade. More...
 
CTL_EXPORT const char * ctl_trade_get_state (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
 Get the current state of the specified trade. More...
 
CTL_EXPORT void * ctl_trade_get_user_pointer (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade)
 Gets the user pointer on the ctl_trade object. More...
 
CTL_EXPORT ctl_error ctl_trade_process_event (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, ctl_tradeevent *tradeevent)
 Process an event for the specified trade. More...
 
CTL_EXPORT void ctl_trade_set_listener (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, ctl_trade_listener *listener, void *context)
 Set the listener for the specified trade. More...
 
CTL_EXPORT void ctl_trade_set_user_pointer (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, void *ptr)
 Set a user pointer on the ctl_trade object. More...
 
CTL_EXPORT char * ctl_trade_tostring (ctl_trade *trade, char *buf, size_t buflen)
 Create a string representation of a ctl_trade object. More...
 
CTL_EXPORT void ctl_tradeevent_add_field (ctl_tradeevent *ev, const char *name, const char *value)
 Add a field to a trade event. More...
 
CTL_EXPORT void ctl_tradeevent_dealloc (ctl_tradeevent *ev)
 Free up the trade event. More...
 
CTL_EXPORT const char * ctl_tradeevent_get_field (ctl_tradeevent *ev, const char *name)
 Gets the value of a field on the tradeevent. More...
 
CTL_EXPORT char const ** ctl_tradeevent_get_fields (ctl_tradeevent *ev, int *num_ptr)
 Gets all fields on the trade event. More...
 
CTL_EXPORT const char * ctl_tradeevent_get_type (ctl_tradeevent *ev)
 Get the type of the trade event. More...
 
CTL_EXPORT char * ctl_tradeevent_tostring (ctl_tradeevent *trade, char *buf, size_t buflen)
 Create a string representation of a ctl_tradeevent object. More...
 

Detailed Description

Main Trading API include file

If you want to build a DataSource Trading adapter then you must define HAVE_DSDK prior to including this file. Alternatively, if you want to build a StreamLink Trading application then you must define HAVE_STREAMLINK prior to including this file.

Typedef Documentation

typedef struct ctl_provider_s ctl_provider

Opaque handle representing a trading provider.

Function Documentation

CTL_EXPORT void ctl_provider_dealloc ( ctl_provider provider)

Deallocate the trading provider.

Parameters
provider- The trading provider to deallocate

Calling this function will result in all trade channels being closed and all trades on them being abandoned.


Generated on Thu Jun 15 2017 10:22:29 for Trading API for C