Browse Source

Quik broker: adjust timestamp (MSK -> UTC)

Currently, trans2quik callback is called with MSK timestamps, so
production trades receive MSK timestamp. On the other hand,
PaperBroker sets UTC timestamps. For consistency all trade timestamps
should be in one timezone, that is, UTC.
master
Denis Tereshkin 6 years ago
parent
commit
47a3891e72
  1. 3
      src/Broker/QuikBroker/Trans2QuikApi.hs

3
src/Broker/QuikBroker/Trans2QuikApi.hs

@ -526,8 +526,9 @@ defaultTradeCb state mode dnumber orderNum classCode secCode price qty value sel @@ -526,8 +526,9 @@ defaultTradeCb state mode dnumber orderNum classCode secCode price qty value sel
qtSell = sell == 1,
qtVolume = toDouble value,
qtVolumeCurrency = currency,
qtTimestamp = mkTimestamp ymd hms us
qtTimestamp = adjustTimestamp $ mkTimestamp ymd hms us
}
adjustTimestamp = addUTCTime (-3 * 3600) -- MSK -> UTC
mkTimestamp ymd hms us = UTCTime (fromGregorian y mon d) (fromInteger (h * 3600 + m * 60 + s) + fromRational (us % 1000000))
where
y = ymd `div` 10000

Loading…
Cancel
Save