Trading API for C  7.0.0.309536
TradeEvent objects.

Typedefs

typedef struct ctl_tradeevent_s ctl_tradeevent
 Opaque handle representing a trade event. More...
 

Functions

ctl_tradeeventctl_trade_create_tradeevent (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade, const char *type)
 Create a new trade event. More...
 
void ctl_tradeevent_add_field (ctl_tradeevent *ev, const char *name, const char *value)
 Add a field to a trade event. More...
 
void ctl_tradeevent_dealloc (ctl_tradeevent *ev)
 Free up the trade event. More...
 
const char * ctl_tradeevent_get_field (ctl_tradeevent *ev, const char *name)
 Gets the value of a field on the tradeevent. More...
 
char const ** ctl_tradeevent_get_fields (ctl_tradeevent *ev, int *num_ptr)
 Gets all fields on the trade event. More...
 
const char * ctl_tradeevent_get_type (ctl_tradeevent *ev)
 Get the type of the trade event. More...
 

Detailed Description

A TradeEvent represents a single event acting on a Trade.

The event may be client generated and received through the ctl_trade_listener interface or it may be generated by custom code to be sent to the client using the ctl_trade_process_event() method.

A TradeEvent typically represents a message received from the client or sent by the server. A message contains a set of fields and values which can be accessed using the ctl_tradeevent_get_field() and ctl_tradeevent_get_fields() methods.

A Typical message represented by a TradeEvent might be:

Field Value
MsgType Execute
MsgVersion 5
RequestId 123
TradeId 456789
PriceVersion 3
BuySell BUY
Price 1.9950

Typedef Documentation

typedef struct ctl_tradeevent_s ctl_tradeevent

Opaque handle representing a trade event.

Function Documentation

ctl_tradeevent* ctl_trade_create_tradeevent ( ctl_provider provider,
ctl_channel channel,
ctl_trade trade,
const char *  type 
)

Create a new trade event.

Parameters
provider- The trading provider
channel- The trade channel
trade- The trade to set the listener on
type- The type of tradeevent to create (for example Open, Ack etc)
Returns
A new trade event (or NULL should the trade or channel not exist)
Note
This function can be called from any thread within your application.
void ctl_tradeevent_add_field ( ctl_tradeevent ev,
const char *  name,
const char *  value 
)

Add a field to a trade event.

Parameters
ev- The trade event to add the field to.
name- The name of the field to add.
value- The value of the field to add
void ctl_tradeevent_dealloc ( ctl_tradeevent ev)

Free up the trade event.

Parameters
ev- The event to free
const char* ctl_tradeevent_get_field ( ctl_tradeevent ev,
const char *  name 
)

Gets the value of a field on the tradeevent.

Parameters
ev- The tradeevent to query
name- The name of the field to get
Returns
The field value or NULL if the field isn't present
Note
The return value should not be freed.
char const** ctl_tradeevent_get_fields ( ctl_tradeevent ev,
int *  num_ptr 
)

Gets all fields on the trade event.

Parameters
ev- The tradeevent to query
num_ptr- Pointer to integer that will hold the number of fields on the event
Returns
An array of fields.

The fields are stored as fields[0] = fieldname0, fields[1] = fieldvalue0, fields[2]=fieldname1, fields[3]=fieldvalue1.

The returned value should be freed with ctl_free()

const char* ctl_tradeevent_get_type ( ctl_tradeevent ev)

Get the type of the trade event.

Parameters
ev- The tradeevent to query
Returns
The type of the trade event
Note
The return value should not be freed.

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