49.9. 6. KeyValuePairField

KeyValuePairField 주석은 키 값 쌍 필드의 속성을 정의합니다. 각 KeyValuePairField는 태그(= 키) 및 연결된 값(문자열, int, date, …​, 선택 사항)으로 식별되고 필드가 필요한 경우 선택적으로 표시됩니다.

주석 이름레코드 유형level

KeyValuePairField

키 값 쌍 - FIX

속성

매개변수 이름type정보

tag

int

필수 - 메시지의 필드를 식별하는 숫자 - 고유해야 합니다.

패턴

string

선택 사항 - 기본값 = "" - # 10진수, 날짜, …​ 형식을 지정하는 데 사용됩니다.

Precision

int

선택 사항 - 숫자 번호의 서식/분수를 포맷/분할 때 사용할 전체 자릿수를 나타냅니다. optional - digit number - represents the precision to be used when the decimal number will be formatted/parsed.

위치

int

선택 사항 - FIX 메시지의 키/태그 위치가 다른 경우 사용해야 합니다.

필수 항목

boolean

optional - default value = "false"

impliedDecimalSeparator

boolean

Camel 2.11: 선택 사항 - 기본값 = "false" - 지정된 위치에 임차된 소수점이 있는지 여부를 나타냅니다.

케이스 1 : 태그

이 매개변수는 메시지에 있는 필드의 키를 나타냅니다.

FIX 메시지 - 태그

@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 메시지에 적용할 태그/키가 미리 정의된 순서에 따라 정렬되어야 하는 경우 주석 @KeyValuePairField의 'position' 특성을 사용합니다.

FIX 메시지 - 태그 - 정렬

@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;
}