In-Development TradeDangerous: power-user trade optimizer

v6.6.0 is up

The little CHANGES.txt log doesn't really do it justice, this is a fairly major performance improvement that should also fix the "memory error" issues we were starting to see. The WWIIOLers also get to laugh that I wrote a grid system for organizing stars.

This version adds a little extra general overhead starting TD, it should be fairly small, but it should mostly result in much, much faster calculations of longer runs.

As always, if you need to report bugs, please use the issue tracker: http://kfs.org/td/issues

If you need assistance, you can ask here but help is usually faster in the group: http://kfs.org/td/group

Code:
v6.6.0 Jan 08 2015
. (kfsone) Overhaul of loading of trades and adjancent-system finding
  - Item data is loaded as discrete sales and purchases in TradeCalc,
  - Trades (X Selling, Y Buying) are lazily populated by TradeCalc,
  - TradeDB now builds a "StellarGrid" rather than relying on the
    database for locality searches; massive perf improvement for Windows
  - Reduces memory footprint and should fix memory errors 32-bit users
    were having.
. (kfsone) Fixed import command barfing if you didn't specify a filename
. (kfsone) Added a hop-no display during "run" command,
. (kfsone) Fixed a stupid command line problem with 'station' command,
+ Data: Path O'Gen, kfsone
 
When I try to find a route with some profitable trades from sol to aulin I'm checking it out first with this:
Code:
trade.py nav --ly 12.02 sol aulin
System       JumpLy
-------------------
SOL            0.00
STRUVE 2398   11.64
G 203-51      10.40
G 203-47       3.75
TILIAN         9.18
AULIN         11.83
Looks like 5 jumps before we are at aulin, ok so I'm doing next what I believe to be correct:
Code:
trade.py run --cr 10000000 --cap 532 --ly 12.02 -vvv --pad l --fr sol --to aulin --jumps 5 --hops 1
SOL/Daedalus -> NZAMBASSEE/Broderick Orbital (score: 684370.928640)
Start CR: 10,000,000
Hops    :          1
Jumps   :          4
Gain CR :    684,152
Gain/Hop:    684,152
Final CR: 10,684,152

  Load from SOL/Daedalus (225ls/star, Yes/bm, Lrg/pad):
      532 x Superconductors      6,162cr each,  3,278,184cr total,  data from 46hrs and 8days
  Jump SOL -> DUAMTA -> SAKTSAK -> LHS 293 -> NZAMBASSEE
  Unload at NZAMBASSEE/Broderick Orbital (890ls/star, Yes/bm, Lrg/pad) => Gain 684,152cr (1,286cr/ton) => 10,684,152cr
  ----------------------------------------------------------------------------
  Finish at NZAMBASSEE/Broderick Orbital (890ls/star, Yes/bm, Lrg/pad) gaining 684,152cr => est 10,684,152cr total
Any idea where am I going wrong with this one?
 
When I try to find a route with some profitable trades from sol to aulin I'm checking it out first with this:
Code:
trade.py nav --ly 12.02 sol aulin
System       JumpLy
-------------------
SOL            0.00
STRUVE 2398   11.64
G 203-51      10.40
G 203-47       3.75
TILIAN         9.18
AULIN         11.83
Looks like 5 jumps before we are at aulin, ok so I'm doing next what I believe to be correct:
Code:
trade.py run --cr 10000000 --cap 532 --ly 12.02 -vvv --pad l --fr sol --to aulin --jumps 5 --hops 1
SOL/Daedalus -> NZAMBASSEE/Broderick Orbital (score: 684370.928640)
Start CR: 10,000,000
Hops    :          1
Jumps   :          4
Gain CR :    684,152
Gain/Hop:    684,152
Final CR: 10,684,152

  Load from SOL/Daedalus (225ls/star, Yes/bm, Lrg/pad):
      532 x Superconductors      6,162cr each,  3,278,184cr total,  data from 46hrs and 8days
  Jump SOL -> DUAMTA -> SAKTSAK -> LHS 293 -> NZAMBASSEE
  Unload at NZAMBASSEE/Broderick Orbital (890ls/star, Yes/bm, Lrg/pad) => Gain 684,152cr (1,286cr/ton) => 10,684,152cr
  ----------------------------------------------------------------------------
  Finish at NZAMBASSEE/Broderick Orbital (890ls/star, Yes/bm, Lrg/pad) gaining 684,152cr => est 10,684,152cr total
