Skip to content
TORNLIFE More

Stock ROI: What to buy next based on what you have

Started by Patient [2131539] on in Tools & Userscripts.

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

Posts archived: 13 / 13 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
13
Discussion span
→
People posting
4
Likes on archived posts
31
Authority score
37 / 100
Historical score
34 / 100
Story score
48 / 100
Engagement score
66 / 100

Mentioned in this thread

xedx [2100735] ×4

Patient [2131539]
EDIT: I came across an error that I didn't account for If you buy a stock block increment that you already own one of the previous increments for, it doesn't actually acknowledge that you've bought it until the new stock block increment is active. I'll be working on this to correct it, but I'll have to wait out the week to see if it persists after the increment is active. Apparently the Torn API only counts increments that are currently active, and not those that you own but won't activate once the current blocks you own are paid out.

https://contextbedamned.com/torn.php

Huge thanks to xedx [2100735] for help with troubleshooting. logic, and suggestions.

[image: i.imgur.com]

So there are plenty of stock BB ROI references out there, and they are formatted in a much more pleasing way, but my main gripe with them is the hassle of having to cross reference to what I actually already own, flipping back and forth to figure out which one was the best one to get next, and made my own utility so that I can avoid that ordeal.

Basically, the main benefit of this is that it looks at the stock blocks you've already purchased, calculates the ROI for each that you haven't, and displays the relevant value. Another benefit is that each value is loaded as soon as you use it, so there's no delay to the update like with other tables that manually or periodically update. When you look at this, you're looking at the most up to date information, and you can simply buy the most profitable stock that you can afford by simply looking at the top of the list. It uses the current stock price as well as the current value of the item for stocks that give items. It also includes links that open directly to the "Buy" tab of the relevant stock.

You simply put your API key into the form, and select the utility you wish to use, and click submit. At the moment the default is this one, but as I add utilities to the site this may change, and you may have to use the dropdown menu. I'm considering changing the layout in the future, but for now this is the interface I'm using.

A few caveats:

1 - This only looks at the next increment of each stock, so if the 2 next most profitable blocks for you are the same stock, it won't indicate that. You'd have to buy the most profitable one first and then refresh the utility to see what the next most profitable is.

2 - I've tied the "value" of McSmoogle(MCS) to the market value of four 25 energy energy drinks(100 energy), this is a utility I made for myself, and that is how I value it, but if enough people disagree with that evaluation, I'm happy to change it. Currently, the valuation doesn't take faction perks into consideration, so this is most likely overvalued on the chart for most people. I may add logic to look at faction perks and adjust to value the amount of energy to an amount of cans that match the stock benefit.

3 - I've tried to use a similar valuation for Evil Ducks Candy Corp(EVD) as 40% of the value of an EDVD, however this shoots it right to the top of the chart. As I've been playing for some time, I personally don't value happy that highly, and considering the ROI if you use that valuation is around 100% for the first block and halving for each, I've just set it to 0. It's real value depends on whether you actually are below stat cap and how you're using it. I may add some logic to check if the player is still in happy jumping range if there is demand for it.

4 - I'm not sure how to value the other non-money/item dividends(and the clothing cache, which is a bit harder to script as the value of the dividends vary or don't have values), so they are set to $0, if anyone has any suggestions, I'd appreciate any input on this.

5 - The annual ROI is based on 52 payouts a year for 7 day increment stocks, and 12 payouts a year for 31 day stock benefits. 7 day increments actually pay out 52.14 times a year over , and 31 day increments pay out 11 77 times a year, so over the course of multiple years, 31 day increments may be slightly overvalued, and 7 day increments may be slightly overvalued.

6 - Because it needs to check your current stock portfolio, it requires a Limited Access API key.

Updates I'm considering:

1 - Use money on hand and funds in vault to determine what stocks I'm actually able to afford, and filter any that are too expensive.


