In-Development TradeDangerous: power-user trade optimizer

So guys, being more into design and rusty as hell with any kind of coding, I've been looking at WYSIWYG python GUI tools as I'd really like to make a nice, clean GUI for the app, then perhaps have some skins that make it look like a "Trading Computer" etc.

I've been looking at Glade and QT-Designer, do you think either of these would allow me to do that with TD without too much headache? :p
 
So guys, being more into design and rusty as hell with any kind of coding, I've been looking at WYSIWYG python GUI tools as I'd really like to make a nice, clean GUI for the app, then perhaps have some skins that make it look like a "Trading Computer" etc.

I've been looking at Glade and QT-Designer, do you think either of these would allow me to do that with TD without too much headache? :p

It would be awesome to see an interface for this. I've seen some GUI's started, but not finish and others talked about, but not materialize. You have my support (as little as that may be) on this project.

PS. I can use the command line just fine, I think this TradeDangerous project is awesome and a GUI would make it more accessible to a wider audience. Plus a GUI might make using it faster. ;)
 
Also be aware that there are now systems with the same name but different coordinates (eg Chara), which will currently not work with TD.

Ouch. I'll add that to the stack of things to take into consideration.

- - - - - Additional Content Posted / Auto Merge - - - - -

Looks like TD is again not looking at the stock and/or time stamp when sending me off on a trade run.

I'm getting this:
Code:
D:\Games\TD>trade.py -v run --credits 537700 --ship cobra --capacity 29 --ly-per 13.27 --insurance 14000 --from "Derrickson"
With 537.700cr / From Derrickson's Escape / To Anywhere
29 cap, 2 hops, max 2 jumps/hop and max 13.27 ly/jump

KERIES/Derrickson's Escape -> AULIN/Aulin Enterprise:
 >-> At KERIES/Derrickson's Escape, Buy: 29 x Bertrandite (@2514cr),
  |   KERIES -> AULIN -> DAHAN
  +  At DAHAN/Dahan Gateway, Buy: 29 x Uranium (@1695cr),
  |   DAHAN -> AULIN
 <-< AULIN/Aulin Enterprise gaining 54.955cr => 578.655cr total

From this data for the Derrickson's Escape station:
Code:
# TradeDangerous prices for Derrickson's Escape

# 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><level> <stock units><level> [<timestamp>] ]
#   '?' or 'unk' indicates unknown values (don't care),
#   '-' or 'n/a' indicates 'not available' item,
#   Level can be '?', 'L', 'M' or 'H'
# If you omit the timestamp, the current time will be used when the file is loaded.

#     Item Name               Sell Cr  Buy Cr    Demand    Stock

@ KERIES/Derrickson's Escape
   + Chemicals
      Explosives                  353       0      458M        -
      Hydrogen Fuel               147     149         ?     200M
   + Consumer Items
      Clothing                    361       0       27L        -
      Consumer Tech              7363       0        1H        -
      Dom. Appliances             611       0       24M        -
   + Foods
      Animal Meat                1563       0        4H        -
      Coffee                     1485       0       16M        -
      Fish                        798       0       21M        -
      Food Cartridges             228       0      265H        -
      Fruit and Vegetables        417       0       72M        -
      Grain                       272       0       91M        -
      Synthetic Meat              314       0       30M        -
      Tea                        1758       0        6H        -
   + Legal Drugs
      Beer                        241       0      126M        -
      Liquor                      801       0       45H        -
      Narcotics                   210       0       56L        -
      Tobacco                    5348       0       46H        -
      Wine                        329       0       10M        -
   + Machinery
      Mineral Extractors          815       0      946H        -
      Power Generators            594       0        7L        -
      Water Purifiers             346       0       12L        -
   + Medicines
      Basic Medicines             435       0       90H        -
      Combat Stabilisers         2976       0        1L        -
      Performance Enhancers      6954       0        6L        -
      Progenitor Cells           7363       0        1H        -
   + Metals
      Cobalt                      668     685         ?       9L
      Gold                       9761    9762         ?       1L
      Palladium                 13793   13793         ?       1L
      Silver                     4920    4974         ?      10L
   + Minerals
      Bauxite                      91     107         ?     236L
      Bertrandite                2485    2514         ?       1L
      Coltan                     1359    1392         ?       3L
      Gallite                    1901    1924         ?       4L
      Indite                     2172    2197         ?       1L
      Lepidolite                  540     563         ?       9L
      Rutile                      281     295         ?      14L
      Uraninite                   853     875         ?       8L
   + Technology
      Bioreducing Lichen         1241       0      613H        -
      H.E. Suits                  286       0      126L        -
   + Waste
      Biowaste                     18      24         ?      13M
   + Weapons
      Non-Lethal Wpns            1939       0       11M        -
      Personal Weapons           4706       0       19H        -
      Reactive Armor             2361       0       16H        -