Any idea where am I going wrong with this one?

I got the same problem since the trade-loading-refactor branch merged.
See here:

Code:
trade.py run --cap 104 --ly 18.50 --empty-ly 27.69 --hops 5 --cr 1600000 --fr amber/smith --to 78ursae/teller --via 78ursae
AMBER/Smith Landing -> 78 URSAE MAJORIS/Teller Terminal
  AMBER/Smith Landing: 104 x Gold,
  ROSS 112/Egan Orbital: 104 x Performance Enhancers,
  MZ URSAE MAJORIS/Tenn Landing: 104 x Gold,
  ROSS 112/Egan Orbital: 104 x Performance Enhancers,
  MZ URSAE MAJORIS/Tenn Landing: 104 x Gold,
  78 URSAE MAJORIS/Teller Terminal +652.080cr

trade.py run --cap 104 --ly 18.50 --empty-ly 27.69 --hops 5 --cr 1600000 --fr amber/smith --to 78ursae/teller
AMBER/Smith Landing -> LHS 2459/Robinson Prospect
  AMBER/Smith Landing: 104 x Palladium,
  KHERNIDJAL/West Gateway: 104 x Resonating Separators,
  BD+55 1519/Schirra Port: 104 x Beryllium,
  LP 5-88/Hirase Holdings: 104 x Indite,
  LFT 6/Mayer Plant: 104 x Imperial Slaves,
  LHS 2459/Robinson Prospect +1.098.240cr



As it seems to be something with the via and to parameter, that went wrong.
 
I looked at my own notes and there is no personal weapon sold in this station.

So if I submit full and correct set of commodities in import.prices file into maddavo's site... it doesn't actually delete old bad data which should not exist in the first place. I need to set the "<commodity name> 0 0 - - " entry for any deletions, which is a pain. I wish there would be some simple method to just get EliteOCR import.prices file and be done with it, no need to go manually hunting any leftovers from beta/gamma days or similar.

Its just me mumbling out loud, no question or anything here. Just a mumble. Mumblemumble ;)


To solve this I import the ocr file to my TD then use the update function for that one station. I just run it and close the box to generate an update.prices file.
If you then upload that to maddavo it will delete the missing commodities.

It would help if I could set this step to automate so whenever new data is imported from ocr an update.prices file is created.
If the update file could hold more than 1 station at a time it would be much easier to upload all at once to maddavo
 
Open the text file "corrections.py" in the main TD directory.

I see how that works thanks. What it doesn't seem to cover is removing a particular product from a particular station. I mean I could remove slaves completely in the items section, but unless I am missing something - not from just one station. Equally I could remove the whole station.

The only one I know personally which fits patterns in that file is George Lucas in Leesti always losing its space (GeorgeLucas) but you have that.
 
As it seems to be something with the via and to parameter, that went wrong.

Yup I have similar

Code:
trade.py run --ca 76 --cr 170000 --ly 19.71 --from lft926/mere --to bunda/fara --hops 1
LFT 926/Meredith City -> KOMOVOY/Gentle Dock
  LFT 926/Meredith City: 76 x Reactive Armour,
  KOMOVOY/Gentle Dock +56,620cr

The debug option appears to be broken as well.

Code:
trade.py run --ca 76 --cr 170000 --ly 19.71 --from lft926/mere --to bunda/fara --hops 1 --debug -vvv
# Via: set()
# From LFT 926/Meredith City, To ['BUNDA/Faraday Ring'], Via None, Cap 76, Credits 170000, Hops 1, Jumps/Hop 2, Ly/Jump
19.71

