Skip to content

Commit e0976e6

Browse files
committed
prime PortfolioAccount add update timestamp
1 parent 5841e66 commit e0976e6

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tigeropen/trade/domain/prime_account.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ class PortfolioAccount:
99
"""
1010
prime/paper account assets
1111
"""
12-
def __init__(self, account):
12+
def __init__(self, account, timestamp=None):
13+
"""
14+
:param account:
15+
:param timestamp: asset update timestamp in milliseconds.
16+
"""
1317
self.account = account
18+
self.timestamp = timestamp
1419
self._segments = dict()
1520

1621
@property
@@ -28,7 +33,7 @@ def add_segment(self, segment):
2833
return self._segments.get(segment.category)
2934

3035
def __repr__(self):
31-
d = {'account': self.account, 'segments': self.segments}
36+
d = {'account': self.account, 'timestamp': self.timestamp, 'segments': self.segments}
3237
return MODEL_REPR.format(self.__class__.__name__, d)
3338

3439

tigeropen/trade/response/prime_assets_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def parse_response_content(self, response_content):
2020
self._is_success = response['is_success']
2121

2222
if self.data:
23-
assets = PortfolioAccount(self.data['accountId'])
23+
assets = PortfolioAccount(self.data.get('accountId'), self.data.get('updateTimestamp'))
2424

2525
for segment_data in self.data.get('segments', list()):
2626
segment = Segment()

0 commit comments

Comments
 (0)