Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

sendMessage

Send FIX message to FIX Flyer Engine

Syntax

status = sendMessage(c,fixmsg)

Description

example

status = sendMessage(c,fixmsg) sends the FIX message fixmsg using the FIX Flyer™ Engine connection c.

Examples

collapse all

First, create a FIX Flyer Engine connection. Then, add a FIX Flyer event listener to the FIX Flyer Engine connection. Subscribe to FIX sessions. Create and send two FIX messages.

Create the FIX Flyer Engine connection c using these arguments:

  • User name username

  • Password password

  • IP address ipaddress

  • Port number port

username = 'user';
password = 'pwd';
ipaddress = '127.0.0.1';
port = 7002;

c = fixflyer(username,password,ipaddress,port);

Add the FIX Flyer event listener to the FIX Flyer Engine connection. Use the sample event handling listener fixExampleListener to listen for and display the FIX Flyer Engine event data in the Workspace browser. To access the code for the listener, enter edit fixExampleListener.m. Or, to process the event data in another way, you can write a custom event handling listener function. For details, see Create Functions in Files (MATLAB).

Process the FIX Flyer Engine events e using the sample event handling listener fixExampleListener. Specify e as any letter. fixExampleListener returns a handle to the listener lh.

lh = addListener(c,@(~,e)fixExampleListener(e,c));

Subscribe to FIX sessions and set up the FIX Flyer Application Manager. Register with the FIX Flyer session. Connect the FIX Flyer Application Manager to the FIX Flyer Engine and start the internal receiving thread.

c.SessionID = flyer.core.session.SessionID('Alpha',...
                                           'Beta','FIX.4.4');
c.FlyerApplicationManager.setLoadDefaultDataDictionary(false);
c.FlyerApplicationManager.registerFIXSession(...
                                            flyer.apps.FixSessionSubscription(...
                                            c.SessionID,true,0));
c.FlyerApplicationManager.connect;
c.FlyerApplicationManager.start;

Create a FIX message using table fixtable. This table contains two FIX messages. The first row in the table represents a sell side transaction for 100 shares of symbol ABC. The order type is a previously quoted order. The order handling instruction is a private automated execution. The order transaction time is the current moment. The second row in the table has the same order field variables, except that the order identifier is unique across orders. The FIX protocol version is 4.4.

fixtable = table({'FIX.4.4';'FIX.4.4'},...
                 {'338';'339'},{'2';'2'},...
                 {datestr(now);datestr(now)},...
                 {'D';'D'},{'ABC';'ABC'},...
                 {'1';'1'},{'D';'D'},{'100';'100'},...
                 'VariableNames',{'BeginString' ...
                 'CLOrdId' 'Side' 'TransactTime' ...
                 'OrdType' 'Symbol' ...
                 'HandlInst' 'MsgType' 'OrderQty'});

Send the FIX message using the FIX message fixtable.

status contains the FIX Flyer Engine message status for each FIX message sent. If the FIX message is sent successfully, status contains a logical zero. status has an entry for each FIX message in fixtable.

status = sendMessage(c,fixtable)
status =

       0
       0

The MATLAB® Workspace variable fixResponseStruct contains the returned FIX messages from the FIX Flyer Engine.

Close the FIX Flyer Engine connection.

close(c)

Input Arguments

collapse all

FIX Flyer Engine connection, specified as a fixflyer object.

FIX message, specified as a table or structure.

Example: fixtable = table({'FIX.4.4';'FIX.4.4'},...
{'338';'339'},{'2';'2'},...
{datestr(now);datestr(now)},...
{'D';'D'},{'ABC';'ABC'},...
{'1';'1'},{'D';'D'},{'100';'100'},...
'VariableNames',{'BeginString' ...
'CLOrdId' 'Side' 'TransactTime' ...
'OrdType' 'Symbol' ...
'HandlInst' 'MsgType' 'OrderQty'});

Data Types: table | struct

Output Arguments

collapse all

Sent message status, returned as an array of logical zeroes or ones. The array contains an entry for each FIX message in fixmsg. If a FIX message is sent successfully, status contains a zero. Otherwise, status contains a 1.

Introduced in R2015b

Was this topic helpful?