Update api.py, commander.py and one other file
This commit is contained in:
@@ -17,8 +17,16 @@ class Marketplace(SystemMember):
|
||||
self.setlst('exchange', d, 'exchange', 'symbol')
|
||||
if 'tradeGoods' in d:
|
||||
self.last_prices = time()
|
||||
prices = {}
|
||||
for g in mg(d, 'tradeGoods'):
|
||||
pass
|
||||
price = {}
|
||||
symbol= mg(g, 'symbol')
|
||||
price['symbol'] = symbol
|
||||
price['buy'] = mg(g, 'purchasePrice')
|
||||
price['sell'] = mg(g, 'sellPrice')
|
||||
prices[symbol] = price
|
||||
self.prices = prices
|
||||
|
||||
@classmethod
|
||||
def ext(self):
|
||||
return 'mkt'
|
||||
@@ -26,3 +34,11 @@ class Marketplace(SystemMember):
|
||||
def path(self):
|
||||
sector, system, _ = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'
|
||||
|
||||
def f(self, detail=1):
|
||||
r = self.symbol
|
||||
if detail > 1:
|
||||
r += '\n'
|
||||
for p in self.prices.values():
|
||||
r += f'{p["symbol"]:25s} {p["sell"]:5d} {p["buy"]:5d}\n'
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user