Jump to content

NEW VIDEO: I Quit MMOs and THIS Happened

Total Steam Expense Script


ArcaneCoder

Recommended Posts

I have written and tested a small python script that reads a text file of data copied directly from Steam transaction history to calculate the total spent on Steam games. Spoiler, it's a lot more than I thought it was!

Program Code

print("The total cost of steam purchases.")

transactions = 0
transaction_counter = 0
transaction_history = open("steam-transaction-history.txt")

for next_line in transaction_history:
		
	if (next_line[:3] in ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") and ("\n" in next_line[:14])):
		print("\nFound valid date: " + str(next_line[:12]))
		title = transaction_history.readline()
		while not ("Purchase\n" in title):
			print(title[:-1])
			title = transaction_history.readline()
		next_line = title
		
	if "Purchase\n" in next_line:
		if transaction_history.readline().split(" ")[0] in ("Visa", "PayPal\n", "American", "MasterCard", "Discover", "JCB"):
			purchase = transaction_history.readline()
			transaction_counter += 1
			print(str(transaction_counter) + ": " + str(purchase[:6]))
			transactions += float(purchase[1:6])

print("\nYour total expenditure on Steam is: $" + str(round(transactions, 2)))

Instructions

  1. Download attached .py script Copy code above to a file with a .py extension in a directory (desktop is fine) ie steam-total-cost.py
  2. Log in to Steam (you can do this in browser at steam login webpage if you don't have steam installed)
    1. Kudos to you for uninstalling Steam if so.
  3. Click {username} in top left -> Account Details -> View Purchase History
  4. Scroll down and click Load More
  5. ctrl + a -> ctrl + c
  6. Create a txt file in the same directory as the python program, naming it steam-transaction-history.txt
  7. Open the text file -> ctrl + v -> ctrl + s
    1. don't worry about any excess text like Valve info at header and footer of file
    2. don't reformat
  8. Open your system terminal -> navigate to the chosen directory (ie desktop)
    1. If you don't know how to use your system terminal, then search how to change directory, list files in current directory, etc for your OS/terminal.
  9. type
    python3 steam-total-cost.py
    and press enter
    1. you may need to install python; google python cli installation for {your OS} and follow instructions
  10. Share the total below. Behold in humiliation how much you and others have spent. 😦

Truncated Output

Quote

The total cost of steam purchases.

...{other purchases redacted for brevity}...

Found valid date: Dec 29, 2012
Dawn of War Franchise Pack
96: $19.99

Found valid date: Nov 13, 2012
A Game of Dwarves
97: $9.99    

Your total expenditure on Steam is: $1800.29

I had no idea I was averaging $17 / month on the steam store for almost a decade, and that doesn't include purchases on other platforms! 🤯

My code is far from perfect and my Python is very rusty. I'm much more familiar with Java. Let me know if you get strange output, unlike what I've shared above.

Edited by ArcaneCoder
grammar
  • Like 1
Link to comment
Share on other sites

  • ArcaneCoder changed the title to Total Steam Expense Script

I don't think I really want to know how much money I spent on Steam and all those other platforms.

I would be interested to know the total number of hours I wasted in said games, though, and also to reconstruct the history of my descent after I downloaded steam, lo these many long years ago.

  • Like 1
Link to comment
Share on other sites

22 hours ago, Zeno said:

I don't think I really want to know how much money I spent on Steam and all those other platforms.

I would be interested to know the total number of hours I wasted in said games, though, and also to reconstruct the history of my descent after I downloaded steam, lo these many long years ago.

Sure.

Script Code

print("The total playtime of steam games.\n")

total_playtime = 0
game_counter = 0
title_buffer = ""
playtime_history = open("steam-playtime-history.txt")

for next_line in playtime_history:
	if "hrs on record" in next_line:
		game_counter += 1
		playtime = float(next_line.split(" ")[0])
		print( str(game_counter) + ": " + str(title_buffer[:-1]) + " " + str(playtime) + "hrs\n" )
		total_playtime += playtime
		print( "Running total: " + str(round(total_playtime,1)) + "\n" )
	title_buffer = next_line

print( "A total of " + str(round(total_playtime,1)) + " hours across " + str(game_counter) + " games on steam." )
print( "\nExamples\n" )
print( "\t* Equivalent to " + str(round(total_playtime / 2000.00, 2) ) + " years of full-time work.\n" )
print( "\t* Equivalent to earning $" + str(round(total_playtime * 7.25, 2)) + " at a wage of $7.25.\n" )
print( "\t* Equivalent to studying for " + str(round(total_playtime / 4800.00, 2)) + " bachelors degrees.\n" )

Like OP, but file is named steam-playtime-history.txt and copy the data from: View profile -> Games.

Unfortunately, unless Valve stores playtime activity with timestamps, it's not probable the playtime can be broken down to the month or year. But, knowing when a game was bought, it's possible to relate the playtime to date of purchase.

Example Output

Quote

The total playtime of steam games.

1: Sid Meier's Civilization V 973.0hrs

Running total: 973.0

...{other games}...

152: Stronghold Crusader HD 0.1hrs

Running total: 11389.9

A total of 11389.9 hours across 152 games on steam.

Examples

    * Equivalent to 5.69 years of full-time work.

    * Equivalent to earning $82576.77 at a wage of $7.25.

    * Equivalent to studying for 2.37 bachelors degrees.

And to think, this excludes time I wasted on mmos and non-steam games. My first steam purchase was in late 2012.

Maybe next, I can combine logic from both scripts and generate a graph relating playtime to date of purchase to "reconstruct the history of my descent after I downloaded steam."

  • Like 1
Link to comment
Share on other sites

On 4/5/2021 at 6:56 AM, ArcaneCoder said:

My code is far from perfect and my Python is very rusty. I'm much more familiar with Java. Let me know if you get strange output, unlike what I've shared above.

Unfortunally I do not have steam on my computer anymore :).

On 4/9/2021 at 11:45 PM, ArcaneCoder said:

* Equivalent to 5.69 years of full-time work.

    * Equivalent to earning $82576.77 at a wage of $7.25.

    * Equivalent to studying for 2.37 bachelors degrees.

haha. man that hurts

  • Like 1
Link to comment
Share on other sites

Quote

The average Gamblers Anonymous member will have lost all his or her money and accumulated debts ranging from $35,000 to $92,000 before seeking treatment. PBS Frontline

Gamers accrue a kind of time debt by spending future gains for the present habit. Just like debt, these future gains compound into significant losses in potential earnings. Evaluating that loss by a factor of the federal minimum wage is a minimum estimate. Income gains accrue with education, experience and time (savings/property/stock).

It may not be obvious, but gaming addiction is just as harmful as that of gambling, if not more so, especially if you start young.

So yeah, that $82.5k low-ball loss in potential income stings, a lot. Had I spent the first half of that time, from 2013 to 2016, finishing a degree or professional training, my 2017-to-present earnings would likely be $160k+ for any degree/training ($40k/year), or $240k+ for STEM ($60k/year).

It's not a complete loss though. I did game a lot, but not so much I made no progress in education. I am about one year from earning a CS degree. I just need to buckle down and finish it.

Edited by ArcaneCoder
addition
  • Like 1
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...