It also appears that the demand for items that are in stock is always reset to ? from - on every update that I make.

Gazelle posted a couple of issues on this and it was resolved.

- - - - - Additional Content Posted / Auto Merge - - - - -

Using v5.0.0 when I run "python trade.py run -h" (or any other command line) on ubuntu linux machine, I get this error:
Code:
  File "trade.py", line 471
    print(*summaries, sep=' / ')
          ^
SyntaxError: invalid syntax

Any ideas what might be wrong?

That's python 2.x complaining about python 3.x syntax. As the readme and the OP say: TD requires Python 3 (I develop with Python 3.4.1 or .2).
 
Getting this when trying to route between aulin and eranin (basic test to see if it works) while using maddavo's data:

Code:
C:\Users\Artip\tradedangerous>trade.py nav aulin eranin

Traceback (most recent call last):
  File "C:\Users\Artip\tradedangerous\trade.py", line 1090, in <module>
    main()
  File "C:\Users\Artip\tradedangerous\trade.py", line 1078, in main
    tdb = TradeDB(debug=args.debug, dbFilename=args.db, buildLinks=False, includeTrades=False)
  File "C:\Users\Artip\tradedangerous\tradedb.py", line 355, in __init__
    self.reloadCache()
  File "C:\Users\Artip\tradedangerous\tradedb.py", line 425, in reloadCache
    buildcache.buildCache(dbPath=self.dbPath, sqlPath=self.sqlPath, pricesPath=self.pricesPath, importTables=self.import
Tables, debug=self.debug)
  File "C:\Users\Artip\tradedangerous\buildcache.py", line 627, in buildCache
    processImportFile(tempDB, Path(importName), importTable, debug=debug)
  File "C:\Users\Artip\tradedangerous\buildcache.py", line 587, in processImportFile
    db.execute(sql_stmt, linein)
sqlite3.IntegrityError: NOT NULL constraint failed: Station.system_id

Everything is up to date, and I didn't find any obvious mistakes in the .csv files this time. Anybody know what's up?

This is usually caused by stale data in the .prices file (references to stations that got removed) but it's not very user friendly feedback.

I've fixed the underlying problem in the most recent versions, and I've just gone and made a change to significantly improve the feedback in the work-in-progress branch.
 
Alright now I ran it with python three, here is what I get with "python3 trade.py run --credits 1000" command line:
Code:
trade.py: data/TradeDangerous.prices:7 Unrecognized STAR/Station, '10 CANUM VENATICORUM/Janifer Port'.
Any ideas this time? :)
 
Alright now I ran it with python three, here is what I get with "python3 trade.py run --credits 1000" command line:
Code:
trade.py: data/TradeDangerous.prices:7 Unrecognized STAR/Station, '10 CANUM VENATICORUM/Janifer Port'.
Any ideas this time? :)

Looks like you need a later System.csv and Station.csv .
 
Probably overthinking this, but is there a way to specify that you want a simple A <-> B route? I'm using "--jum 1" but I'm getting nothing but A -> B -> C routes. At the very least, is there a way to specify that I don't want a route with "empty" jumps in it?

