In-Development TradeDangerous: power-user trade optimizer

- Merged various system data that was in the merge queue,
- Created a branch (new-prices-format) to experiment with an iteration of the .prices format while keeping backwards compatability. New file looks like this:

Code:
# TradeDangerous prices for ALL Systems/Stations

# REMOVE ITEMS THAT DON'T APPEAR IN THE UI
# ORDER IS REMEMBERED: Move items around within categories to match the game UI

# File syntax:
# <item name> <sell> <buy> [ <demand units><demand level> <stock units><stock level> [<timestamp>] ]
# You can write 'unk' for unknown demand/stock, 'n/a' if the item is unavailable,
# level can be one of 'L', 'M' or 'H'.
# If you omit the timestamp, the current time will be used when the file is loaded.
# NB Items marked 'n/a' are ignored for trade planning.

#     Item Name             Sell Cr  Buy Cr     Demand     Stock  Modified

@ ERANIN/Azeban City
   + Chemicals
      Hydrogen Fuels            218       0        unk       unk  2014-10-23 23:21:51
      Mineral Oil               144     160        unk       unk  2014-10-23 23:21:51
      Pesticides                344       0        unk       unk  2014-10-23 23:21:51
   + Consumer Items
      Clothing                  471       0        unk       unk  2014-10-23 23:21:51
      Consumer Tech            7315       0        unk       unk  2014-10-23 23:21:51

For the demand/stock fields, it supports:
. the old syntax (5000L3 = 5000 units at high priority, -1L-1 = unknown, 0L0 = unavailable),
. "unk" or "?L? for "unknown" (previously -1L-1),
. "n/a" for "not available" (previously 0L0),
. nnnL, nnnM, nnnH for "nnn" units at Low, Medium and High

Also note the timestamp has moved to the end of the line: This allows me to make it optional and also support the keyword 'now'.

Algae 197 0
Algae 197 0 unk unk
Algae 197 0 unk unk now
Algae 197 0 unk unk 2014-10-16 05:10:13
Algae 197 0 -1L-1 -1L-1 2014-10-16 05:10:13

