Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Fixed UTC timezone issue in PerpMarketDetails.
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Taylor committed Oct 16, 2021
1 parent 84173b6 commit c7090bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mango/perpmarketdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import typing

from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from decimal import Decimal
from solana.publickey import PublicKey

Expand Down Expand Up @@ -64,7 +64,7 @@ def __str__(self) -> str:
# portion_given = 1 - mngoLeft / mngoPerPeriod
# elapsed = (<current_time> - periodStart) / targetPeriodLength
# est_next = elapsed / portion_given - elapsed
now: datetime = datetime.now().replace(microsecond=0)
now: datetime = datetime.now().replace(microsecond=0).astimezone(timezone.utc)
mngo_distributed: TokenValue = self.mngo_per_period - self.mngo_left
proportion_distributed: Decimal = mngo_distributed.value / self.mngo_per_period.value
elapsed: timedelta = now - self.period_start
Expand Down

0 comments on commit c7090bf

Please sign in to comment.