0

I'm trying to connect my F# app with FIXImulator. FIXImulator is running on local machine and listening on port 9878. The application compiles and runs (it also works in interactive mode).

However, the connection is never established. I don't think the problem is with my code since it runs and tries to establish the connection. Below the method that does that:

    type FIXEngine() =
        let settings = new SessionSettings(@"C:\Users\pw\Documents\Visual Studio 2013\Projects\FSharpForQuantFirst\TradingSystem\config.cfg")
        let application = new ClientInitiator()
        let storeFactory = FileStoreFactory(settings)
        let logFactory = new ConsoleLogFactory(settings)
        let messageFactory = new MessageFactory()
        let initiator = new SocketInitiator(application, storeFactory, settings)
        let ids = initiator.GetSessionIDs()
        let st = initiator.Start() |> ignore
        member this.init() : unit = ()
        member this.start() : unit = initiator.Start()

The initiator has a Connected flag. The flag is set to false. Also no session IDs are returned.

I initialize my code in the main module:

    module Main = 
    let fixEngine = new FIX.FIXEngine()
    fixEngine.init()
    fixEngine.start()
    [<EntryPoint>]
    let main argv = 
        printfn "%A" argv
        0

My application is using the following config file:

[DEFAULT]
ConnectionType=initiator
ReconnectInterval=60
SenderCompID=TRADINGSYSTEM

[SESSION]
BeginString=FIX.4.2
TargetCompID=FIXIMULATOR
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
ReconnectInterval=10
SocketConnectPort=9878
SocketConnectHost=0.0.0.0
FileStorePath=temp
ValidateUserDefinedFields=N

ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y

The FIXImulator's config is as follows:

[DEFAULT]
FIXimulatorLogToFile=N
FIXimulatorLogToDB=N
FIXimulatorAutoPendingCancel=N
FIXimulatorAutoPendingReplace=N
StartTime=00:00:00
FIXimulatorSendOnBehalfOfCompID=N
FIXimulatorAutoAcknowledge=N
FIXimulatorAutoCancel=N
FIXimulatorAutoReplace=N
FIXimulatorPricePrecision=4
FIXimulatorSendOnBehalfOfSubID=N
SocketAcceptPort=9878
RefreshMessageStoreAtLogon=Y
BeginString=FIX.4.2
HeartBtInt=30
EndTime=00:00:00
ConnectionType=acceptor
DataDictionary=FIX42.xml
FileStorePath=data
FIXimulatorCachedObjects=50
JdbcURL=jdbc:mysql://localhost:3306/quickfix
JdbcUser=fiximulator
JdbcPassword=fiximulator
JdbcDriver=com.mysql.jdbc.Driver

[SESSION]
FileLogPath=logs
OnBehalfOfSubID=DESK
TargetCompID=TRADINGSYSTEM    
SenderCompID=FIXIMULATOR
OnBehalfOfCompID=BROKER

I've been playing with different configuration settings but after two days I'm running low on ideas.

The code comes from "F# for Quantitative Finance". Any help with establishing the connection highly appreciated.

PiotrWolkowski
  • 8,408
  • 6
  • 48
  • 68
  • I suspect the problem is in the line `SocketConnectHost=0.0.0.0` – Petr Feb 06 '15 at 02:16
  • I tired 127.0.0.1 and 192.168.0.1. The 0.0.0.0 is what's displayed in the console when I start the FIXImulator. It says: Listening for connections at 0.0.0.0/0.0.0.0:9878 so I gave it a go as well. – PiotrWolkowski Feb 06 '15 at 02:24
  • @Petr Actually, after eliminating other issues I had to return to a localhost IP (127.0.0.1) so your suggestion was definitely a part of the solution – PiotrWolkowski Feb 07 '15 at 21:33

1 Answers1

0

One issue was, as suggested in a comment, target IP address in the first config file. I had to change it from 0.0.0.0 back to 127.0.0.1.

Apart from that I found two other problems in the code above.

One problem was that I tried to get the session IDs before the connection was started:

initiator.GetSessionIDs()

Secondly, I was trying to start the FIXEngine twice. From the body of FIXEngine and from the Main module. After removing Start and GetSessionIDs from the body of the FIXEngine type I connected to FIXImulator without a trouble.

PiotrWolkowski
  • 8,408
  • 6
  • 48
  • 68