Trading API for C  7.0.0.309536
Creating a Trading client.

Functions

ctl_tradectl_channel_create_trade (ctl_provider *provider, ctl_channel *channel, const char *model)
 Create a trade on the specified trade channel. More...
 
ctl_tradectl_channel_create_trade_with_requestid (ctl_provider *provider, ctl_channel *channel, const char *model, const char *id)
 Create a trade on the specified trade channel. More...
 
ctl_providerctl_create_ds_client_provider (int num_models, const char *const *models)
 Create a DataSource client Trading provider. More...
 
ctl_providerctl_create_sl_provider (streamlink *sl, int num_models, const char *const *models)
 Create a StreamLink trading provider. More...
 
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...
 
void ctl_provider_set_application_listener (ctl_provider *provider, ctl_app_listener *listener, void *context)
 Set the application listener for the supplied provider. More...
 

Detailed Description

Trading clients are usually StreamLink client applications that submit trades for an individual user.

StreamLink Library name

The name of the library containing the implementation of the Trading API for StreamLink applications is libtrading_sl.a on Linux/MacOSX and TradingSL.lib/TradingSL.dll on Windows.

You need to compile your code with the macro HAVE_STREAMLINK to ensure that the StreamLink version of the Trading API is available.

Building a Trading Client Adapter

For the purposes of testing (in particular load testing), it can be useful to build a DataSource adapter that simulates trades by many clients, as a result the Trading API library permits this functionality to be built.

For this case the libtrading_ds.a library should be used and the following compilation macros defined prior to include ctl.h: -DHAVE_DSDK -DHAVE_CLIENT_API.

Function Documentation

ctl_trade* ctl_channel_create_trade ( ctl_provider provider,
ctl_channel channel,
const char *  model 
)

Create a trade on the specified trade channel.

Parameters
provider- The trading provider.
channel- The trade channel to create the trade on.
model- The trade model of the trade to create.
Returns
The newly created trade.
ctl_trade* ctl_channel_create_trade_with_requestid ( ctl_provider provider,
ctl_channel channel,
const char *  model,
const char *  id 
)

Create a trade on the specified trade channel.

Parameters
provider- The trading provider.
channel- The trade channel to create the trade on.
model- The trade model of the trade to create.
id- The request id of the trade.
Returns
The newly created trade.
ctl_provider* ctl_create_ds_client_provider ( int  num_models,
const char *const *  models 
)

Create a DataSource client Trading provider.

Parameters
num_models- Number of trade model files to read
models- An array of XML files that contain trademodel definitions
Returns
A new provider
ctl_provider* ctl_create_sl_provider ( streamlink *  sl,
int  num_models,
const char *const *  models 
)

Create a StreamLink trading provider.

Parameters
sl- The StreamLink instance to send messages on
num_models- Number of trade model files to read
models- An array of XML files that contain trademodel definitions
Returns
A new provider
ctl_channel* ctl_provider_create_channel ( ctl_provider provider,
const char *  subject,
ctl_channel_listener listener,
void *  context 
)

Create a trade channel using the supplied provider.

Parameters
provider- The StreamLink provide on which to create the channel.
subject- The subject of the trade channel
listener- The listener to call
context- A context pointer for the listener
Returns
A new (or previously existing) trade channel object.

The subject will usually be in the form /PRIVATE/TRADE for StreamLink applications and /PRIVATE/username/TRADE for DataSource client Adapters.,

Note
If you call this function from the main DataSource thread then your application will deadlock.
void ctl_provider_set_application_listener ( ctl_provider provider,
ctl_app_listener listener,
void *  context 
)

Set the application listener for the supplied provider.

Parameters
provider- The Trading provider
listener- The application listener that will receive notification of trade channel opens and closes.
context- A callback context for the listener parameter

Should a trading channel not be established (due to a Trading adapter not being connected), then the channel_closed() method of the interface will be invoked.

Note
It is not recommended to change the ctl_app_listener on a server Trading provider.

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