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']
 | 
			
		||||
ACTIVITY =['RESTRICTED','WEAK','GROWING','STRONG']
 | 
			
		||||
 | 
			
		||||
class MarketEntry:
 | 
			
		||||
  buy: int
 | 
			
		||||
  sell: int
 | 
			
		||||
  volume: int
 | 
			
		||||
  supply: int
 | 
			
		||||
  activity: int
 | 
			
		||||
  history: List[Tuple[int, int, int, int, int, int]] = []
 | 
			
		||||
  def __init__(self):
 | 
			
		||||
    self.buy = 0
 | 
			
		||||
    self.sell = 0
 | 
			
		||||
    self.volume = 0
 | 
			
		||||
    self.supply = 0
 | 
			
		||||
    self.activity = 0
 | 
			
		||||
    self.history = []
 | 
			
		||||
  
 | 
			
		||||
  def upg(self):
 | 
			
		||||
    if not hasattr(self, 'history'):
 | 
			
		||||
      self.history = []
 | 
			
		||||
      
 | 
			
		||||
  def f(self, detail=1):
 | 
			
		||||
    self.upg()
 | 
			
		||||
    return f'b: {self.buy} s:{self.sell} hist: {len(self.history)}'
 | 
			
		||||
    
 | 
			
		||||
  def add(self, buy, sell, volume, supply, activity):
 | 
			
		||||
    self.upg()
 | 
			
		||||
    self.buy = buy
 | 
			
		||||
    self.sell = sell
 | 
			
		||||
    self.volume = volume
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user