Where can I get those please? I downloaded the ones shown on your web page, were those old or?

I'm fairly certain that the ones on maddavo's page update automatically whenever new information is added. If you're getting a missing system/station error, just download the station/system.csv from his page again.
 
Last edited:
Okay so this is what I did:

1) download from https://bitbucket.org/kfsone/tradedangerous/downloads
2) download data from http://www.davek.com.au/td/ button "TradeDangerous"
3) unpack kfsone-tradedangerous-aed777b26076.zip (dunno if this is unique for my download or is with this file name really)
4) move TradeDangerous.prices file to data/ directory
5) run python3 trade.py run --credits 1000

And result is error:
Code:
trade.py: data/TradeDangerous.prices:7 Unrecognized STAR/Station, '10 CANUM VENATICORUM/Janifer Port'.
Where did I go wrong?

EDIT: I downloaded the CSV files and now finally I got it to run!
Code:
python3 trade.py run --credits 1000 --capacity 532 --ship type9
WYRD/Vonarburg Co-Operative -> LHS 3006/WCM Transfer Orbital:
 >-> At WYRD/Vonarburg Co-Operative, Buy: 24 x Algae,
  +  At STYX/Chu Hub, Buy: 131 x Food Cartridges,
 <-< LHS 3006/WCM Transfer Orbital gaining 33,456cr => 34,456cr total
 
Last edited:
Probably overthinking this, but is there a way to specify that you want a simple A <-> B route? I'm using "--jum 1" but I'm getting nothing but A -> B -> C routes. At the very least, is there a way to specify that I don't want a route with "empty" jumps in it?

You can specify the from and to station:
Code:
$ ./trade.py -vv run --ship sidew --cr 1000 --from azebancity --to azebancity --jump 1
With 1.000cr / From Azeban City / To Azeban City
4 cap, 2 hops, max 1 jumps/hop and max 7.25 ly/jump

ERANIN/Azeban City -> ERANIN/Azeban City:
Start CR:      1.000
Hops    :          2
Jumps   :          2
Gain CR :        951
Gain/Hop:        475
Final CR:      1.951

 >-> At ERANIN/Azeban City, Buy:
  |      3 x Fruit and Vegetables           @        302cr each,        906cr total,
  |   1.000cr => ERANIN -> ASELLUS PRIMUS => Gain 507cr (169cr/ton) => 1.507cr
  +  At ASELLUS PRIMUS/Beagle 2 Landing, Buy:
  |      4 x Basic Medicines                @        291cr each,      1.164cr total,
  |   1.507cr => ASELLUS PRIMUS -> ERANIN => Gain 444cr (111cr/ton) => 1.951cr
 <-< ERANIN/Azeban City gaining 951cr => 1.951cr total

Or you want to be in complete control, use the via:
Code:
$ ./trade.py -vv run --ship sidew --cr 1000 --from azebancity --via dahangate --to azebancity --jump 1
With 1.000cr / From Azeban City / To Azeban City / Via Dahan Gateway
4 cap, 2 hops, max 1 jumps/hop and max 7.25 ly/jump

ERANIN/Azeban City -> ERANIN/Azeban City:
Start CR:      1.000
Hops    :          2
Jumps   :          2
Gain CR :        800
Gain/Hop:        400
Final CR:      1.800

 >-> At ERANIN/Azeban City, Buy:
  |      4 x Mineral Oil                    @        155cr each,        620cr total,
  |   1.000cr => ERANIN -> DAHAN => Gain 660cr (165cr/ton) => 1.660cr
  +  At DAHAN/Dahan Gateway, Buy:
  |      4 x Biowaste                       @         27cr each,        108cr total,
  |   1.660cr => DAHAN -> ERANIN => Gain 140cr (35cr/ton) => 1.800cr
 <-< ERANIN/Azeban City gaining 800cr => 1.800cr total
 
Last edited:
Oh neat, for some reason I assumed it would parse that as trying to buy and sell at the same station without actually leaving.
 
