我試圖用FIXImulator連接我的F#應用程序。 FIXImulator在本地機器上運行,並監聽端口9878.應用程序編譯並運行(它也以交互模式運行)。將F#應用程序連接到FIXImulator
但是,連接永遠不會建立。我認爲問題不在於我的代碼,因爲它運行並嘗試建立連接。下面,做的方法:
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()
的initiator
有Connected
標誌。該標誌設置爲false
。也沒有會話ID被返回。
我初始化我的代碼主要模塊:
module Main =
let fixEngine = new FIX.FIXEngine()
fixEngine.init()
fixEngine.start()
[<EntryPoint>]
let main argv =
printfn "%A" argv
0
使用下面的配置文件我的應用程序:
[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
的FIXImulator的配置如下:
[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
我一直在玩不同的配置設置,但兩天後,我的想法很不樂觀。
代碼來自「F#for Quantitative Finance」。任何幫助建立連接高度讚賞。
我懷疑問題是在'SocketConnectHost = 0.0.0.0'這行中 – Petr 2015-02-06 02:16:44
我累了127.0.0.1和192.168.0.1。當我啓動FIXImulator時,控制檯中顯示的是0.0.0.0。它說:在0.0.0.0/0.0.0.0:9878監聽連接,所以我也放棄了。 – PiotrWolkowski 2015-02-06 02:24:17
@Petr其實,在消除其他問題後,我不得不返回到本地IP(127.0.0.1),所以你的建議絕對是解決方案的一部分 – PiotrWolkowski 2015-02-07 21:33:46