Classes | |
struct | ctl_trade_listener |
Listener interface that should be registered if you wish to receive events for a trade. More... | |
Typedefs | |
typedef struct ctl_trade_s | ctl_trade |
Opaque handle representing a trade. | |
Enumerations | |
enum | ctl_error { ctl_error_OK, ctl_error_FAILED_SOURCE_GUARD, ctl_error_INVALID_TRANSITION, ctl_error_UNKNOWN_CHANNEL, ctl_error_UNKNOWN_TRADE, ctl_error_INVALID_PARAMETERS, ctl_error_MISSING_REQUIRED_FIELD } |
Error codes used by the library. More... | |
Functions | |
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. | |
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. | |
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. | |
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. | |
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. | |
const char * | ctl_trade_get_state (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade) |
Get the current state of the specified trade. | |
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. | |
void * | ctl_trade_get_user_pointer (ctl_provider *provider, ctl_channel *channel, ctl_trade *trade) |
Gets the user pointer on the ctl_trade object. |
A Trade is initiated by a client and is tied to a ctl_channel. The lifecycle of a Trade consists of a number of messages, represented by TradeEvents, being sent between the client and the Trading System in both directions. These messages cause the Trade to transition between a number of predefined states.
A Trade is uniquely identified in two ways: by RequestId set by the client and a TradeId set by the Trading System.
enum ctl_error |
Error codes used by the library.
See ctl_error_tostring() which returns a textual description of the logging level.
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.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on | |
fieldname | - The fieldname to obtain the value of |
The returned field value is only valid if this function is called from a Trading API callback.
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.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on |
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.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on |
const char* ctl_trade_get_state | ( | ctl_provider * | provider, | |
ctl_channel * | channel, | |||
ctl_trade * | trade | |||
) |
Get the current state of the specified trade.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on |
void* ctl_trade_get_user_pointer | ( | ctl_provider * | provider, | |
ctl_channel * | channel, | |||
ctl_trade * | trade | |||
) |
Gets the user pointer on the ctl_trade object.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on |
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.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on | |
tradeevent | - The trade event to process |
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.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on | |
listener | - The listener to call | |
context | - A context pointer for the listener |
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.
provider | - The trading provider | |
channel | - The trade channel | |
trade | - The trade to set the listener on | |
ptr | - the pointer to store |