Release Trade Dangerous (Est. 2015) Power user's highly configurable trade optimizer

Off-topic - I made Elite Exploration this week :)

Only combat left, but having just turned expert, that's going to be a slog.
Congratulations.

I've given up on combat as I so rarely do it these days. I'm at quite a high rating but most of that was achieved but having turreted weapons on my trade T9 back before the iCutter was released. Just as well since I suck at combat.
 
Hi, eyeonus.

I sent you two pull requests. The latter should address issue #28 regarding olddata, although I cannot check the results as completely as you can. The former replaces most of the progressbar usage in eddblink with the one from tqdm, which I think is cleaner and neater. It's also a bit more extensive than the wall of code I posted earlier :) If you like how that works, I'd consider attacking the progressbar in tradecalc next.
 
TD updated to allow the "--ls-max" and "--noplanetary" options with the olddata command.

Latest TD: 1aa7fc1

EDIT: Should the olddata output be updated to include whether a station is planetary or not, now that we have the "--no-planet" option, or is that superfluous? Also, should we include the "--planetary" option as well, which allows specifying to return only planetary stations, as well as only not planetary stations?

Code:
  --planetary PLANETARY
                        Limit to stations with one of the specified planetary,
                        e.g. --pla YN? matches any station, --pla Y matches
                        only planetary stations.
 
Last edited:
Hi, eyeonus.

I sent you two pull requests. The latter should address issue #28 regarding olddata, although I cannot check the results as completely as you can. The former replaces most of the progressbar usage in eddblink with the one from tqdm, which I think is cleaner and neater. It's also a bit more extensive than the wall of code I posted earlier :) If you like how that works, I'd consider attacking the progressbar in tradecalc next.
HI Avi0013, does this new progress bar you have added change the display in any way? If so then I'll need to change TD Helper 2 in order to deal with it correctly. Thanks.
 
I haven't merged it in yet, but not really, no. It's mostly backend improvements, from what I've read. It does make the progress bar a bit prettier, as for example:
Code:
$ find . -name '*.py' -exec cat \{} \; |
    tqdm --unit loc --unit_scale --total 857366 >> /dev/null
100%|███████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s]
 
TD updated to allow the "--ls-max" and "--noplanetary" options with the olddata command.

Latest TD: 1aa7fc1

EDIT: Should the olddata output be updated to include whether a station is planetary or not, now that we have the "--no-planet" option, or is that superfluous? Also, should we include the "--planetary" option as well, which allows specifying to return only planetary stations, as well as only not planetary stations?

Code:
  --planetary PLANETARY
                        Limit to stations with one of the specified planetary,
                        e.g. --pla YN? matches any station, --pla Y matches
                        only planetary stations.
I'd say go with the planetary option. We removed the no planetary option in TDH2 as it duplicated some of the planetary options, if you recall. We really want to be able to allow only planetary, no planetary and all stations and a single binary option such as no planetary does not allow this.
 
Last edited:
I haven't merged it in yet, but not really, no. It's mostly backend improvements, from what I've read. It does make the progress bar a bit prettier, as for example:
Code:
$ find . -name '*.py' -exec cat \{} \; |
    tqdm --unit loc --unit_scale --total 857366 >> /dev/null
100%|███████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s]

That will probably mean changing TDH2. The problem is that Windows does not differentiate between CR, LF and CRLF, or not in .NET where they all replaced by CRLF, so you have to look at what is being output by the python code and emulate a linefeed situation depending on what character has been output. It can be done as you can see from the display in TDH2 but if you change the progress bar then I also have to change the emulation code.

No big deal really, TDH2 will just show each output from TD on a separate line until I fix it.
 
Last edited:
I'm not really wanting to change the code anyway, because it means yet another external dependency that end-users would have to install, and I'm not even really happy about having requests, the only current dependency.

I'm working on revamping the code to be a little less amateur, which will definitely result in a speed-up, and hopefully enough of one that I can just do away with the progress bars - other than for downloading- altogether.

I'm holding back on making a decision on tqdm until I've finished that work, but I'm only going to do it if 1) the speed post-rehash is still slow enough to "need" progress updates of some kind, and 2) tqdm is a marked improvement over current in terms of speed.
 
Last edited:
I'd say go with the planetary option. We removed the no planetary option in TDH2 as it duplicated some of the planetary options, if you recall. We really want to be able to allow only planetary, no planetary and all stations and a single binary option such as no planetary does not allow this.
Right. TDH2 can run the olddata command. So we actually need to have the --planetary option for TDH2 users. Alright. I'll get on it. It's a simple code change. Give me like 30 minutes, got to walk the dog first.