# Loaded 29248 selling values
# Loaded 87258 buying values
Traceback (most recent call last):
  File "D:\Gadgets\TradeDangerous\trade.py", line 76, in <module>
    main(sys.argv)
  File "D:\Gadgets\TradeDangerous\trade.py", line 50, in main
    results = cmdenv.run(tdb)
  File "D:\Gadgets\TradeDangerous\commands\commandenv.py", line 79, in run
    return self._cmd.run(results, self, tdb)
  File "D:\Gadgets\TradeDangerous\commands\run_cmd.py", line 550, in run
    cmdenv.DEBUG0("Hop {}...")
  File "D:\Gadgets\TradeDangerous\tradeenv.py", line 44, in __DEBUG_ENABLED
    print('#', outText.format(*args, **kwargs))
IndexError: tuple index out of range
 
Last edited:
When I try to find a route with some profitable trades from sol to aulin I'm checking it out first with this:
Code:
trade.py nav --ly 12.02 sol aulin
System       JumpLy
-------------------
SOL            0.00
STRUVE 2398   11.64
G 203-51      10.40
G 203-47       3.75
TILIAN         9.18
AULIN         11.83
Looks like 5 jumps before we are at aulin, ok so I'm doing next what I believe to be correct:
Code:
trade.py run --cr 10000000 --cap 532 --ly 12.02 -vvv --pad l --fr sol --to aulin --jumps 5 --hops 1
SOL/Daedalus -> NZAMBASSEE/Broderick Orbital (score: 684370.928640)
Start CR: 10,000,000
Hops    :          1
Jumps   :          4
Gain CR :    684,152
Gain/Hop:    684,152
Final CR: 10,684,152

  Load from SOL/Daedalus (225ls/star, Yes/bm, Lrg/pad):
      532 x Superconductors      6,162cr each,  3,278,184cr total,  data from 46hrs and 8days
  Jump SOL -> DUAMTA -> SAKTSAK -> LHS 293 -> NZAMBASSEE
  Unload at NZAMBASSEE/Broderick Orbital (890ls/star, Yes/bm, Lrg/pad) => Gain 684,152cr (1,286cr/ton) => 10,684,152cr
  ----------------------------------------------------------------------------
  Finish at NZAMBASSEE/Broderick Orbital (890ls/star, Yes/bm, Lrg/pad) gaining 684,152cr => est 10,684,152cr total
Any idea where am I going wrong with this one?

Ok, that was a little squirrely, but it's fixed :)

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

Yup I have similar

Code:
trade.py run --ca 76 --cr 170000 --ly 19.71 --from lft926/mere --to bunda/fara --hops 1
LFT 926/Meredith City -> KOMOVOY/Gentle Dock
  LFT 926/Meredith City: 76 x Reactive Armour,
  KOMOVOY/Gentle Dock +56,620cr

The debug option appears to be broken as well.

Code:
trade.py run --ca 76 --cr 170000 --ly 19.71 --from lft926/mere --to bunda/fara --hops 1 --debug -vvv
...
Traceback (most recent call last):
...
IndexError: tuple index out of range

Also fixed.

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

I see how that works thanks. What it doesn't seem to cover is removing a particular product from a particular station. I mean I could remove slaves completely in the items section, but unless I am missing something - not from just one station. Equally I could remove the whole station.

The only one I know personally which fits patterns in that file is George Lucas in Leesti always losing its space (GeorgeLucas) but you have that.

Again this is a fairly subtle but important distinction: Maddavo's system assumes that if you don't send it a price for Station/Algae, that you are simply not updating that information, whereas trade.py import assumes it means the item is unavailable and removes it from the db. This keeps the local .prices file and the download from maddavo's smaller.

If you want to remove an item from mad's database, you have to send him an explicit "not available" entry:

Code:
@HERE/There
  + Novelty Items
    Party Hat   0 0 - - yyyy-mm-dd hh:mm:ss
 