2 - Use shares owned in excess of the current BB increment to determine the amount displayed for the next increment.
Added

3 - A way to figure out if any stock blocks you currently own should be sold and replaced with a more profitable block.

As with all of my utilities, any and all feedback is welcome, and any error reporting is highly appreciated.

UPDATE: Added columns that look at excess shares owned and tell you how many more shares you need for the next block and how much those shares will cost.

Changed column name for the total shares of a BB block from "Shares Needed" to "BB Share Amount", and now "Shares Needed" is how many shares you need to buy to activate the next block, and "Money Needed" is how much it will cost to get the next block activated.

Update January 24th, 2022:

Added utility to see a list of all stocks, sorted by ROI where stock blocks you already own are highlighted, as seen below. To use this, just select "Get List of All Stocks Sorted by ROI" from the drop down menu. This currently goes up to 4 blocks, but more can be easily added. Once again, the value of McSmoogle is equal to the market price of 4x 25 energy can's, so this may be somewhat overvalued if you take faction perks into consideration, and as with the other utility, the dividend values of difficult to price BB's have been set to 0, such as HRG, EVL, BAG, and TCC, as I can't really figure a way to value them accurately. Any suggestions or insight into this is appreciated.

It goes up to the 4th increment, but can easily be changed to go higher if there is demand for it. Thanks again to xedx [2100735] for help with troubleshooting and suggestions!

Note: Stocks increments already owned are colored green, any increments you have partial shares towards are colored yellow.

[image: i.imgur.com]

Update January 25th:

Added highlighting to "What to buy next" function to highlight stock increments you are able to afford based on funds available in the wallet and in the property vault. The only issue that may come up with this is for those who own multiple properties with vaults and money spread across them, as I'm unaware of any way to look at the vaults of properties that you are not currently living in, and have no way to test this at the moment.

Also added keys to both tables for clarity on what the highlights are showing.

Mentions: xedx [2100735]

xedx [2100735]
One thought I have is that you may want to change the 'shares needed' to what YOU (or me, in this case) really need, rather than the BB price, and perhaps the cost of those shares remaining, as well. I need 11,300,000 shares of IOU if I wanted another BB of that, so seeing that and it's cost might be more useful than seeing 12,000,000.

Also, I know it's sorta obvious by virtue of the fact that the tier will be > 1 if I already own a stock, but maybe highlighting the text (color: green, or background-color: green or some such) might be useful too, just to make it more obvious.

Great place to add CSS styles to the rows/cells :-) If you want to see what I mean, this simple table uses backgrounds, text coloring, and hyperlinks in a table as a simple example, generated on the fly: http://18.119.136.223:8003/rankedwars/?cmd=viewwars

That table is written in a simple Node JS script, easy enough to write in PHP too, if you want me to show you how I set it up.
Patient [2131539]
Thanks for the feedback!

Regarding your first thought, that is something I was considering adding, but reflecting on it more after posting this, the purpose of the table is to show what the ROI is for the whole block, and any shares you have are basically 0% ROI as far as dividends are concerned. The purpose is to look at the current cost of the block versus the yearly dividend return, so if you have say half a block of stock A with a lower ROI, and none of stock B with a higher ROI, most likely just selling stock and using the funds to buy a full stock of B would be the best solution. I think I will change the "click to buy" link to direct to the tab in the stock info where it shows how many stocks you need for the next block.

As for the coloring, that's a good suggestion, but I feel like coloring stocks you don't own as "green" would make it seem like the first block is "better" than a second of a more profitable one, when really there are quite a few stocks where the second block is more profitable than the first block of others.

I think maybe since money on hand or in vaults are all in the scope of the limited access API, perhaps I could color it green/red according to what I'm able to afford? Though doing this means some stocks will almost always be red unless you're doing the call with billions on hand for however long it takes before the API to update/delay the information.

