Last active
October 14, 2024 15:29
-
-
Save CodeZombie/299a7af30c644e536147410b8fb4ec8b to your computer and use it in GitHub Desktop.
runescape ge profit calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from collections import namedtuple | |
ProductVolPrice = namedtuple("ProductVolPrice", "volume price") | |
### INPUTS ZONE ################# | |
materials = { | |
"Loop Half": { | |
"contribution_rate": 0.5, | |
"volprices": [ | |
ProductVolPrice(100, 12000), | |
] | |
}, | |
"Tooth Half": { | |
"contribution_rate": 0.5, | |
"volprices":[ | |
ProductVolPrice(100, 11500), | |
] | |
} | |
} | |
sale_history = [ | |
ProductVolPrice(100, 25000), | |
] | |
conv_fee = 0.01 | |
### MATH ZONE ################### | |
total_items_for_sale = 0 | |
for material in list(materials.values()): | |
total_materials = 0 | |
for volprice in material["volprices"]: | |
total_materials += volprice.volume | |
total_items_for_sale += total_materials * material['contribution_rate'] | |
total_sold_items = 0 | |
total_cash_made = 0 | |
for prodvol in sale_history: | |
total_sold_items += prodvol.volume | |
total_cash_made += prodvol.volume * (prodvol.price - (prodvol.price * conv_fee)) | |
#tax = sale_price * conv_fee | |
#sale_price_after_tax = math.ceil(sale_price - tax) | |
#profit = sale_price_after_tax - material_cost | |
#minimum_sale_price = material_cost / (1 - conv_fee) | |
average_material_cost_per_item = 0 | |
print("\nMaterials:") | |
total_material_cost = 0 | |
for material in materials.keys(): | |
print(" {} ({})".format(material, sum([vp.volume for vp in materials[material]['volprices']]))) | |
total_cost = 0 | |
total_volume = 0 | |
for prod_vol_price in materials[material]['volprices']: | |
print(" {:4} @ {:,.2f}".format(prod_vol_price.volume, prod_vol_price.price)) | |
total_volume += prod_vol_price.volume | |
total_cost += prod_vol_price.price * prod_vol_price.volume | |
total_material_cost += prod_vol_price.price * prod_vol_price.volume | |
print(" Average Price Per: {:,.2f}".format(total_cost / total_volume)) | |
print("") | |
print(" Total Material Cost: {:,.2f}".format(total_material_cost)) | |
average_material_cost_per_item = total_material_cost / total_items_for_sale | |
print(" Total Items to Sell: {:,.2f}".format(total_items_for_sale)) | |
print(" Break even sale price: {:,.2f}".format( (total_material_cost / total_items_for_sale) / (1 - conv_fee))) | |
print("Completed Sales x{:,}".format(total_sold_items)) | |
money_made_after_tax = 0 | |
for sale_record in sale_history: | |
print(" {} @ {:,.2f}".format(sale_record.volume, sale_record.price)) | |
print(" Sale After Tax: {:,.2f}".format(sale_record.volume * (sale_record.price - (sale_record.price * conv_fee)))) | |
print(" Tax: {:,.2f}".format((sale_record.price * conv_fee) * sale_record.volume)) | |
money_made_after_tax += sale_record.volume * (sale_record.price - (sale_record.price * conv_fee)) | |
print(" Est. Profit Per: {:,.2f}".format((sale_record.price - (sale_record.price * conv_fee)) - average_material_cost_per_item)) | |
print("Total Profit: {:,.2f}".format(money_made_after_tax - total_material_cost)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment