【问题标题】:Database tables for QuickFIX/JQuickFIX/J 的数据库表
【发布时间】:2014-03-03 00:23:56
【问题描述】:

QuickFIX/J 包含用于创建四个数据库表的 SQL 脚本:

  • sessions
  • messages
  • messages_log
  • event_log

我找不到任何描述这些表格用途的文档。

它们的用途是什么,它们何时被写入,它们中的任何一个是否会无限增长,等等......

【问题讨论】:

  • 说 QuickFIX/J 需要四个数据库表是一种误导。数据库的使用在 QuickFIX/J 中是可选的(对于会话状态和日志来说是可选的),如果您的性能要求不高,则不建议使用。会话状态表将在每个会话开始时被清除。日志表将无限增长,因此您在某个时候需要某种类型的存档方法。
  • 谢谢弗兰克。这是个好的观点。问题已更新。

标签: quickfix quickfixj


【解决方案1】:

一些表用于 store,其他表用于 logging*_log 表。)store 是必需的QuickFIX/J 进行操作(它跟踪会话状态并支持重新发送消息),而日志是可选的。


sessions

此表跟踪活动的 FIX 会话。会话具有以下 primary key 声明中显示的八个值的组合键。

creation_time 用于确定这适用于哪个会话。

*_seqnum 列跟踪会话的当前序列号,并与重新发送请求一起用于可靠性。

create table sessions (
  beginstring  char(8) not null,
  sendercompid varchar(64) not null,
  sendersubid  varchar(64) not null,
  senderlocid  varchar(64) not null,
  targetcompid varchar(64) not null,
  targetsubid  varchar(64) not null,
  targetlocid  varchar(64) not null,
  session_qualifier varchar(64) not null,
  creation_time timestamp not null,
  incoming_seqnum integer not null,
  outgoing_seqnum integer not null,
  primary key (beginstring, sendercompid, sendersubid, senderlocid,
               targetcompid, targetsubid, targetlocid, session_qualifier)
);

messages

此表提供在活动会话期间发送的 FIX 消息的持久存储。如果正在与之通信的一方要求重新发送消息,QuickFIX/J 将使用此表来确定消息的内容。

在每个会话开始时,session_qualifier 的消息被删除。因此,此表不会无限增长,其大小的上限取决于会话期间可以发送多少消息。

create table messages (
  beginstring char(8) not null,
  sendercompid varchar(64) not null,
  sendersubid varchar(64) not null,
  senderlocid varchar(64) not null,
  targetcompid varchar(64) not null,
  targetsubid varchar(64) not null,
  targetlocid varchar(64) not null,
  session_qualifier varchar(64) not null,
  msgseqnum integer not null,
  message text not null,
  primary key (beginstring, sendercompid, sendersubid, senderlocid,
               targetcompid, targetsubid, targetlocid, session_qualifier,
               msgseqnum)
);

messages_log

QuickFIX/J 可以将所有入站/出站消息记录到数据库中。从库的角度来看,该表是只写的,因此是否要使用此表取决于您。

可以在配置中为入站和出站消息日志指定不同的表。默认情况下,所有消息都记录到一个表中。

create sequence messages_log_sequence;

create table messages_log (
  id integer default nextval('messages_log_sequence'),
  time timestamp not null,
  beginstring char(8) not null,
  sendercompid varchar(64) not null,
  sendersubid varchar(64) not null,
  senderlocid varchar(64) not null,
  targetcompid varchar(64) not null,
  targetsubid varchar(64) not null,
  targetlocid varchar(64) not null,
  session_qualifier varchar(64),
  text text not null,
  primary key (id)
);

event_log

将事件日志写入此表。示例包括:

Session FIX.4.2:FOO->BAR 时间表是每天,07:00:00-UTC - 21:00:00-UTC

创建的会话:FIX.4.2:FOO->BAR

发起登录请求

收到登录信息

create sequence event_log_sequence;

create table event_log (
  id integer default nextval('event_log_sequence'),
  time timestamp not null,
  beginstring char(8) not null,
  sendercompid varchar(64) not null,
  sendersubid varchar(64) not null,
  senderlocid varchar(64) not null,
  targetcompid varchar(64) not null,
  targetsubid varchar(64) not null,
  targetlocid varchar(64) not null,
  session_qualifier varchar(64),
  text text not null,
  primary key (id)
);

正如@DumbCoder 指出的那样,表名可以通过配置自定义。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-17
  • 1970-01-01
相关资源
最近更新 更多