I'll think about this, thanks!
xedx [2100735]
Gotcha, I see the logic behind what you said. I did mean coloring the ones I own, green, just as an easier indicator to see where I stand, even though I can look at the '1's in the second column. Not intended to be indicative at all as to their relative worth.

I wasn't thinking of changing the order at all (regarding shares I already own beyond a block), just an easy way to see what it is I really need. For example, it indicates to me that my best ROI would be more MCS, which is true. But I don't have the $1.6B to get to the next level - but I actually only need half that. So I guess I was just looking for an easy method to quickly see which of options a, b, and c (those being the top 3 in terms of ROI) I can afford right now. Or are within reach. That would also be indicative of maybe where I should shift shares - perhaps if in case c, above, it indicated I had say 300,000 out of the 1,400,000 needed for a full block of c - maybe I forgot I even had extra shares floating around - but maybe knowing that, I'd want to shift them for now to choice a and maybe buy some more while Im there. That was kinda my idea.

Ah, I just looked - I see you added that to the comments above:-)
Patient [2131539]
Columns added for seeing how many shares/how much money is needed for the next benefit block based on shares in excess of your current increment. I hate working with CSS but I'll most likely be working on color coding the rows based on how much money you have available in the vault and on hand(and possibly in excess stock shares) to highlight what you can afford.

And as always any feedback or suggestions are welcome.
Patient [2131539]
Added utility to see a list of all stocks, sorted by ROI where stock blocks you already own are highlighted, as seen below. To use this, just select "Get List of All Stocks Sorted by ROI" from the drop down menu. This currently goes up to 4 blocks, but more can be easily added. Once again, the value of McSmoogle is equal to the market price of 4x 25 energy can's, so this may be somewhat overvalued if you take faction perks into consideration, and as with the other utility, the dividend values of difficult to price BB's have been set to 0, such as HRG, EVL, BAG, and TCC, as I can't really figure a way to value them accurately.

It goes up to the 4th increment, but can easily be changed to go higher if there is demand for it. Thanks again to xedx [2100735] for help with troubleshooting and suggestions!

Note: Stocks increments already owned are colored green, any increments you have partial shares towards are colored yellow.

[image: i.imgur.com]

Mentions: xedx [2100735]

masheen [2625139]
1 - Use money on hand and funds in vault to determine what stocks I'm actually able to afford, and filter any that are too expensive

I would be very interested if it had the update above.
Patient [2131539]
So I've added something similar, as after considering it, I think simply filtering out the rows that are affordable may hide relevant information, such as hiding a higher paying block when you're just a few million shy of it wouldn't be optimal. Instead, I've added highlighting to the rows that you are able to afford based on the money available in your wallet and vault.
masheen [2625139]
Just been testing this. I see the "what can you buy" with money on hand + vault is useful but is it possible to add as well a input field to accommodate funds that are in items, points, other stocks that are not as profitable, faction vault, company vault etc.
Patient [2131539]
It would be possible to add this, but there are a few roadblocks for some of the things you've suggested, the biggest being that I don't have access to an API key with company and faction access, so I wouldn't really be able to test/troubleshoot the functionality.

The others are a bit more feasible for me, but since my idea is to keep the tool as "at a glance" as possible, I'd like to keep money in the vault and on hand as the default, and count things like items/stocks/points/etc as a secondary option. There's a lot of situations where that functionality would be useless as well, for example if someone has a DB or a GAK, then it's going to show that they can buy every stock, but only if they sell their high value item... so a lot of considerations would need to be made as to what actually counts towards "idle money" so to speak.

Either way, in order to do this I'll have to get a bit more hands-on experience with Javascript to figure out how to accomplish this without either cluttering up the landing page or making an excessive amount of API calls. I'll definitely set it as a longer term goal though as I learn more though, thanks!
masheen [2625139]
What is this field is just your Vault + Cash on hand + a value you type into a input field which can be whatever you wish?

Either way the tool is very useful as it is and I appreciate the work put into it thus far!