From b4bea248025cf4f2ab2a7f9b9b834e81b7345c80 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 11 Jun 2019 11:21:03 +0800 Subject: [PATCH] [Mod] relpace bar second/microsecond to 0 when force generated, #1815 --- vnpy/trader/utility.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vnpy/trader/utility.py b/vnpy/trader/utility.py index bdd3f93d..1843b31f 100644 --- a/vnpy/trader/utility.py +++ b/vnpy/trader/utility.py @@ -253,6 +253,9 @@ class BarGenerator: """ Generate the bar data and call callback immediately. """ + self.bar.datetime = self.bar.datetime.replace( + second=0, microsecond=0 + ) self.on_bar(self.bar) self.bar = None