EDIT: And done.

Latest commit (TD)- e4edf47: Add "--planetary" option to olddata command.
Code:
>trade.py olddata --pla YN?
Station                                     Age/days      StnLs Pad Plt
-----------------------------------------------------------------------
Biballi/Titius Ring                           694.78        951 Med  No
HIP 39821/Vinge Settlement                    694.77        129 Med  No
Dyava/Lasswitz Prospect                       693.91        295 Lrg Yes
Arakwa/Bassford's Claim                       693.47        142 Med  No
HIP 92915/MacVicar Horizons                   692.42      2.24K Lrg Yes
HIP 93745/Struzan Mines                       691.70       155K Med  No
Jannonandji/Wagner Arsenal                    691.57        149 Lrg Yes
Capricorni Sector JC-V c2-3/Poisson's Pride   691.29        102 Lrg Yes
HIP 71247/Verrazzano Port                     690.28      1.69K Med  No
Arietis Sector FW-W c1-16/Norgay Colony       690.25          ? Lrg Yes
Chacorii/Mason Depot                          689.73      4.30K Lrg Yes
LTT 2099/Hutton Depot                         688.79          ? Lrg Yes
Devasupai/Shkaplerov Terminal                 686.98          5 Med  No
Hydrae Sector DB-X c1-13/Frechet Terminal     686.52        958 Lrg Yes
Herme/Herodotus Point                         685.79      1.97K Lrg Yes
Scirtari/Garnier Installation                 685.77      3.69K Lrg Yes
Tsohodiae/Yurchikhin Base                     684.44      6.98K Lrg Yes
LHS 2687/Morrison Depot                       683.61          ? Lrg Yes
Ailuremowo/Kettle Station                     682.27         23 Med  No
Dievantja/Husband Mine                        681.04      3.05K Med  No
Code:
>trade.py olddata --pla Y
Station                                      Age/days      StnLs Pad Plt
------------------------------------------------------------------------
Dyava/Lasswitz Prospect                        693.92        295 Lrg Yes
HIP 92915/MacVicar Horizons                    692.42      2.24K Lrg Yes
Jannonandji/Wagner Arsenal                     691.57        149 Lrg Yes
Capricorni Sector JC-V c2-3/Poisson's Pride    691.30        102 Lrg Yes
Arietis Sector FW-W c1-16/Norgay Colony        690.26          ? Lrg Yes
Chacorii/Mason Depot                           689.73      4.30K Lrg Yes
LTT 2099/Hutton Depot                          688.79          ? Lrg Yes
Hydrae Sector DB-X c1-13/Frechet Terminal      686.53        958 Lrg Yes
Herme/Herodotus Point                          685.79      1.97K Lrg Yes
Scirtari/Garnier Installation                  685.78      3.69K Lrg Yes
Tsohodiae/Yurchikhin Base                      684.44      6.98K Lrg Yes
LHS 2687/Morrison Depot                        683.62          ? Lrg Yes
Hyades Sector IR-W d1-59/Tarentum Laboratory   680.54        902 Lrg Yes
Nandjil/Carpini Enterprise                     678.52          ? Lrg Yes
Warigua/Pike Horizons                          677.59      1.20K Lrg Yes
Caudjabe/Cartmill Terminal                     677.32      1.09K Lrg Yes
Scorpii Sector DL-Y d157/Remek's Inheritance   676.64          ? Lrg Yes
Nageni/Martin Base                             675.96      2.29K Lrg Yes
Kotilekui/Hire Survey                          674.91        855 Lrg Yes
Birjorobog/Milnor Forum                        674.79        302 Lrg Yes
Code:
>trade.py olddata --pla N
Station                               Age/days      StnLs Pad Plt
-----------------------------------------------------------------
Biballi/Titius Ring                     694.78        951 Med  No
HIP 39821/Vinge Settlement              694.77        129 Med  No
Arakwa/Bassford's Claim                 693.47        142 Med  No
HIP 93745/Struzan Mines                 691.70       155K Med  No
HIP 71247/Verrazzano Port               690.29      1.69K Med  No
Devasupai/Shkaplerov Terminal           686.98          5 Med  No
Ailuremowo/Kettle Station               682.27         23 Med  No
Dievantja/Husband Mine                  681.04      3.05K Med  No
Pirni/Knapp Point                       680.76        29K Med  No
HR 6077/Ricardo Depot                   680.63      6.00K Med  No
Ngolingo/Pinto Holdings                 680.23      1.24K Med  No
Ngolingo/Ozanne City                    680.22      1.22K Med  No
HIP 7199/Lambert Terminal               679.87        432 Med  No
HIP 5183/Oren Mines                     679.64        14K Med  No
Purunsi/Furukawa Hub                    678.61      1.32K Med  No
HIP 118247/Jekhowsky Horizons           677.80      2.00K Med  No
HIP 89285/Safdie Dock                   677.79      8.18K Med  No
Libuhchal/Balog's Claim                 676.93       231K Med  No
Dziewong Bo/Kennicott Oasis             676.72        132 Med  No
HIP 78923/Antonio de Andrade Terminal   676.63      1.46K Med  No
Might as well leave this in, I guess:
Code:
>trade.py olddata --no-p
Station                               Age/days      StnLs Pad Plt
-----------------------------------------------------------------
Biballi/Titius Ring                     694.78        951 Med  No
HIP 39821/Vinge Settlement              694.77        129 Med  No
Arakwa/Bassford's Claim                 693.47        142 Med  No
HIP 93745/Struzan Mines                 691.70       155K Med  No
HIP 71247/Verrazzano Port               690.29      1.69K Med  No
Devasupai/Shkaplerov Terminal           686.99          5 Med  No
Ailuremowo/Kettle Station               682.27         23 Med  No
Dievantja/Husband Mine                  681.04      3.05K Med  No
Pirni/Knapp Point                       680.76        29K Med  No
HR 6077/Ricardo Depot                   680.63      6.00K Med  No
Ngolingo/Pinto Holdings                 680.23      1.24K Med  No
Ngolingo/Ozanne City                    680.22      1.22K Med  No
HIP 7199/Lambert Terminal               679.87        432 Med  No
HIP 5183/Oren Mines                     679.65        14K Med  No
Purunsi/Furukawa Hub                    678.62      1.32K Med  No
HIP 118247/Jekhowsky Horizons           677.80      2.00K Med  No
HIP 89285/Safdie Dock                   677.79      8.18K Med  No
Libuhchal/Balog's Claim                 676.93       231K Med  No
Dziewong Bo/Kennicott Oasis             676.72        132 Med  No
HIP 78923/Antonio de Andrade Terminal   676.63      1.46K Med  No
 