all write the same data (if it's 2014-10-16 05:10:13) into the db.

Meanwhile other values might look like:

Algae 197 200 n/a n/a
Algae 197 200 0 0

(item is not available and nobody is buying, but it's on the market here)

Algae 197 200 500M 50L

There is demand for 500 units (medium) and there are 50 units in stock (low)
 
- Merged various system data that was in the merge queue,
- Created a branch (new-prices-format) to experiment with an iteration of the .prices format while keeping backwards compatability. New file looks like this:

Code:
# TradeDangerous prices for ALL Systems/Stations

# REMOVE ITEMS THAT DON'T APPEAR IN THE UI
# ORDER IS REMEMBERED: Move items around within categories to match the game UI

# File syntax:
# <item name> <sell> <buy> [ <demand units><demand level> <stock units><stock level> [<timestamp>] ]
# You can write 'unk' for unknown demand/stock, 'n/a' if the item is unavailable,
# level can be one of 'L', 'M' or 'H'.
# If you omit the timestamp, the current time will be used when the file is loaded.
# NB Items marked 'n/a' are ignored for trade planning.

#     Item Name             Sell Cr  Buy Cr     Demand     Stock  Modified

@ ERANIN/Azeban City
   + Chemicals
      Hydrogen Fuels            218       0        unk       unk  2014-10-23 23:21:51
      Mineral Oil               144     160        unk       unk  2014-10-23 23:21:51
      Pesticides                344       0        unk       unk  2014-10-23 23:21:51
   + Consumer Items
      Clothing                  471       0        unk       unk  2014-10-23 23:21:51
      Consumer Tech            7315       0        unk       unk  2014-10-23 23:21:51

Seems like the fields are separated with at least 2 spaces, is that correct?
 
I believe in the end both routes were incorrect: mine due to an incorrect condition (that resulted in taking the route through BD+47 2112 and Bolg instead of Rakapila), and the one from TradeDangerous because it did not have/use fuel data, therefore on the leg Rakapila→LP 271-25→Ross 52→OT Serpentis→LHS 411 you could run out of fuel in a stationless system.

I fixed the site, and the command line too. Output from the latter is:

Code:
route from Eranin to G 239-25:
 →5.48Ly i Bootis
 →3.53Ly Aulin
 →6.55Ly Rakapila (refuel)
 →5.11Ly LP 271-25
 →6.88Ly Ross 52
 →4.38Ly CE Bootis (refuel)
 →6.12Ly OT Serpentis
 →7.04Ly LHS 411
 →6.48Ly Miquich (refuel)
 →5.91Ly Zeta Herculis
 →6.13Ly Tilian
 →6.78Ly LHS 3262 (refuel)
 →5.79Ly DN Draconis
 →5.40Ly Lalande 29917
 →5.71Ly G 239-25

It is still not perfect, from Miquich to Tilian one should go through G 181-6 (as reported by TD) instead of Zeta Herculis. I need figure this out wrt/ fuel calculation tomorrow.

ah right hadn't tried flying the route yet - nice use of TD data for the webpage. really like it

[EDIT] also how do i get refuel info from the command line searched the thread but cant find the command. is there a full list of commands and options anywhere the first post has a lot of out of date options.
 
Last edited:
ah right hadn't tried flying the route yet - nice use of TD data for the webpage. really like it

[EDIT] also how do i get refuel info from the command line searched the thread but cant find the command. is there a full list of commands and options anywhere the first post has a lot of out of date options.

Thank you! Technically it does not TD depend on data, since the coordinates and the refuel info may come from a different sources (xlsx from FD and the community effort to find coordinates), but I figured I could just use the data from TD to not duplicate the effort done by CMDR Smacker and possibly others to compile them.
 
I rewrote my route calculation algorithm, finally it shows the route that seems to be the correct one, concerning fuel use.

Code:
 0   0.00  ● Eranin
 1   5.48  â—‹ i Bootis
 2   3.53  â—‹ Aulin
 3   6.55  ● Rakapila
 4   5.11  | LP 271-25
 5   6.88  | Ross 52
 6   4.38  ● CE Bootis
 7   6.12  | OT Serpentis
 8   7.04  â—‹ LHS 411
 9   6.48  ● Miquich
10   6.22  | G 181-6
11   4.58  â—‹ Tilian
12   6.78  ● LHS 3262
13   5.79  | DN Draconis
14   5.40  â—‹ Lalande 29917
15   5.71  â—‹ G 239-25
 
v4.6.0 is out, more star data (thanks, Smacker) and I cleaned up the "extended" (update --all) format. It still understands the old format so your .prices files don't break, but they will convert next time you update a station and it rebuilds the file.

In short: the new format is a little leaner and it makes it easier to work with.

I moved the timestamp to the right hand side and made it so that if (a) the timestamp is missing or (b) the timestamp is the word now, it will use the current time when it saves, rather than requiring you to try and enter the time by hand :)

Also, the keywords "demand" and "stock" are gone; they line up with the display in the game UI and that's what I'm basing the layout on so the words just added spam.

The demand and stock fields themselves are now just the number of units followed by a letter for the level, e.g. "10L", "500M", "1000H".

If you are not filling out those fields, leave them as "unk" (for unknown). This is the default and equivalent to the old "-1L-1", which tells TD to treat the item as though it's always in demand/stock.

If an item is out (0 units) you can mark it as "n/a" (for not available). This is equivalent to "0L0" in the old format, and tells TD not to use the item in trade hops.

Before and after:

Code:
Fish       300   305   2014-10-23 23:50:10 demand 50@1 stock 2500@2
after
Fish       300   305      50L    2500M  2014-10-23 23:50:10

Algae     115      0   2014-10-23 23:50:10 demand 23000@3 stock 0@0
after
Algae     115      0   23000H      n/a  2014-10-23 23:50:10

Entering a new price without entering demand/stock values:

Code:
Coffee   1125   1126   2014-10-24 10:51:23 demand -1L-1 stock -1L-1
after
Coffee   1125   1126      unk      unk  now
or
Coffee   1125   1126      unk      unk
or just:
Coffee   1125   1126
 
Just pushed v4.6.1, which makes it easier to edit JUST supply by adding "--supply" (or --sup or -S). "--all" and "--zero" went away in favor of "--supply" (-S), "--timestamps" (-T) instead of "--all) and "--force-na" (-0) instead of "--zero".
 
Just pushed v4.6.2 which will auto-correct some recent station name changes (e.g. maddavo's data will load again with the latest data).
Also a minor optimization pass on startup: it was taking 7+s for most cases, now it takes 1s or under again.
 
@kfsone....is there a complete list of commands available as the first post and bitbucket info pages seem to be outdated
i'm mainly looking for the command that displays refuel info for route planning
 
Just pushed v4.6.3 which unbreaks 4.6.2's distance calculations.

@NoTones: Yes, type "trade.py -h", or consult "README.txt".

-Oliver
 
Just pushed v4.6.3 which unbreaks 4.6.2's distance calculations.

@NoTones: Yes, type "trade.py -h", or consult "README.txt".

-Oliver

yeh ive done that but cant find anything about showing refuel info,

i may be wrong but when i first tried it awhile back im sure refuel info was displayed. (i may be mistaken as iv'e tried many route planners)
-h and reading the readme shows no command for refuel. and search for fuel in the readme shows nothing but "Hydrogen Fuels"
 
Ah, no, there's currently no refuel option unless you are thinking of the checklist which reminds you when to fuel during a run. TD doesn't currentl factor in the notion of stopping to buy fuel on a run. It's a little fuel-usage agnostic right now.
 
Just pushed v4.7.0 which adds a "buy" sub-command for finding somewhere nearby that sells an item, e.g.

Code:
$ trade.py buy Scrap --near iBootis --ly 10
Station                               Cost      Stock     Ly
------------------------------------------------------------
I BOOTIS/Chango Dock                    33      1,917   0.00
AULIN/Aulin Enterprise                  33              3.53
STYX/Wingrove Platform                  33     98,182   4.04
ASELLUS PRIMUS/Beagle 2 Landing         57        155   8.21
RAKAPILA/Stone Enterprise               44              9.14

As always, "-h" is your friend (i.e. "trade.py buy -h")
 
It seems that I can no longer get Maddavo's Market Share to parse my files after the format change.
I'm using the file attached and I'm receiving the following error after the file has been uploaded.

Code:
System: "14 HERCULIS", Station: "Ejeta Station"
System: "21 DRACO", Station: "Williams Point"
System: "35 DRACONIS", Station: "Redi Settlement"
System: "44 CHI DRACONIS", Station: "Ferguson Platform"
System: "61 URSAE MAJORIS", Station: "Murray Claim"
System: "ACIHAUT", Station: "Cuffey Plant"
System: "ALDERAMIN", Station: "Sullivan Port"
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '36761H'.

/td/processdata.asp, line 144

Looks like it breaks on the Explosives line for Sullivan Port
Code:
@ ALDERAMIN/Sullivan Port
   + Chemicals
      Explosives                175     186       n/a   36761H  2014-10-26 21:24:32
 
Ah, no, there's currently no refuel option unless you are thinking of the checklist which reminds you when to fuel during a run. TD doesn't currentl factor in the notion of stopping to buy fuel on a run. It's a little fuel-usage agnostic right now.

thanks i can stop scratching my head now :) may need to borrow that Kasa to cover the new bald spot !
 
It seems that I can no longer get Maddavo's Market Share to parse my files after the format change.
I'm using the file attached and I'm receiving the following error after the file has been uploaded.

Code:
System: "14 HERCULIS", Station: "Ejeta Station"
System: "21 DRACO", Station: "Williams Point"
System: "35 DRACONIS", Station: "Redi Settlement"
System: "44 CHI DRACONIS", Station: "Ferguson Platform"
System: "61 URSAE MAJORIS", Station: "Murray Claim"
System: "ACIHAUT", Station: "Cuffey Plant"
System: "ALDERAMIN", Station: "Sullivan Port"
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '36761H'.

/td/processdata.asp, line 144

Looks like it breaks on the Explosives line for Sullivan Port
Code:
@ ALDERAMIN/Sullivan Port
   + Chemicals
      Explosives                175     186       n/a   36761H  2014-10-26 21:24:32

I stupidly forgot some quotes in sql. Fixed now.
 
Back
Top Bottom