Skip to content
TORNLIFE More

MEGALEDGER! Track your trading, bazaar $$ & more

Started by 1634racine [2113568] on in Tools & Userscripts.

58 replies · 1.19k views · thread synced · 3 days ago · View on torn.com
About this thread

Posts archived: 59 / 59 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
59
Discussion span
→
Authority score
54 / 100
Historical score
35 / 100
Story score
54 / 100
Engagement score
78 / 100

People posting, likes and official posts are not counted for this thread yet: on threads longer than one page they come from a periodic pass over the archive, which has not covered it.

Mentioned in this thread

_SCOFIELD_ [1441750] ×1

1634racine [2113568]

Hi all

This is one of my first scripts that I built for private use. I shared with a friend in Torn - they loved it - and they told me I should share it with the fine (and not so fine) citizens of Torn...

 

The Challenge

 

I like to hop from one activity to the next in Torn. This might be a typical day for me:

 

Spend some time sniping items in the item market that are under-priced..

Sell these snipes in my bazaar or on the item market for a modest profit.

 

Spend some time shoplifting, searching for cash, dump diving, and then flipping my items on my lunch break in my bazaar or in the item market.

 

Then, my favourite pastime... $1 Bazaar Flips.

I will search through my favourite bazaars that list $1 items... snap up what I can, and then list them for sale.

 

Sometimes I don't get round to listing stuff, though.

And, sometimes I don't get round to one or more activity due to trains, travelling or whatever.

 

So, when I looked through my logs, it got hard to track my activities and see what kinda profit I was making on the regular.

 

Enter MegaLedger

 

The script itself lives in Google Sheets. I mostly live in Google Sheets for my daily grind, so it made sense to code it there.

 

Firstly, you enter the date range and the stuff you want to track:

 

 

Next, you download logs...

 

[image: i.imgur.com]

 

Then we download the logs in 'slices' and blocks to ensure we get every last drop of loggery: -

 

[image: i.imgur.com]

 

WHY? The API does not let you page through your logs. It caps at 100 per call. So, you have to 'slice' up the time period into manageable timeframes using timestamps instead. This increases API calls, but the script has a good backoff and keeps API calls to a decent limit.

 

Next comes the fun bit. Analysis of the logs.

 

You select Run Full Analysis from the menu: -

 

[image: i.imgur.com]

 

Then the script creates ledgers of all your activity; what you found, stole, sniped, and sold.

 

Here's some sample data:

 

 

[image: i.imgur.com]

 

[image: i.imgur.com]

 

[image: i.imgur.com]

 

[image: i.imgur.com]

 

NEW!!!! TRADE ANALYSIS:

[image: i.imgur.com]

 

[image: i.imgur.com]

 

This is just what I needed to be able to track my progress in Torn, and I think a few others might find it useful

 

I'll make the new versions available as I update MegaLedger, and I welcome any feedback. I'll consider making any changes depending on the time it takes to implement and the complexity. Sadly, my real life job does not pay as well as my Torn activities...

 

All support & donations welcome!

 

Download links in next post!

 

 

1634racine [2113568]

Version 1.3 - 26th June 2025!

Download: MegaLedger v1.3 Download

MEGALEDGER CURRENTLY NOT WORKING DUE TO TORN PATCHES.

I'LL UPDATE AS SOON AS I'M ABLE. APOLOGIES!

Feel free to download and have at the code if you know JS :)

 

Changelog:

24th June 2025 - v1.1 Fixed miscalculation of dates

25th June 2025 - v1.2 Trades added!!!! + Item Market sales, Market 5% fee, Focused API calls, Optimised all API calls

26th June 2025 - v1.3 Append & trade functions fixed. ROI fixed. Faster downloads within API limits!

 

FUTURE UPDATES! 

+ Adding item market 5%

+ Adding P2P Trade logs (perfect for Traders)

+ Adding focused API calls

+Faster API calls

+ Chrome Extension to download current inventory

+ SaaS UI instead of Google Sheets for mobile and desktop users!

 

Please try to remember this is a beta and you're helping me create a tool we can all use. I appreciate your feedback and kindness!

====

 

