搜索

49.9. 6.KeyValuePairField

download PDF

KeyValuePairField 注释定义键值对字段的属性。每个 KeyValuePairField 都由一个标签(= 键)及其值关联,一个类型(字符串,int、date、…​)、可选y 特征,以及是否需要该字段

注解名称记录类型级别

KeyValuePairField

Key Value Pair - FIX

属性

参数名称typeinfo

tag

int

Mandatory - 标识消息中的字段的数字数 - 必须是唯一的

pattern

string

可选 - 默认值 = "" - 将用于格式化 Decimal, Date, …​

精度

int

可选 - 数字数字 - 代表在 Decimal 数字将被格式化/解析时使用的精度

position

int

可选 - 当 FIX 消息中的 key/tag 的位置必须不同时,必须使用

required

布尔值

可选 - 默认值 = "false"

impliedDecimalSeparator

布尔值

Camel 2.11: 可选 - 默认值 = "false" - 代表在指定位置有一个十进制点表示

case 1 : tag

此参数表示消息中字段的键

FIX message - Tag

@Message(keyValuePairSeparator = "=", pairSeparator = "\u0001", type="FIX", version="4.1")
public class Order {

    @Link Header header;

    @Link Trailer trailer;

    @KeyValuePairField(tag = 1) // Client reference
    private String Account;

    @KeyValuePairField(tag = 11) // Order reference
    private String ClOrdId;

    @KeyValuePairField(tag = 22) // Fund ID type (Sedol, ISIN, ...)
    private String IDSource;

    @KeyValuePairField(tag = 48) // Fund code
    private String SecurityId;

    @KeyValuePairField(tag = 54) // Movement type ( 1 = Buy, 2 = sell)
    private String Side;

    @KeyValuePairField(tag = 58) // Free text
    private String Text;
}

问题单 2:输出中的不同位置

如果我们将放入 FIX 消息中的 tags/keys 必须根据预定义的顺序进行排序,则使用注释 @KeyValuePairField 的属性"position"

FIX message - Tag - sort

@Message(keyValuePairSeparator = "=", pairSeparator = "\\u0001", type = "FIX", version = "4.1", isOrdered = true)
public class Order {

    @Link Header header;

    @Link Trailer trailer;

    @KeyValuePairField(tag = 1, position = 1) // Client reference
    private String account;

    @KeyValuePairField(tag = 11, position = 3) // Order reference
    private String clOrdId;
}
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.