How to call new_order_single() function in a timer in myfix.cpp

34 views
Skip to first unread message

Jack Peter

unread,
Feb 16, 2016, 1:52:30 AM2/16/16
to fix8 developer
Hi,

I want to ask how to call new order function in a timer when FIX client runs in FIX 4.2 version.

Currently in myfix.cpp file in test directory in FIX 4.2 source code for Linux, 

myfix.cpp file:
const MyMenu::Handlers MyMenu::_handlers
{
{ { 'n', "New Order Single" }, &MyMenu::new_order_single },
}

When we run fix client by using this command ./f8test -l client then client is running and after pressing "?" for help and giving "n" key so, new order single function is called and order is placed from FIX.

Is there any way to call this new_order_single function in a timer when FIX client starts and bypassing this "n" input key?

I have put up a timer event, in myfix.cpp in single client only section, in FIX code,

 TimerEvent<FIX8::Session> sample_callbackclient(static_cast<bool (FIX8::Session::*)()>(&myfix_session_client::schedule_callback), true);
 mc->session_ptr()->get_timer().schedule(sample_callbackclient, 5000);

And make schedule_callback() event of myfix_session_client session.

bool myfix_session_client::schedule_callback()
{
        //ClientSessionBase *mc;
        //MyMenu mymenu(*mc->session_ptr(), 0, cout);

        cout << "myfix_session_client::schedule_callback event called!" << endl;
        //mymenu.new_order_single();        
        return true;
}

Here, how to pass ClientsessionBase * to this callback function in FIX so, mymenu.new_order_single() will be called?

If anybody has any idea, then please suggest it how to call new_order_single() FIX function for new order processing in a timer when f8test client application starts?







Reply all
Reply to author
Forward
0 new messages