Last edited:
Now it works --fr --to designation with proper amount of jumps:
Code:
trade.py run --cr 10000000 --cap 532 --ly 12.02 -vvv --pad l --fr sol --to aulin --hops 1 --jumps 5
SOL/Daedalus -> AULIN/Aulin Enterprise (score: 638514.912000)
Start CR: 10,000,000
Hops    :          1
Jumps   :          5
Gain CR :    638,400
Gain/Hop:    638,400
Final CR: 10,638,400

  Load from SOL/Daedalus (225ls/star, Yes/bm, Lrg/pad):
      532 x Superconductors      6,162cr each,  3,278,184cr total,  data from 2days and 4days
  Jump SOL -> STRUVE 2398 -> G 203-51 -> G 203-47 -> TILIAN -> AULIN
  Unload at AULIN/Aulin Enterprise (111ls/star, No/bm, Lrg/pad) => Gain 638,400cr (1,200cr/ton) => 10,638,400cr
  ----------------------------------------------------------------------------
  Finish at AULIN/Aulin Enterprise (111ls/star, No/bm, Lrg/pad) gaining 638,400cr => est 10,638,400cr total
But I was kind of looking to stop on each (or profitable) station along the way to make money. For example let's say you have Lakon Type-9 which fuel bill is enormous and you have to relocate that ship to 200Ly away from current location. It would be so nice to set --fr and --to systems and have TD calculate profits along all or at least many of the jumps.

Or am I missing some proper command for this?
 
Now it works --fr --to designation with proper amount of jumps:
Code:
trade.py run --cr 10000000 --cap 532 --ly 12.02 -vvv --pad l --fr sol --to aulin --hops 1 --jumps 5
SOL/Daedalus -> AULIN/Aulin Enterprise (score: 638514.912000)
Start CR: 10,000,000
Hops    :          1
Jumps   :          5
Gain CR :    638,400
Gain/Hop:    638,400
Final CR: 10,638,400

  Load from SOL/Daedalus (225ls/star, Yes/bm, Lrg/pad):
      532 x Superconductors      6,162cr each,  3,278,184cr total,  data from 2days and 4days
  Jump SOL -> STRUVE 2398 -> G 203-51 -> G 203-47 -> TILIAN -> AULIN
  Unload at AULIN/Aulin Enterprise (111ls/star, No/bm, Lrg/pad) => Gain 638,400cr (1,200cr/ton) => 10,638,400cr
  ----------------------------------------------------------------------------
  Finish at AULIN/Aulin Enterprise (111ls/star, No/bm, Lrg/pad) gaining 638,400cr => est 10,638,400cr total
But I was kind of looking to stop on each (or profitable) station along the way to make money. For example let's say you have Lakon Type-9 which fuel bill is enormous and you have to relocate that ship to 200Ly away from current location. It would be so nice to set --fr and --to systems and have TD calculate profits along all or at least many of the jumps.

Or am I missing some proper command for this?

Why don't you just lower your jumps and increase your hops?
if hops are too low to reach your target, you will get an output informing you about that.
 
Bdragon is right.

--hops 1 is forcing you to load at Sol and unload at Aulin with no stops in between. If you want 1 stop in between, you would use --hops=2, etc.

If you specify too many hops, but not enough jumps, you might get an error saying that it can't find any profitable routes, I think.
 
Now it works --fr --to designation with proper amount of jumps:
Code:
trade.py run --cr 10000000 --cap 532 --ly 12.02 -vvv --pad l --fr sol --to aulin --hops 1 --jumps 5
SOL/Daedalus -> AULIN/Aulin Enterprise (score: 638514.912000)
Start CR: 10,000,000
Hops    :          1
Jumps   :          5
Gain CR :    638,400
Gain/Hop:    638,400
Final CR: 10,638,400

  Load from SOL/Daedalus (225ls/star, Yes/bm, Lrg/pad):
      532 x Superconductors      6,162cr each,  3,278,184cr total,  data from 2days and 4days
  Jump SOL -> STRUVE 2398 -> G 203-51 -> G 203-47 -> TILIAN -> AULIN
  Unload at AULIN/Aulin Enterprise (111ls/star, No/bm, Lrg/pad) => Gain 638,400cr (1,200cr/ton) => 10,638,400cr
  ----------------------------------------------------------------------------
  Finish at AULIN/Aulin Enterprise (111ls/star, No/bm, Lrg/pad) gaining 638,400cr => est 10,638,400cr total