Oh neat, for some reason I assumed it would parse that as trying to buy and sell at the same station without actually leaving.

That's what the "--hop" is for:

Code:
$ ./trade.py -vv run --ship sidew --cr 1000 --from azebancity --to azebancity --hop 1
./trade.py: Error in command line: More than one hop required to use same from/to destination

$ ./trade.py -vv run --ship sidew --cr 1000 --from azebancity --to azebancity --hop 3
With 1.000cr / From Azeban City / To Azeban City
4 cap, 3 hops, max 2 jumps/hop and max 7.25 ly/jump

ERANIN/Azeban City -> ERANIN/Azeban City:
Start CR:      1.000
Hops    :          3
Jumps   :          3
Gain CR :      1.439
Gain/Hop:        479
Final CR:      2.439

 >-> At ERANIN/Azeban City, Buy:
  |      3 x Fruit and Vegetables           @        302cr each,        906cr total,
  |   1.000cr => ERANIN -> ASELLUS PRIMUS => Gain 507cr (169cr/ton) => 1.507cr
  +  At ASELLUS PRIMUS/Beagle 2 Landing, Buy:
  |      2 x Lepidolite                     @        559cr each,      1.118cr total,
  |      2 x Synthetic Meat                 @        178cr each,        356cr total,
  |   1.507cr => ASELLUS PRIMUS -> DAHAN => Gain 792cr (198cr/ton) => 2.299cr
  +  At DAHAN/Dahan Gateway, Buy:
  |      4 x Biowaste                       @         27cr each,        108cr total,
  |   2.299cr => DAHAN -> ERANIN => Gain 140cr (35cr/ton) => 2.439cr
 <-< ERANIN/Azeban City gaining 1.439cr => 2.439cr total
 
Last edited:
I've just merged Smacker65's star data which is going to invalidate a lot of old stations and cause problems if you try to use an older .prices file.

I just tried importing data from maddavo's and it didn't work as-is, so we'll need to square that away.
 
Front End Windows GUI. I have not forgotten you guys. 2 weeks holiday and a new project starting at work so been a bit busy. Finished the basic screen designs and made them all dragable for multi-monitors, some need a bit more updating, navigation works a treat. Working on allowing multi-ships. Finally got myself a .prices file to use so I will be testing other aspects soon. Here is the lastest screen designs.

http://imgur.com/H3xMcWo
 
Front End Windows GUI. I have not forgotten you guys. 2 weeks holiday and a new project starting at work so been a bit busy. Finished the basic screen designs and made them all dragable for multi-monitors, some need a bit more updating, navigation works a treat. Working on allowing multi-ships. Finally got myself a .prices file to use so I will be testing other aspects soon. Here is the lastest screen designs.

http://imgur.com/H3xMcWo

Any chance you could make a version that's less... noisy? That's almost painful to look at for me. What is this being written in?
 
Any chance you could make a version that's less... noisy? That's almost painful to look at for me. What is this being written in?

I think it looks pretty cool. But along the lines of what Artip spoke to, if maybe a black translucent back drop for your 'results' frame may make it easier to read the text. And as bonus, since it is translucent you'll still see the art behind it. Thoughts?
 
There were a number of conflicts between Smacker's station list and maddavo's Stations.csv, plus maddavo's Stations.csv had a number of errors ("Moxons Mojo" and "Abnett Plateform").

I did a quick bit of scripting and the "corrections.py" should now correct all of these. I've also changed the parsers to adjust for mistakes in the Stations.csv so that corrections is now the boss of, well, everyone.

The upshot is that most people's .prices file should be unbroken right now, but I'll need to co-ordinate with mad and Smacker on what the actual station names are.
 
[helpful stuff regarding starting and ending at the same station]

This actually turned out to be less useful than I originally thought it would be, since I have to specify the exact station rather than telling the script itself that I want to start and stop at the same unspecified station with a single jump.
 
Back
Top Bottom