0

I am writing quickfix call for NewOrderSingle/NewOrderCancelRequest/NewOrderStatusRequest. Inorder to execute this request we need to fill one attribute that is AccountID.

As of now I am filling this attribute in each request individually like this-

So in each request i need to fill it. So i added this Account varibale in .cfg/settings file.

void Application::newOrderSingle44()
{
    FIX::Account account("shad_tmp);

    FIX44::NewOrderSingle newOrderSingle(
            queryClOrdID(), querySide() ,
            FIX::TransactTime(),queryOrdType());

    newOrderSingle.set( FIX::HandlInst('1') );
    newOrderSingle.set( querySymbol() );
    newOrderSingle.set( queryOrderQty() );
    newOrderSingle.set( queryTimeInForce() );
    newOrderSingle.set(account);

    queryHeader( newOrderSingle.getHeader() );

    if ( queryConfirm( "Send order" ) )
        FIX::Session::sendToTarget( newOrderSingle );
}

[SESSION]
BeginString=FIX.4.4
SenderCompID=TD_shad_dev_fix
TargetCompID=SHADSERVER_FIX
SocketConnectPort=10011
SocketConnectHost=10.250.2.8
FileStorePath=store
FileLogPath=log
ConnectionType=initiator
ResetOnLogon=N
ResetOnLogout=N
ResetOnDisconnect=N
ResetSeqNumFlag=N
DataDictionary=/mnt/d/quickfix/spec/FIX44.xml
Account=shad_tem

This is my client code to read from the settings file.

FIX::Initiator * initiator = 0;
try
{
    FIX::SessionSettings settings( file );
    
    const FIX::Dictionary& dict = settings.get();

    std::string Account;
    for (auto it = dict.begin(); it!=dict.end(); it++)
    {
        if(it->first.find("Account"))
            Account = it->second;
    }

    std::cout<<"Account ID----------->"<<Account<<std::endl;

    Application application;
    FIX::FileStoreFactory storeFactory( settings );
    FIX::ScreenLogFactory logFactory( settings );

    if (isSSL.compare("SSL") == 0)
        initiator = new FIX::ThreadedSSLSocketInitiator( application, storeFactory, settings, logFactory );
    else
        initiator = new FIX::SocketInitiator( application, storeFactory, settings, logFactory );

    initiator->start();
    application.run();
    initiator->stop();
    delete initiator;

    return 0;
}

But this is not working. Can any one please let me know how to read this Account value from setting file??

Let me know is there any other to read this Account value from setting file and save it in any varibale and use it in any requrest . I mean wherever required.

alshamsh93
  • 29
  • 4

0 Answers0