Objects in Space

Objects in Space

Not enough ratings
Big Ol' Trading Spreadsheet
By fishfritters
Deciphering the "trading_xxx.txt" files for fun and profit. Please comment if you have any ideas about what the file contents mean!
   
Award
Favorite
Favorited
Unfavorite
The Spreadsheet
For every station, this spreadsheet[docs.google.com] describes what its predicted price for every commodity is, and how much of each commodity that station sells. If there's no number next to a commodity's price, it means that station doesn't sell that commodity. For example, if you want to buy gold, look for stations that both have some in stock and price it low. When selling gold, look for stations that price it high.
The Files

Ok, so that's what we know about the stations. But how do we know it, and what do we still have to learn? If this interests you, read on, and please comment if you have any ideas about what the data in the files could mean!

Note that this topic was discussed a few years ago in this thread. Many thanks to davecortesi and Dr_Bicinium, who figured out how commodity counts are encoded, along with part of how prices are calculated. davecortesi wrote a Python program to turn the data into a usable form, but I couldn't find it so I wrote my own Python program[drive.google.com] to do it. It also extracted a bunch of data about one-off, contract-specific commodities, which I manually removed from the spreadsheet since they're not really part of the dynamic economy.

Here's what we have so far:

The game stores the trading data for every station, grouped by star system, in files with names like "trading_leo.txt" in the same directory as most of the other game data. The data for each tradable item at each station is formatted like this:

"commodity=oxygen,2,1_100_5,1d3+3,1d2+2"
  • The first part tells which commodity is being described. Illegal items are instead labeled "wirecommodity", but the rest of the line's parts are the same format as with legal items.
  • The second part multiplied by 5 gives the item's predicted price, which can be viewed when talking with a station in the comms panel. I think this acts as the item's default price, which is then added to or subtracted from by a random amount to get the actual price. The random amount is recalculated each time you reload a save or revisit a station. Sometimes the base number the price varies around is different, like when you sell so much of an item that the station lowers its price. I'm not sure whether the base number is determined by the station data, the actions of non-player merchant ships, or some other market force.
  • I don't know what the third part means. Dr_Bicinium had the idea that the middle number might be some sort of multiplier or percentage since it tends to be 100.
  • No idea what the fourth part does, but like the fifth part it probably refers to a dice roll.
  • The fifth part is how many of the item the station has for sale. It's a dice roll, described in a format used by some dice-based games such as Dungeons & Dragons. For example, "3d6+5" means "use a 6-sided die, roll it 3 times, and add 5 to the sum of those rolls", meaning the result can be any number from 8 to 23. "1d2+2" means the result can be 3 or 4. Most items at each station have "0d0+0" for this value, meaning they sell 0 of that item (they don't sell it).

If you have an item in your cargo that a station also happens to sell, the price it buys your item at is close to the price it sells the item for, but typically at least 5c lower. Selling a bunch of an item to a station will decrease that station's demand for that item, decreasing that item's price. Since the buying and selling prices are linked, this means the price you buy that item at will now be lower, potentially making it profitable to buy a bunch of that item again and sell it at a different station where the price is higher.

When selling a lot of a single item at a single station, the trading terminal shows you how you'll get less and less money the more you sell (AKA diminishing returns), since by increasing the station's supply you decrease its demand. I recorded this pattern in the "Single-station notes" sheet. The prices decreased at a steady rate, about 90% of the previous price. Each price took the same number of items to bring it lower, except for the highest price which took a different number of items to bring down. For example, in one instance sand could be sold for 110c 4 times, then 100c 5 times, then 90c 5 times, and so on until 70c when I only had 1 unit left to sell. I suspect the third part of the data line (the one formatted like "2_90_7" as seen in Adari's data on sand) refers to this because of the conspicuous 90, but more experimenting might clear this up.
6 Comments
hannibal 6 Apr, 2023 @ 7:38am 
Oh, I also experimented with the third part by giving art the value of scrap which resulted in art becoming really resistant to diminishing returns when selling it. I could sell 30 art at the highest price before it dropped down a bit. So no idea what the individual numbers do, but you could say it is some kind of tier system on how quickly goods lose value. For balancing i would harden most of the goods to value loss except for stuff like wire commodities, art and organs. I don't see why one little freighter should have a big impact when it comes to demand for machinery, food, electronics and so on.
hannibal 6 Apr, 2023 @ 7:37am 
Yes, i increased all dicerolls by x2 and all fixed additives by x5 which gave me a much better economy. For example i could buy around 30ish each of machinery, electronics and computers in Sagan's light and turn a profit in Leo. Haven't tested too much but actually seems to be a good middle ground. Since i did that with a batch edit it also increased illegal goods, i saw 80 sand for sale which is clearly too high but that can be fixed manually.
fishfritters  [author] 5 Apr, 2023 @ 3:40pm 
Not yet, it being demand sounds plausible though. Setting it to something high like 1d1+100 would probably be a good way to test. Modding the economy would definitely make the grind between scripted story quests more engaging...
hannibal 4 Apr, 2023 @ 3:46am 
Hey, have you figured out what the fourth part means? I'm back playing OiS and started modding it to my taste. Already increased contract times for short range contracts that were impossible to finish due to how time works in this game. For example 1h contracts could fail instantly since the game didn't give you a whole hour to finish the contract.

Anyway i'm thinking the 4th part might be a dice roll determining the demand of the good at the station explaining the widely varying prices. I think i'm going to increase both demand and supply because i really don't like the idea of flying around with cargo pods not even half-full.
fishfritters  [author] 7 Oct, 2022 @ 8:32pm 
Happy to help! Sorry this came out after a few years too late to help when the game was at its most popular.
[KKJ] drunken monkey 7 Oct, 2022 @ 3:05pm 
Thanks for your hard work, and by extension the work of those folks you built upon!