Skip to content

Commit 062c7a3

Browse files
committed
[Mod] adjust timestamp precision for bybit gateway
1 parent f466add commit 062c7a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

vnpy/gateway/bybit/bybit_gateway.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,11 @@ def sign(secret: bytes, data: bytes) -> str:
11311131
def generate_datetime(timestamp: str) -> datetime:
11321132
""""""
11331133
if "." in timestamp:
1134+
part1, part2 = timestamp.split(".")
1135+
if len(part2) > 7:
1136+
part2 = part2[:6] + "Z"
1137+
timestamp = ".".join([part1, part2])
1138+
11341139
dt = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ")
11351140
else:
11361141
dt = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%SZ")

0 commit comments

Comments
 (0)