Skip to content

Price Data

Tromador edited this page Jul 12, 2018 · 2 revisions

TradeDangerous uses a database of stars, stations, items and most importantly prices (how much will Beagle 2 pay for Fish?).

There are two sides to this database (db): A human readable form, ".prices" and a machine-readable SQLite database, ".db". Both are in the "data" sub-directory of the TradeDangerous folder.

Flow

The database is populated through ".prices" files. The flow is as follows:

. User supplies ".prices" data, . TradeDangerous reads ".prices" data, . Machine-readable data saved 'data/TradeDangerous.db' database, . TradeDangerous re-generates 'data/TradeDangerous.prices',

You can supply .prices data several ways:

  1. Use the "trade.py update" sub-command (see trade.py update -h for more help),
  2. Hand-edit the "data/TradeDangerous.prices" file (caution advised),
  3. Download a TradeDangerous.prices file from another user and copy to your data/ directory.

TD checks on every startup whether the .prices file has been modified more recently than the .db file. If so, it re-loads the .prices file.

.prices

The .prices file is designed to look a lot like the Market in-game; as much as a text file can. Plain text was chosen to make it easier for people to discuss, edit and exchange these files.

.prices basic

By default, only the most basic columns of the file are shown when editing; these are the item name, the price the station is paying for the item and the price the station is asking if it is selling the item.

#!text
@ STAR NAME/Station Name
   + Item Category Name
      Item Name               SellCr BuyCr
      Item Name               SellCr BuyCr
   + Item Category Name 
      . . .

for example:

#!text
@ I BOOTIS/Chango Dock
   + Waste
      Biowaste                   19    25
      Scrap                      61     0
   + Weapons
      Non-Lethal Wpns          1423     0
      Reactive Armor           2020  2029

In this example, Chango sells Biowaste for 25cr and Reactive Armor for 2029cr. Scrap and Non-Lethal Weapons are not sold.

.prices extended

There are number of additional fields that are not included by default:

  • Supply (demand / stock)
  • Timestamp (when the data was recorded)

These are stored in the TradeDangerous.prices file but can also be accessed by using the "--supply" and "--timestamp" arguments to the "update" sub-command.

#!text
      <item name>   <sellCR> <buyCR> <demand> <stock>  <timestamp>
      Algae              110       0    5000H       -  2014-10-29 12:30:15
      Fish               150     156      20L    100M  2014-10-29 12:30:15
      # for entering data, timestamps are optional or can be 'now'.
      # if the timestamp is missing, it is presumed to be 'now'.
      Sausages          2000    2020        ?       ?  now

In this example, Algae is being bought by the station for 110cr and there is a (H)igh demand for 5000 units. The item is not sold here (buyCR is 0 and stock is '-').

Fish is being sold here for 156cr (it's available to buy from the station), there is (L)ow demand for 20 units and a medium availability of 100 units in-stock at the station.

The station will buy sausages for 2000cr and is selling them for 2020cr, but the demand and availability weren't entered; when the data is saved, the current timestamp will be used to update the database.

Supply Data

Supply data (the demand units and level plus stock units and level) is enabled with the "--supply" or "-S" switch.

  • "?" or "unk" for "unknown" (equivalent to -1 units, -1 level in the database),
  • "-" , "n/a" or "0" for "not available" (equivalent to 0 units 0 level in the database),
  • <# of units> for other values, where level is one of L, M or H, e.g. "50L".

If you only want to enter unit data without also entering levels, use a '?' suffix, e.g. "50?" means "50 units, ignore level".

If you update the database with the short format, demand and stock are assumed to be "-" (unknown). This means the trade calculator will just assume the station will have enough for you.

Conversely, if you specify "-" (in previous versions of TD this was "0L0" or "n/a"), the trade calculator treats the item as unavailable and does not include it in trade runs.

Force N/A

Items that don't have supply (the item isn't in the database or the supply was '?') can be forced to default to "-" (n/a) instead or the default "?", if you want to be forced to populate all fields.

To do this, use the "--force-na" option, but be aware that items you leave flagged as n/a ('-') will not be ignored by the trade calculator.

Clone this wiki locally