<< Back to Warzone Idle Forum   Search

Posts 1 - 7 of 7   
Calculating Market Profits: 11/3/2023 14:43:02

Level 35
Hi everyone,

reading an older post, where the optimal AP distribution for the skills AM, AV and MD was discussed (https://www.warzone.com/Forum/677054-busting-myths-wzi-1-avmd) I was wondering how FiveSmith computed the difference in profit from using the market strategy.
So I looked at the numbers and thought of possible formulas, since I have not found an exact formula in the forum yet and the shown percentage increase in the market is not correct either.

Here is the result:
The profit is basically a function of the sell price and the cost for buying alloys (until they are equal to the sell price). While the sell price is visible and the increase based on skills, techs and artifact is easily determinable, the cost evolution is trickier. The following formula seems to give the correct results though:

cost = [currentPrice + fixedPriceIncrease * (n+1)/2 ] * n,

where 'currentPrice' is the price you can read at the market,
'fixedPriceIncrease' is the actual price increase after each single buy of an alloy, and
'n' is the number of alloys you buy.

Since the 'cost' is displayed when you choose a number of 'n' alloys to buy, the 'fixedPriceIncrease'
can be approximated using this equation:

fixedPriceIncrease = 2*( cost/n - currentPrice )/(n+1)

The sell value is a simple relation of a fixed value and the the AV increase due to skills/artifacts/techs and
gives us a hint of the maximum profit to be earned from any alloy:

n_breakEven = ( sellValue - currentPrice )/fixedPriceIncrease,

maxProfit = [ sellValue - currentPrice - fixedPriceIncrease*( n_breakEven+1 )/2 ]*n_breakEven.

Apart from some round off errors due to the inaccurate display of cost, prices, and sell values this works
very well for the markets I've tested it and makes it easy to quantify the gain of profit and thus mercenaries when increasing
the alloy sell value.

Calculating Market Profits: 11/11/2023 20:57:21

Level 24
Interesting thoughts/calculations. I was also wondering about the n* (optimal amount n) and thus the maxProfit, but couldnt get past the priceIncrease function in my first thoughts and didnt get back to it later.

So the actual n* and maxProfit do not depend on the batch size that I buy/sell with, right?

And having the approximated value of the priceIncrease for the best alloy for each market and each map would be nice to have on pkmx's site, wouldnt it?
Would require some data gathering first tough...
Calculating Market Profits: 11/12/2023 11:25:40

Level 35
Yeah it took me quite a while and I stopped caring about exact numbers inbetween. The observation by FiveSmith of quadratic behaviour kicked me off from the idea using exponential increases, which are related to the shown percentage numbers. With that I started to think about it again.

So the actual n* and maxProfit do not depend on the batch size that I buy/sell with, right?

Yes, the max profit is independent of the batch size you buy. I confirmed that on the first market in Far-Land by buying fixed batch sizes in many steps once and increasing batch sizes in a second attempt and got the exact same profits.
I haven't unraveled the influence of buying other alloys/items on the evolution of the prices. Hence it could make a difference whether you first get profit and then buy stuff for techs or vice versa. Usually the amount required for techs is small enough, such that there is no relevant difference though.

Having these priceIncrease number in fact would be really good! But yeah, that is some tedious data gathering to do, but we could start to collect some data here.
Calculating Market Profits: 11/12/2023 20:02:25

Level 24
Hmm I did some tests with Samarium on Hard Scandinavia and thought the bigger the sample, the better should be my estimator for the priceIncrease, as every observation should have a different rounding error and on average it should be 0.. The average priceIncrease that i got, was something around 8.9 M/alloy.

On the other hand, the game shows me an Increase of 0.32% per alloy. If i take the percentage value from the game with different batch sizes (e.g. from 1 to 11), divide each by the batch size, and take the average here, I get an estimator for an (unrounded) Increase of 0.324512105% (which the game shows as 0.32%)
If I multiply the startingPrice for the alloy with that percentage i get ~8.57 M/alloy

I dont know what the best and most efficient way is to get the true values instead of the rounded ones that the game gives you, but those 2 values (startingPrice & Increase) for each alloy/item would be, whats needed for optimality and maxProfit calculations right?
So the easiest data would be to just note each startingPrice (before using a market) and %-increase for each market on each map?
Getting more precise data would otherwise require a bit more work i guess..

And yes, interaction effects for buying other alloys would be interesting too
Calculating Market Profits: 11/13/2023 10:49:40

Level 35
Ahhh, okay, we just need to put two and two together here...
The percentage of increase shown in the market relates to the fixedPriceIncrease in relation to the initialPrice:

fixedPriceIncrease = initialPrice * marketPriceIncreasePct / n

Regarding uncertainties in the actual values the following points are of interest:
- for the current/initial price, the maximum accuracy is 3 digits (x.xx or xxx) and cannot be influenced,
- the measured cost can be more accurately determined using the currentMoney before and after buying (max xxx.xxxx digits accuracy),
- the accuracy for market price increase can be accurate up to 5 digits (xxx.xx%),
- the sell value is also only known up to 3 digits (x.xx or xxx), but could be determined with more accuracy using the currentMoney before and after selling.

I would say, the most accurate method would be to use the percentage with 5 digits, determine the cost based on the currentMoney display (note down values before and after buying).

initialPrice = (moneyBeforeBuying - moneyAfterBuying) / [ n*(1+ marketPriceIncreasePctPerPiece*(n+1)/2) ]
fixedPriceIncrease = initialPrice * marketPriceIncreasePctPerPiece 

This relies heavily on the initialPrice and having enough cash to actually get the numbers for 5 digit pct increase in market as well as 5-7 digit current money values. In a later stage, with an unknown number of bought alloys before, the initialPrice is not determinable anymore and the formulas in the initial post are more applicable...

Further to reduce uncertainty in gains the base sell value could be determined similarly using the currentMoney display before and after selling. That of course is a lot of work to reduce the uncertainty below +-5%, which is the accuracy I get with the formulas of the initial post (depending on the type of alloy).
Calculating Market Profits: 11/14/2023 13:33:29

Level 35
Ok, well, my last post was maybe a bit premature...

On Hardened Far Land the relation of marketPriceIncreasePctPerPiece with the initialPrice and the fixedPriceIncrease does not seem to hold!

Thus, back to the initial formula. For most accuracy make sure to have a sufficient amount of money to increase the initialPrice notably,
second, buy twice the same amount (n1) of alloys and note down the money you have before and after buying to compute the costs accurately. With that, the formulas can be rearranged such, that the following holds:

fixedPriceIncrease = (cost2 - cost1) / n1^2 
priceBeforeBuying = cost1 / n1 -  fixedPriceIncrease * (n1 + 1) / 2

In case you noted down the historic bought numbers (nh) of the same alloy (and only buys of that alloy were made!), the initialPrice can be computed similarly at a later stage:
initialPrice = priceBeforeBuying -  fixedPriceIncrease * nh

That is the most accuracy you can get I think.
Calculating Market Profits: 11/14/2023 19:04:06

Level 24
Alright, so i tried this on Hardened Old Town with Neodymium Bars. Initially the Market was unused and i had enough money to buy 2x 100.. I decided to not note my Cash down, but rather take screenshots as its quicker. First 2 attempts failed as one screenshot somehow didnt get saved.
But eventually i got it done, i even subtracted the W/s (100k) on the basis of the screenshot times (~2-3s inbetween) and then used your formula.
I got a fixedPriceIncrease of: 574,630
and an initialPrice of: 224,345,555
Thats pretty acurate, but just a tiny bit short to be rounded up to the 225M the Game showed as its initialPrice

Edit: Calculating the Percentage with fixedPriceIncrease / initialPrice gets me to 0,2561% instead of the 0,23% the game shows

Edited 11/14/2023 19:06:58
Posts 1 - 7 of 7