Last edited:
Right. TDH2 can run the olddata command. So we actually need to have the --planetary option for TDH2 users. Alright. I'll get on it. It's a simple code change. Give me like 30 minutes, got to walk the dog first.

EDIT: And done.

Latest commit (TD)- e4edf47: Add "--planetary" option to olddata command.
Code:
>trade.py olddata --pla YN?
Station                                     Age/days      StnLs Pad Plt
-----------------------------------------------------------------------
Biballi/Titius Ring                           694.78        951 Med  No
HIP 39821/Vinge Settlement                    694.77        129 Med  No
Dyava/Lasswitz Prospect                       693.91        295 Lrg Yes
Arakwa/Bassford's Claim                       693.47        142 Med  No
HIP 92915/MacVicar Horizons                   692.42      2.24K Lrg Yes
HIP 93745/Struzan Mines                       691.70       155K Med  No
Jannonandji/Wagner Arsenal                    691.57        149 Lrg Yes
Capricorni Sector JC-V c2-3/Poisson's Pride   691.29        102 Lrg Yes
HIP 71247/Verrazzano Port                     690.28      1.69K Med  No
Arietis Sector FW-W c1-16/Norgay Colony       690.25          ? Lrg Yes
Chacorii/Mason Depot                          689.73      4.30K Lrg Yes
LTT 2099/Hutton Depot                         688.79          ? Lrg Yes
Devasupai/Shkaplerov Terminal                 686.98          5 Med  No
Hydrae Sector DB-X c1-13/Frechet Terminal     686.52        958 Lrg Yes
Herme/Herodotus Point                         685.79      1.97K Lrg Yes
Scirtari/Garnier Installation                 685.77      3.69K Lrg Yes
Tsohodiae/Yurchikhin Base                     684.44      6.98K Lrg Yes
LHS 2687/Morrison Depot                       683.61          ? Lrg Yes
Ailuremowo/Kettle Station                     682.27         23 Med  No
Dievantja/Husband Mine                        681.04      3.05K Med  No
Code:
>trade.py olddata --pla Y
Station                                      Age/days      StnLs Pad Plt
------------------------------------------------------------------------
Dyava/Lasswitz Prospect                        693.92        295 Lrg Yes
HIP 92915/MacVicar Horizons                    692.42      2.24K Lrg Yes
Jannonandji/Wagner Arsenal                     691.57        149 Lrg Yes
Capricorni Sector JC-V c2-3/Poisson's Pride    691.30        102 Lrg Yes
Arietis Sector FW-W c1-16/Norgay Colony        690.26          ? Lrg Yes
Chacorii/Mason Depot                           689.73      4.30K Lrg Yes
LTT 2099/Hutton Depot                          688.79          ? Lrg Yes
Hydrae Sector DB-X c1-13/Frechet Terminal      686.53        958 Lrg Yes
Herme/Herodotus Point                          685.79      1.97K Lrg Yes
Scirtari/Garnier Installation                  685.78      3.69K Lrg Yes
Tsohodiae/Yurchikhin Base                      684.44      6.98K Lrg Yes
LHS 2687/Morrison Depot                        683.62          ? Lrg Yes
Hyades Sector IR-W d1-59/Tarentum Laboratory   680.54        902 Lrg Yes
Nandjil/Carpini Enterprise                     678.52          ? Lrg Yes
Warigua/Pike Horizons                          677.59      1.20K Lrg Yes
Caudjabe/Cartmill Terminal                     677.32      1.09K Lrg Yes
Scorpii Sector DL-Y d157/Remek's Inheritance   676.64          ? Lrg Yes
Nageni/Martin Base                             675.96      2.29K Lrg Yes
Kotilekui/Hire Survey                          674.91        855 Lrg Yes
Birjorobog/Milnor Forum                        674.79        302 Lrg Yes
Code:
>trade.py olddata --pla N
Station                               Age/days      StnLs Pad Plt
-----------------------------------------------------------------
Biballi/Titius Ring                     694.78        951 Med  No
HIP 39821/Vinge Settlement              694.77        129 Med  No
Arakwa/Bassford's Claim                 693.47        142 Med  No
HIP 93745/Struzan Mines                 691.70       155K Med  No
HIP 71247/Verrazzano Port               690.29      1.69K Med  No
Devasupai/Shkaplerov Terminal           686.98          5 Med  No
Ailuremowo/Kettle Station               682.27         23 Med  No
Dievantja/Husband Mine                  681.04      3.05K Med  No
Pirni/Knapp Point                       680.76        29K Med  No
HR 6077/Ricardo Depot                   680.63      6.00K Med  No
Ngolingo/Pinto Holdings                 680.23      1.24K Med  No
Ngolingo/Ozanne City                    680.22      1.22K Med  No
HIP 7199/Lambert Terminal               679.87        432 Med  No
HIP 5183/Oren Mines                     679.64        14K Med  No
Purunsi/Furukawa Hub                    678.61      1.32K Med  No
HIP 118247/Jekhowsky Horizons           677.80      2.00K Med  No
HIP 89285/Safdie Dock                   677.79      8.18K Med  No
Libuhchal/Balog's Claim                 676.93       231K Med  No
Dziewong Bo/Kennicott Oasis             676.72        132 Med  No
HIP 78923/Antonio de Andrade Terminal   676.63      1.46K Med  No
Might as well leave this in, I guess:
Code:
>trade.py olddata --no-p
Station                               Age/days      StnLs Pad Plt
-----------------------------------------------------------------
Biballi/Titius Ring                     694.78        951 Med  No
HIP 39821/Vinge Settlement              694.77        129 Med  No
Arakwa/Bassford's Claim                 693.47        142 Med  No
HIP 93745/Struzan Mines                 691.70       155K Med  No
HIP 71247/Verrazzano Port               690.29      1.69K Med  No
Devasupai/Shkaplerov Terminal           686.99          5 Med  No
Ailuremowo/Kettle Station               682.27         23 Med  No
Dievantja/Husband Mine                  681.04      3.05K Med  No
Pirni/Knapp Point                       680.76        29K Med  No
HR 6077/Ricardo Depot                   680.63      6.00K Med  No
Ngolingo/Pinto Holdings                 680.23      1.24K Med  No
Ngolingo/Ozanne City                    680.22      1.22K Med  No
HIP 7199/Lambert Terminal               679.87        432 Med  No
HIP 5183/Oren Mines                     679.65        14K Med  No
Purunsi/Furukawa Hub                    678.62      1.32K Med  No
HIP 118247/Jekhowsky Horizons           677.80      2.00K Med  No
HIP 89285/Safdie Dock                   677.79      8.18K Med  No
Libuhchal/Balog's Claim                 676.93       231K Med  No
Dziewong Bo/Kennicott Oasis             676.72        132 Med  No
HIP 78923/Antonio de Andrade Terminal   676.63      1.46K Med  No
I'll add the new options to the old data page in TDH2 once I finish work. Thanks for the very speedy update.
 
