Skip to content

Instantly share code, notes, and snippets.

@mrtopf
Last active December 15, 2015 08:09
Show Gist options
  • Save mrtopf/5228439 to your computer and use it in GitHub Desktop.
Save mrtopf/5228439 to your computer and use it in GitHub Desktop.
python script to compute profit for planetary interaction converting toxic metals and precious metals to enriched uranium
#coding=utf-8
import locale
locale.setlocale(locale.LC_ALL, 'en_US')
"""
Compute the profit per day for enriched uranium or other stuff
"""
def curr(value, currency=u" ISK"):
"""format currency aware"""
try:
return locale.format("%d", float(value), grouping=True)+currency
except:
return value
# prices
input_price1 = 410 # toxic metals
input_price2 = 676.01 # precious metals
output_price = 12525 # what we get per item
print "input price 1: ", curr(input_price1)
print "input price 2: ", curr(input_price2)
print "output price : ", curr(output_price)
print
# this is what we need and get per hour
amount1 = 40 # amount of input material 1
amount2 = 40 # amount of input material 2
final_amount = 5 # amount of output material
installations = 12 # number of installations per planet
# base prices for source and final materials
buy_price = amount1 * input_price1 + amount2 * input_price2
sell_price = final_amount * output_price
net_profit = sell_price - buy_price
print "net profit per installation per hour: ", curr(net_profit)
###
### TAXES per batch (1 hr in 1 installation)
###
p1_base_cost = 500 # from http://wiki.eveuniversity.org/Planetary_Interaction
p2_base_cost = 9000
tax_rate = 0.1 # 10 percent
import_fee = p1_base_cost * tax_rate * (amount1 + amount2) * 0.5
print
print "P1 items to import per batch: %s" %(amount1+amount2)
print "P2 items to export per batch: %s" %(final_amount)
print "Import fee per batch" , curr(import_fee)
export_fee = p2_base_cost * tax_rate * (final_amount)
print "Export fee per batch" , curr(export_fee)
# substract taxes from profit
final_profit = net_profit - import_fee - export_fee
print "final profit per installation per hour: ", curr(final_profit)
print "final profit for %s installations per hour: %s" %(installations, curr(final_profit * installations))
print "final profit for %s installations per day: %s" %(installations, curr(final_profit * installations * 24))
## compute the amount we need per day
print
print "amount of p1 item for %s installations for 24h: %s" %(installations, (amount1 + amount2) * installations * 24)
print "per type: %s" %(amount2 * installations * 24)
print "amount of p2 items for %s installations for 24h: %s" %(installations, final_amount * installations * 24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment