Skip to content

Commit

Permalink
Allow OrigTimestamp field to be ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
reverendken committed Dec 30, 2024
1 parent 5185ff8 commit f74c691
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1126,4 +1126,17 @@ const (
// - Y
// - N
EnableNextExpectedMsgSeqNum string = "EnableNextExpectedMsgSeqNum"

// CheckOriginalTimestamp if set to Y, the FIX engine will check the OrigSendingTime (tag 122) in the header of incoming messages.
// When enabled, if the OrigSendingTime is not present or the original sending time is later than the SendingTime (tag 52),
// the message will be rejected.
//
// Required: No
//
// Default: Y
//
// Valid Values:
// - Y
// - N
CheckOriginalTimestamp string = "CheckOriginalTimestamp"
)
4 changes: 4 additions & 0 deletions in_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ func (state inSession) doTargetTooLow(session *session, msg *Message, rej target
return logoutState{}
}

if session.SessionSettings.DisableCheckOriginalTimestamp {
return state
}

if !msg.Header.Has(tagOrigSendingTime) {
if err := session.doReject(msg, RequiredTagMissing(tagOrigSendingTime)); err != nil {
return handleStateError(session, err)
Expand Down
2 changes: 2 additions & 0 deletions internal/session_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type SessionSettings struct {
MaxLatency time.Duration
DisableMessagePersist bool

DisableCheckOriginalTimestamp bool

// Required on logon for FIX.T.1 messages.
DefaultApplVerID string

Expand Down
9 changes: 9 additions & 0 deletions session_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ func (f sessionFactory) newSession(
}
}

if settings.HasSetting(config.CheckOriginalTimestamp) {
var checkTimestamp bool
if checkTimestamp, err = settings.BoolSetting(config.CheckOriginalTimestamp); err != nil {
return
}

s.DisableCheckOriginalTimestamp = !checkTimestamp
}

if settings.HasSetting(config.CheckLatency) {
var doCheckLatency bool
if doCheckLatency, err = settings.BoolSetting(config.CheckLatency); err != nil {
Expand Down

0 comments on commit f74c691

Please sign in to comment.