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

fix[trade]latest timestamp #266

Merged
merged 3 commits into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/plugins/jx3/price_goods/lib/GoodsPrice.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, prices: list = None) -> None:
key = ['created', 'n_count', 'unit_price']
self.prices = [[x.get(k) for k in key] for x in prices] # 创建时间 数量 单价
self.valid_price = self.get_valid_price()
self.latest = None # 最新数据时间
self.latest = 0 # 最新数据时时间戳
super().__init__()

def get_valid_price(self, prices: list = None):
Expand All @@ -49,7 +49,7 @@ def get_valid_price(self, prices: list = None):
self.price_valid = GoodsPriceDetail.InvalidPrice
return self.price_valid
prices.sort(key=lambda x: x[2]) # 按价格升序排列
self.latest = max(prices, key=lambda x: x[1])
self.latest = int(max(prices, key=lambda x: x[1])[0]) * 1e3

total_price = 0
self.price_lowest = prices[0][2]
Expand Down