QuickFix C#无法解析数据字典文件

时间:2015-09-14 10:42:50

标签: c# quickfix

我正在尝试创建QuickFix服务器和客户端。

这是我的QuickFix服务器。

class Program
{
    [STAThread]
    static void Main(string[] args)
    {
        try
        {
            SessionSettings settings = new SessionSettings(@"C:\Users\anhtv\Desktop\QuickFix\QuickFix\server.cfg");
            FixServerApplication application = new FixServerApplication();
            FileStoreFactory storeFactory = new FileStoreFactory(settings);
            ScreenLogFactory logFactory = new ScreenLogFactory(settings);
            MessageFactory messageFactory = new DefaultMessageFactory();
            SocketAcceptor acceptor = new SocketAcceptor(application, storeFactory, settings, logFactory, messageFactory);

            acceptor.start();
            Console.WriteLine("press <enter> to quit");
            Console.Read();
            acceptor.stop();
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }
}

这是我的server.cfg

# default settings for sessions
[DEFAULT]
FileStorePath=store
FileLogPath=log
ConnectionType=acceptor
ReconnectInterval=60
SenderCompID=ARCA
SOCKETACCEPTHOST=localhost 
SocketAcceptPort=5001

# session definition
[SESSION]
# inherit FileStorePath, FileLogPath, ConnectionType, ReconnectInterval and SenderCompID from default
BeginString=FIX.4.1
TargetCompID=TW
StartTime=12:30:00
EndTime=23:30:00
HeartBtInt=20
SocketAcceptPort=9823
DataDictionary=C:\Users\anhtv\Desktop\QuickFix\QuickFix\fix/FIX41.xml

[SESSION]
BeginString=FIX.4.0
TargetCompID=TW
StartTime=12:00:00
EndTime=23:00:00
HeartBtInt=30
SocketAcceptPort=8323
DataDictionary=C:\Users\anhtv\Desktop\QuickFix\QuickFix\fix/FIX40.xml

[SESSION] 
BeginString=FIX.4.2 
TargetCompID=TW 
StartTime=12:30:00 
EndTime=21:30:00 
# overide default setting for RecconnectInterval 
ReconnectInterval=30 
HeartBtInt=30 
SocketAcceptPort=6523 
# (optional) only listen for incoming connections on a specific host 
SocketAcceptHost=127.0.0.1 
DataDictionary=C:\Users\anhtv\Desktop\QuickFix\QuickFix\fix/FIX42.xml 

当我在线调试时

SocketAcceptor acceptor = new SocketAcceptor(application, storeFactory, settings, logFactory, messageFactory);

它运行捕获,异常:

Configuration failed: ..\spec\fix\FIX40.xml: Could not parse data dictionary file

我不明白为什么。找不到配置文件或错误? 有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

这条路径是否正确?那怪异的斜线怎么样?

DataDictionary=C:\Users\anhtv\Desktop\QuickFix\QuickFix\fix/FIX40.xml
                                                           ^

要么那个路径上没有文件(错字?),要么错误的斜线搞乱了。