I'm not really wanting to change the code anyway, because it means yet another external dependency that end-users would have to install, and I'm not even really happy about having requests, the only current dependency.

I'm working on revamping the code to be a little less amateur, which will definitely result in a speed-up, and hopefully enough of one that I can just do away with the progress bars - other than for downloading- altogether.

I'm holding back on making a decision on tqdm until I've finished that work, but I'm only going to do it if 1) the speed post-rehash is still slow enough to "need" progress updates of some kind, and 2) tqdm is a marked improvement over current in terms of speed.
In that case I'll not do anything until TDH2 starts giving odd results for the progress bar and then I'll update the code.

Thanks.
 
I'm not really wanting to change the code anyway, because it means yet another external dependency that end-users would have to install, and I'm not even really happy about having requests, the only current dependency.

I'm working on revamping the code to be a little less amateur, which will definitely result in a speed-up, and hopefully enough of one that I can just do away with the progress bars - other than for downloading- altogether.

I'm holding back on making a decision on tqdm until I've finished that work, but I'm only going to do it if 1) the speed post-rehash is still slow enough to "need" progress updates of some kind, and 2) tqdm is a marked improvement over current in terms of speed.
Completely understood. One other benefit though is that if tqdm knows the total, it also calculates estimated remaining time. This is valuable for someone to decide whether or not to end a `trade run` call early. Of course, you can add that to misc.progress too if that works.
 
