From 47a3891e722fd8ffcfd03e3be0334017b615aed6 Mon Sep 17 00:00:00 2001 From: Denis Tereshkin Date: Tue, 28 Jan 2020 20:26:39 +0700 Subject: [PATCH] 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. --- src/Broker/QuikBroker/Trans2QuikApi.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Broker/QuikBroker/Trans2QuikApi.hs b/src/Broker/QuikBroker/Trans2QuikApi.hs index 30ab5d4..e1c1efe 100644 --- a/src/Broker/QuikBroker/Trans2QuikApi.hs +++ b/src/Broker/QuikBroker/Trans2QuikApi.hs @@ -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