1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-08 05:20:03 +03:00

Round sell and buy prices down to integer

Fixes #135
This commit is contained in:
Jonathan Harris 2016-08-09 17:20:16 +01:00
parent ab4b1ff3d7
commit 9b54675cdb
3 changed files with 6 additions and 6 deletions

View File

@ -45,8 +45,8 @@ def export(data, kind=COMMODITY_DEFAULT, filename=None):
line = sep.join([
rowheader,
commodity['name'],
commodity['sellPrice'] and str(commodity['sellPrice']) or '',
commodity['buyPrice'] and str(commodity['buyPrice']) or '',
commodity['sellPrice'] and str(int(commodity['sellPrice'])) or '',
commodity['buyPrice'] and str(int(commodity['buyPrice'])) or '',
str(int(commodity['demand'])) if commodity['demandBracket'] else '',
bracketmap[commodity['demandBracket']],
str(int(commodity['stock'])) if commodity['stockBracket'] else '',

View File

@ -52,9 +52,9 @@ def export_commodities(data):
for commodity in data['lastStarport'].get('commodities', []):
commodities.append({
'name' : commodity['name'],
'buyPrice' : commodity['buyPrice'],
'buyPrice' : int(commodity['buyPrice']),
'supply' : int(commodity['stock']),
'sellPrice' : commodity['sellPrice'],
'sellPrice' : int(commodity['sellPrice']),
'demand' : int(commodity['demand']),
})
if commodity['stockBracket']:

4
td.py
View File

@ -43,8 +43,8 @@ def export(data):
for commodity in sorted(bycategory[category], key=itemgetter('name')):
h.write(' %-23s %7d %7d %9s%c %8s%c %s\n' % (
commodity['name'],
commodity['sellPrice'],
commodity['buyPrice'],
int(commodity['sellPrice']),
int(commodity['buyPrice']),
int(commodity['demand']) if commodity['demandBracket'] else '',
demandbracketmap[commodity['demandBracket']],
int(commodity['stock']) if commodity['stockBracket'] else '',