I've just tried an old data command and got a slightly odd result. The command is:

Code:
trade.py olddata --route --ly=50 --limit=42 -vv --near="Orang/Bessel Gateway"
and I had expected the result to be sorted by distance. What I got was something different.

Code:
Station                          DistLy Age/days      StnLs Pad Plt
-------------------------------------------------------------------
Aracenus/Ziegler Base             37.16   350.06      4.15K Lrg Yes
Aracenus/Hayashi Vision           37.16     4.78      4.21K Lrg  No
Aracenus/Chernykh Hub             37.16   134.92         73 Med  No
Aracenus/Fraunhofer Ring          37.16    79.07      3.94K Lrg  No
Aracenus/Ingstad Keep             37.16   307.94      3.63K Lrg Yes
Aracenus/Mason Port               37.16    12.94      4.09K Lrg  No
Aracenus/Jenkins Station          37.16   156.88        103 Med  No
Aracenus/Fadlan Terminal          37.16   280.84        183 Lrg Yes
Aracenus/Hoffmeister Station      37.16   118.93        328 Med  No
Khepehueno/Kranz Dock             38.39    44.91        490 Med  No
Kao Wanga/De City                 37.47     0.73          7 Lrg  No
Kao Wanga/de Kamp Terminal        37.47     6.83         13 Med  No
Kao Wanga/Sorayama Estate         37.47     5.77        881 Med  No
Aebocori/Barcelona Orbital        43.73     7.07        394 Med  No
Kausanla/van Houten Survey        41.42     7.10        211 Med  No
Mahau/Trujillo Mines              45.08     2.95      3.10K Med  No
Mahau/Bering Settlement           45.08    51.05      3.10K Lrg Yes
Igores/Parker Beacon              47.51     8.02         23 Med  No
Igores/Bouvard Port               47.51     6.82         23 Med  No
Igores/Plante Bastion             47.51     5.87      1.35K Lrg Yes
Ahmetes/Beg Terminal              49.12     2.93      3.62K Med  No
HIP 116939/Alfven Station         42.53     2.01      1.66K Lrg  No
HIP 116939/Flammarion Vision      42.53    47.37      2.31K Med  No
Osissi Hua/Lefschetz Beacon       41.29    84.11         40 Lrg Yes
Osissi Hua/Sutter Orbital         41.29     1.73         40 Lrg  No
He Xingo/Tusi City                38.61     1.87          8 Lrg  No
He Xingo/Dugan Dock               38.61    15.12        608 Med  No
He Xingo/Kent Beacon              38.61     1.73          8 Lrg Yes
Praavapri/Myasishchev Survey      37.75    17.96        125 Med  No
Tulua/Shaara Vision               35.79     4.70      2.23K Lrg Yes
Tulua/Chandra Vision              35.79     7.54      2.23K Med  No
Whadicates/Payne-Gaposchkin Camp  32.27    20.00      1.15K Med  No
Priba/Chelomey Landing            30.75     0.83        541 Med  No
Tapones/Krigstein Vision          29.40     1.82        16K Lrg  No
Tapones/Chadwick Observatory      29.40    47.77      3.47K Lrg Yes
Faroras/Parkinson Works           29.53     2.23        964 Med  No
Ambiliates/Addams Vision          32.12     1.87        607 Lrg  No
Ambiliates/Hanke-Woods Terminal   32.12     0.99      1.04K Med  No
Kebeledu/Martiniere Terminal      29.97     2.01      1.83K Med  No
Kebeledu/Bharadwaj Hub            29.97     7.56      1.39K Med  No
Kebeledu/Delaunay Beacon          29.97     7.28      1.38K Lrg Yes
Amarigeni/Bowen Platform          25.79     0.82        956 Med  No