HUGE THANKS TO DONATORS!!!!

 

16:59:54 - 24/06/25 You were sent 5x Xanax from [REDACTED]

17:40:56 - 24/06/25 You were sent 2x Xanax from [REDACTED]

09:55:30 - 25/06/25 You were sent $10,000,000 from [REDACTED] with the message: SS

15:47:04 - 25/06/25 You were sent a Donator Pack from [REDACTED]

18:07:59 - 26/06/25 You were sent 20x Xanax from [REDACTED] with the message: megaledger
14:01:04 - 12/07/25 You were sent 4x Xanax from [REDACTED] with the message: Megaledger

Caz27 [3521451]

This is amazing for new and old people in torn that are wanting to keep a track of things. Also awesome for people who want to become a trade in torn thank you 1634ricine. 

16:59:54 - 24/06/25 You sent 5x Xanax to 1634racine

cankles [2137519]

I haven't traded anything directly between anyone in a long time but I found this error when I run "Download Trading Logs".

 

My "All Logs" tab is empty but I see the entries populated under "Trading_Logs" tab.

 

1634racine [2113568]

Well that sucks. Possibly something I tripped up when creating the share file. On it!

EDIT: yes. I yanked some code I shouldn't have. Apologies. New version up soon!

cankles [2137519]

It still worked analyzing what logs I had. I did notice that I flipped an item and it looks like it does not account for item market fee of 5%.

 

 

 

I bought this for $350k from someone and sold it at $475k. Sheet says I made $125k profit.

 

16:43:12 - 23/06/25 You sold a Shaped Charge on the item market to RatstaR at $475,000 each for a total of $451,250 after $23,750 in fees

1634racine [2113568]

I've taken the Unsold Inventory out. It's just confusing for most people as there's trade items on there's too. 

 

I'm probably going to add in Trade data, but need to check the API won't go crazy

Einhander [2675624]

Ive sold like 3b of items today and it shows this...


Am I doing something wrong, or thinking about this the wrong way.

 

Edit

Seems as though if item source is via trade then its not accounted for.

1634racine [2113568]

@Einhander & @theharks

Thanks for testing it out. The update I'm working on will also track Trades with other players :)

 

 

 

 

Einhander [2675624]

Youre a real Legend for that!

Just an idea. If I could get somehow, my torn exchange prices or recipts to be pulled in somehow, then you(i, we) could see the actual value paid for each item in the trade. Not quite sure how you are able to determine trade and item value otherwise? Do you simply divide the cost of the trade over all of the items evenly?

 

Ill deffo kick some cash your way for the hard work.

1634racine [2113568]

Hey!

 

Sounds like its a good idea - except I have no experience working with Torn Exchange, so I have no idea if I could even do it haha

 

Might be something I can look into though.

 

Right now the Trade analysis looks at a trade, then checks if you or the user added any cash as well as items.

 

Next, the script is looking for sales of the items that were in the trade, and adding on any cash you got in the trade. This is the profit you'll see on the Trade Analysis sheet.

 

[image: i.imgur.com]

 

Here's the logic...

Cost Basis Assignment

  1. Items from cash-only trades: Cost = Cash sent ÷ Items received
  2. Items from item-only trades: Cost = $0
  3. Items from mixed trades: Cost = $0 (cash portion becomes immediate profit)

Profit Calculation Priority

  1. Cash received: Immediate profit
  2. Items received: Track for future sale profit
  3. Combined value: Cash + Item sales = Total trade profit

Trade Classification

  • Cash Trade: I send cash, they send items
  • Item Trade: I send items, they send cash
  • Mixed Trade: I send items, they send items + cash
  • Barter Trade: I send items, they send items (ignored but rcvd items Sold still tracked)

Sales Tracking

  • Track all sales of items received in trades
  • Match sales chronologically after trade date
  • Include market fees in profit calculations
  • Handle partial sales and remaining inventory

 

Obviously this is less than ideal, because you may have had hundreds of items in a trade... but for now it's a start. I am working on the line by line thing, but it ain't easy, sadly. Torn Exchange is a start, but not everyone uses it... so... :)

 

Thanks again!