fix marketplace history
This commit is contained in:
parent
5d47efdbda
commit
b5b736df63
@ -8,18 +8,26 @@ from typing import List, Tuple
|
|||||||
|
|
||||||
SUPPLY = ['SCARCE','LIMITED','MODERATE','HIGH','ABUNDANT']
|
SUPPLY = ['SCARCE','LIMITED','MODERATE','HIGH','ABUNDANT']
|
||||||
ACTIVITY =['RESTRICTED','WEAK','GROWING','STRONG']
|
ACTIVITY =['RESTRICTED','WEAK','GROWING','STRONG']
|
||||||
|
|
||||||
class MarketEntry:
|
class MarketEntry:
|
||||||
buy: int
|
def __init__(self):
|
||||||
sell: int
|
self.buy = 0
|
||||||
volume: int
|
self.sell = 0
|
||||||
supply: int
|
self.volume = 0
|
||||||
activity: int
|
self.supply = 0
|
||||||
history: List[Tuple[int, int, int, int, int, int]] = []
|
self.activity = 0
|
||||||
|
self.history = []
|
||||||
|
|
||||||
|
def upg(self):
|
||||||
|
if not hasattr(self, 'history'):
|
||||||
|
self.history = []
|
||||||
|
|
||||||
def f(self, detail=1):
|
def f(self, detail=1):
|
||||||
|
self.upg()
|
||||||
return f'b: {self.buy} s:{self.sell} hist: {len(self.history)}'
|
return f'b: {self.buy} s:{self.sell} hist: {len(self.history)}'
|
||||||
|
|
||||||
def add(self, buy, sell, volume, supply, activity):
|
def add(self, buy, sell, volume, supply, activity):
|
||||||
|
self.upg()
|
||||||
self.buy = buy
|
self.buy = buy
|
||||||
self.sell = sell
|
self.sell = sell
|
||||||
self.volume = volume
|
self.volume = volume
|
||||||
|
Loading…
Reference in New Issue
Block a user