As you can see, the results are not sorted by distance. Is my understanding of the --route option incorrect or is this a bug?
 
Last edited:
I've just tried an old data command and got a slightly odd result. The command is:

Code:
trade.py olddata --route --ly=50 --limit=42 -vv --near="Orang/Bessel Gateway"
and I had expected the result to be sorted by distance. What I got was something different.

Code:
Station                          DistLy Age/days      StnLs Pad Plt
-------------------------------------------------------------------
Aracenus/Ziegler Base             37.16   350.06      4.15K Lrg Yes
Aracenus/Hayashi Vision           37.16     4.78      4.21K Lrg  No
Aracenus/Chernykh Hub             37.16   134.92         73 Med  No
Aracenus/Fraunhofer Ring          37.16    79.07      3.94K Lrg  No
Aracenus/Ingstad Keep             37.16   307.94      3.63K Lrg Yes
Aracenus/Mason Port               37.16    12.94      4.09K Lrg  No
Aracenus/Jenkins Station          37.16   156.88        103 Med  No
Aracenus/Fadlan Terminal          37.16   280.84        183 Lrg Yes
Aracenus/Hoffmeister Station      37.16   118.93        328 Med  No
Khepehueno/Kranz Dock             38.39    44.91        490 Med  No
Kao Wanga/De City                 37.47     0.73          7 Lrg  No
Kao Wanga/de Kamp Terminal        37.47     6.83         13 Med  No
Kao Wanga/Sorayama Estate         37.47     5.77        881 Med  No
Aebocori/Barcelona Orbital        43.73     7.07        394 Med  No
Kausanla/van Houten Survey        41.42     7.10        211 Med  No
Mahau/Trujillo Mines              45.08     2.95      3.10K Med  No
Mahau/Bering Settlement           45.08    51.05      3.10K Lrg Yes
Igores/Parker Beacon              47.51     8.02         23 Med  No
Igores/Bouvard Port               47.51     6.82         23 Med  No
Igores/Plante Bastion             47.51     5.87      1.35K Lrg Yes
Ahmetes/Beg Terminal              49.12     2.93      3.62K Med  No
HIP 116939/Alfven Station         42.53     2.01      1.66K Lrg  No
HIP 116939/Flammarion Vision      42.53    47.37      2.31K Med  No
Osissi Hua/Lefschetz Beacon       41.29    84.11         40 Lrg Yes
Osissi Hua/Sutter Orbital         41.29     1.73         40 Lrg  No
He Xingo/Tusi City                38.61     1.87          8 Lrg  No
He Xingo/Dugan Dock               38.61    15.12        608 Med  No
He Xingo/Kent Beacon              38.61     1.73          8 Lrg Yes
Praavapri/Myasishchev Survey      37.75    17.96        125 Med  No
Tulua/Shaara Vision               35.79     4.70      2.23K Lrg Yes
Tulua/Chandra Vision              35.79     7.54      2.23K Med  No
Whadicates/Payne-Gaposchkin Camp  32.27    20.00      1.15K Med  No
Priba/Chelomey Landing            30.75     0.83        541 Med  No
Tapones/Krigstein Vision          29.40     1.82        16K Lrg  No
Tapones/Chadwick Observatory      29.40    47.77      3.47K Lrg Yes
Faroras/Parkinson Works           29.53     2.23        964 Med  No
Ambiliates/Addams Vision          32.12     1.87        607 Lrg  No
Ambiliates/Hanke-Woods Terminal   32.12     0.99      1.04K Med  No
Kebeledu/Martiniere Terminal      29.97     2.01      1.83K Med  No
Kebeledu/Bharadwaj Hub            29.97     7.56      1.39K Med  No
Kebeledu/Delaunay Beacon          29.97     7.28      1.38K Lrg Yes
Amarigeni/Bowen Platform          25.79     0.82        956 Med  No