But I was kind of looking to stop on each (or profitable) station along the way to make money. For example let's say you have Lakon Type-9 which fuel bill is enormous and you have to relocate that ship to 200Ly away from current location. It would be so nice to set --fr and --to systems and have TD calculate profits along all or at least many of the jumps.

Or am I missing some proper command for this?

From the wiki: https://bitbucket.org/kfsone/tradedangerous/wiki/User Guide#markdown-header-terms

We use the term "hop" to mean picking up cargo from station A, travelling to station B and selling your cargo there.

But you've described a useful use-case (get me from A to B and make money on the way).

I'm considering adding a "--route" option - or something like it - which concerns itself more with getting from A to B such that the primary score factor is distance travelled and profit made is secondary.
 
That would be very useful. Sometimes you have to travel long distances for more profitable trade routes and as said its not cheap on lakon type-9 for sure. Please let us know if you add such feature :)

BTW guys I tried almost every combination I could think off, so yes I did add hops etc.
 
I'm getting:

Code:
$ ./trade.py run --cr 25000000 --cap 212 --pad l --ly 17.2 --fr zaragas
./trade.py: ERROR: unrecognized arguments: --pad l

usage: trade.py {run} ...

Running latest checkout from git... Has the --pad switch been removed?

UPDATE: Ignore me, I checked out the wrong tag!
 
Last edited:
Just wondering if you are planning on making a 'dumb user' friendly version with an installer and gui?

TL:DR; I would be glad to work with anyone who wants to build something like that around TD.

I've always been much better suited to developing the under-the-hood systems, what is often termed a "systems engineer"; my career as an MMO developer has mostly been building and optimizing game servers, and back-end tools used to manage, deploy, test and run those servers; at WWII Online I ninja-dev'd the "Wiretap" API that let community members develop tools out-of-game tools; I helped The Guardian roll-out their online presence, by helping flesh out the eCommerce system; I built cutting-edge network services and systems for Demon and the nascent UK internet industry in the mid 90s...

The front-end stuff I've done in the past has been passable, I wouldn't go so far as to say 'OK', but it also consumes an inordinate amount of my time to produce (http://web.archive.org/web/20030205012408/http://oliver.kfs.org/daoc/, https://bitbucket.org/kfsone/houseomatic/overview)

Besides, I can't find what I count as a half-decent, cross-platform, UI tool for Python 3. I'm half tempted to rewrite TD in either C# or Go. Then again, I may just rewrite the core in C++ as a service with a Thrift API to let your-choice-of-interface query it.
 
TL:DR; I would be glad to work with anyone who wants to build something like that around TD.
...
Besides, I can't find what I count as a half-decent, cross-platform, UI tool for Python 3. I'm half tempted to rewrite TD in either C# or Go. Then again, I may just rewrite the core in C++ as a service with a Thrift API to let your-choice-of-interface query it.

Well, I'm nowhere near 'usable' with it (mostly because it's the first time I've dove into python), but I'm poking at a bottle.py based front end for TD to be used with something like overwolf or the steam overlay browser from a user's local system. I ran across a php-based tool someone threw together with overwolf in mind, but it just gives a blank entry for command line arguments, then runs trade.py with that. I started in on my little toy to, hopefully, a) keep the database loaded, b) use the internals of yours directly from python, and c) avoid having to run a separate webserver.
 
v6.6.1is up: I added "--black-market" (-bm) and "--end-jumps" (-e) to the "run" command.

This lets you say "I want to go from somewhere within a couple of jumps of sol to somewhere in the vicinity of lave"

Code:
trade.py run ... --from sol --start-jumps 2 --end-jumps 5 ...
or
trade.py run ... --from sol --start 2 --end 5 ...
or
trade.py run ... --from sol -s 2 -e 5 ...

or fly to somewhere near Anlave that has a black market:

Code:
trade.py run .. --to anlave --end-jumps 4 --black-market
trade.py run .. --to anlave -e 4 -bm
 
Last edited:
Back
Top Bottom