As you can see, the results are not sorted by distance. Is my understanding of the --route option incorrect or is this a bug?
Oh boy, this is complicated. Took me a while to figure this out. Your understanding is, understandably, incorrect.

Firstly, '--route' and '--near' don't really interact, which is part of the misunderstanding.

If '--near' is used, the results will be restricted to systems within '--ly', default of 30, of the system specified by '--near'. (Yes, system, even if a station is specified. Station distances from primary star aren't used at all in this.)

The results are stored in a list in order of oldest data -> newest data, so the first entry is always the oldest result, second entry is second oldest result, etc.

If '--route' is used, the list is then resorted as follows:
Copy the results list to a temporary list.
Take the first entry from the results. Store as 'lastNode'. Create a new list with only this result, and remove this result from the temp list.

Loop until temp list is empty:
---- Find the result in the temp list with the shortest system-to-system jump distance to 'lastNode'. Other stations in the same system will return a distance of 0, so they'll always show up together, although not always in the same order. Store as 'nearest'.
---- Add 'nearest' to new list, remove 'nearest' from temp list, store 'nearest' as 'lastNode'

Store now complete new list as results list, replacing the original results list. (Same items, just different sort order.)
(EDIT: If '--near' is used, the above is all that happens. If it isn't, then it actually gets even more complicated, because it goes through that whole process for each result in the list, in case starting from the 12th entry results in a better route than starting from the first, etc.)

So, to summarize, '--route' doesn't sort according to the distance from the system specified by '--near', it sorts according to which station in the results is closest to the previous result, in terms of how far away the systems of the two stations are from each other.

To use your specific example:

'Aracenus/Ziegler Base' is the station with the oldest data within 50 ly of 'Orang/Bessel Gateway' and is the first result.
All the other 'Aracenus' stations are 0 ly from 'Aracenus/Ziegler Base' because they're in the same system and so they take up the next spots in the results list.
The nearest station in the results list to 'Aracenus/Ziegler Base' not in 'Aracenus' is 'Khepehueno/Kranz Dock'.
There are no other stations in 'Khepehueno'.
The nearest station in the results list to 'Khepehueno/Kranz Dock' is 'Kao Wanga/De City'.

And so on.

In other words, '--route' is what you want when you're wanting to travel to all the stations in the results list and you want to know the best route to do that.

(EDIT: I should say that 'best' in this case refers to the route with the shortest total jump distance. So a route that is 275lys is 'better' than one with 300lys.)

(EDIT: '--min-age' should definitely be used when using '--route', unless you don't mind seeing stations with relatively recent data show up in the results, such as "Kao Wanga/De City" in your example, which is 0.73 days old.)
 
Last edited:
Oh boy, this is complicated. Took me a while to figure this out. Your understanding is, understandably, incorrect.

Firstly, '--route' and '--near' don't really interact, which is part of the misunderstanding.

If '--near' is used, the results will be restricted to systems within '--ly', default of 30, of the system specified by '--near'. (Yes, system, even if a station is specified. Station distances from primary star aren't used at all in this.)

The results are stored in a list in order of oldest data -> newest data, so the first entry is always the oldest result, second entry is second oldest result, etc.

If '--route' is used, the list is then resorted as follows:
Copy the results list to a temporary list.
Take the first entry from the results. Store as 'lastNode'. Create a new list with only this result, and remove this result from the temp list.

Loop until temp list is empty:
---- Find the result in the temp list with the shortest system-to-system jump distance to 'lastNode'. Other stations in the same system will return a distance of 0, so they'll always show up together, although not always in the same order. Store as 'nearest'.
---- Add 'nearest' to new list, remove 'nearest' from temp list, store 'nearest' as 'lastNode'

Store now complete new list as results list, replacing the original results list. (Same items, just different sort order.)
(EDIT: If '--near' is used, the above is all that happens. If it isn't, then it actually gets even more complicated, because it goes through that whole process for each result in the list, in case starting from the 12th entry results in a better route than starting from the first, etc.)

So, to summarize, '--route' doesn't sort according to the distance from the system specified by '--near', it sorts according to which station in the results is closest to the previous result, in terms of how far away the systems of the two stations are from each other.

To use your specific example:

'Aracenus/Ziegler Base' is the station with the oldest data within 50 ly of 'Orang/Bessel Gateway' and is the first result.
All the other 'Aracenus' stations are 0 ly from 'Aracenus/Ziegler Base' because they're in the same system and so they take up the next spots in the results list.
The nearest station in the results list to 'Aracenus/Ziegler Base' not in 'Aracenus' is 'Khepehueno/Kranz Dock'.
There are no other stations in 'Khepehueno'.
The nearest station in the results list to 'Khepehueno/Kranz Dock' is 'Kao Wanga/De City'.

And so on.

In other words, '--route' is what you want when you're wanting to travel to all the stations in the results list and you want to know the best route to do that.

(EDIT: I should say that 'best' in this case refers to the route with the shortest total jump distance. So a route that is 275lys is 'better' than one with 300lys.)

(EDIT: '--min-age' should definitely be used when using '--route', unless you don't mind seeing stations with relatively recent data show up in the results, such as "Kao Wanga/De City" in your example, which is 0.73 days old.)
Good Grief!

I think that it may well be a good idea when --route is specified to restrict the number of entries to a smaller number than 42, which is the default if nothing else is specified, since this definitely not a O(n) solution!

Many thanks for the explanation. I think I'll change the tool tip to indicate that the option looks for the shorter route to visit all systems and possibly the label to something other than just "Route".
 
Trade Dangerous Enhancement Request:

Add a --pad option to the olddata command.

The results of:

Code:
trade.py olddata --route --ly=50 --min-age=100 --limit=10 -vv --near="Orang/Bessel Gateway"
are

Code:
Station                      DistLy Age/days      StnLs Pad Plt
---------------------------------------------------------------
Aracenus/Ziegler Base         37.16   350.74      4.15K Lrg Yes
Aracenus/Ingstad Keep         37.16   308.62      3.63K Lrg Yes
Aracenus/Hoffmeister Station  37.16   119.61        328 Med  No
Aracenus/Chernykh Hub         37.16   135.60         73 Med  No
Aracenus/Jenkins Station      37.16   157.56        103 Med  No
Aracenus/Fadlan Terminal      37.16   281.52        183 Lrg Yes
Windumlia/Krenkel Colony      46.42   116.52        872 Med  No
Kusang/Bruce Observatory      44.06   160.33      6.85K Lrg Yes
Kusang/Franklin Beacon        44.06   160.34      6.86K Lrg Yes
Hunzicnal/Eddington Vision    43.54   161.28        15K Med  No

But my currently selected ship in TDH2 is an iCutter that can only land on L pads, so I'd like to be able to filter the old data results by the pad size.

Thanks.
 
Trade Dangerous Enhancement Request:

Add a --pad option to the olddata command.

The results of:

Code:
trade.py olddata --route --ly=50 --min-age=100 --limit=10 -vv --near="Orang/Bessel Gateway"
are

Code:
Station                      DistLy Age/days      StnLs Pad Plt
---------------------------------------------------------------
Aracenus/Ziegler Base         37.16   350.74      4.15K Lrg Yes
Aracenus/Ingstad Keep         37.16   308.62      3.63K Lrg Yes
Aracenus/Hoffmeister Station  37.16   119.61        328 Med  No
Aracenus/Chernykh Hub         37.16   135.60         73 Med  No
Aracenus/Jenkins Station      37.16   157.56        103 Med  No
Aracenus/Fadlan Terminal      37.16   281.52        183 Lrg Yes
Windumlia/Krenkel Colony      46.42   116.52        872 Med  No
Kusang/Bruce Observatory      44.06   160.33      6.85K Lrg Yes
Kusang/Franklin Beacon        44.06   160.34      6.86K Lrg Yes
Hunzicnal/Eddington Vision    43.54   161.28        15K Med  No

But my currently selected ship in TDH2 is an iCutter that can only land on L pads, so I'd like to be able to filter the old data results by the pad size.

Thanks.
https://github.com/eyeonus/Trade-Dangerous/issues/9
TD-GUI announcement.png
 
Last edited:
Top Bottom