In-Development TradeDangerous: power-user trade optimizer

Well I have done everything the forums said i needed to do to register and make posts but it keeps thinking i have hyperlinks in this paste.. here goes try #5 at this post.

Anyway been enjoying the program allot and it reminds me of the throwback days to MSdos and allot of command line work and with that came a education for me in batch files so without further ado here I present to you a basic batch file that will generate some basic trade routes. It doesn't use all the advanced features like the x52 or the avoid or via commands. It will generate a route based on your answers to the questions it asks into a text document you can then open and read without squinting at that bad word wrapped command window. note its generating the most detailed reports as i didn't see a need to multi-variable the verbose details.

Hey Brute,

Would you like me to include this in the scripts directory? There's a "trade.bat" for Windows users in there, but I'd be happy to include yours there too; "brute.bat"? :)

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

Indeed, it was amazing to get comms from you and then see your ship, just great gaming moment :)

<jealous> :) then again, I usually lurk in my private group, so I only have myself to blame if I rarely see anyone else :)
 
Hey Brute,

Would you like me to include this in the scripts directory? There's a "trade.bat" for Windows users in there, but I'd be happy to include yours there too; "brute.bat"?

Really? Lol I am gonna go look now at your Batch file. nice menu system i may adapt some of that's in your into mine and compile a joint batch-file :)

It was 3am and it was a quick and dirty batch i made i'll improve it over time and put out newer versions :)

I had just assumed by the 71 pages of skimming in this thread there wasn't one so i made one.

Feel free to distro the batch file as you see fit just wanted to assist the rest of the community in using your great tool.
 
Last edited:
Station.csv has many stations without the landing pad size info, I would like to try to map these stations a little bit and add the missing info.

First I would take Station.csv and make new list of system/station names which don't have landing pad info (or can TradeDangerous return such list for me?), then I would need to plot a route for all these systems.

Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?
 
@maddavo, just to be sure, it's usefull, what i'm doing here:
Currently i'm uploading my prices with your plugin and also my changed station.csv to your market share.
New currently unknown systems are done via your link to Elite Dangerous Star Coordinator.
From time to time you are using your changed station.csv and system.csv to pull your new data to kfsone tradedangerous git, right?
Shall we assist in another way, or is it all you need?
 
Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?

I don't know how long you could make this, but

trade.py nav --ly-per N.NN start end --via station1,station2,station3,etc

works.

I don't think it's designed to work with huge lists though.
 
@maddavo, just to be sure, it's usefull, what i'm doing here:
Currently i'm uploading my prices with your plugin and also my changed station.csv to your market share.
New currently unknown systems are done via your link to Elite Dangerous Star Coordinator.
From time to time you are using your changed station.csv and system.csv to pull your new data to kfsone tradedangerous git, right?
Shall we assist in another way, or is it all you need?

Yep, that's it.

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

Station.csv has many stations without the landing pad size info, I would like to try to map these stations a little bit and add the missing info.

First I would take Station.csv and make new list of system/station names which don't have landing pad info (or can TradeDangerous return such list for me?), then I would need to plot a route for all these systems.

Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?

You can use the local -v command to list systems/stations around you and it shows the other data so you can see what's missing.
 
That way TD (as long as you run EDDN-tap.py) will always be up to date ;-)

Once you get how this works, it's a no-brainer, but please be aware that - just as it was with EMDN - people wind up with the impression that EDDN is something concrete you can pick up, like a database, as opposed to something ethereal like live radio - the latter being how it actually works.

Any time:

a) your internet is down,
b) you are not running the listener (e.g. to upgrade),
c) you experience packet loss,

you will lose updates and thus not be "up to date". You also start with nothing, the only data you get from EDDN is data that someone is submitting right now.

With the EDDN model - you only have what you've heard. Again, I know it sounds obvious, but people get caught out by this nuance all the time.

Hopefully EDDN has switched to sending batched updates in some form; last time I looked it had the same fundamental flaw as EMDN in that it was sending individual item updates.

With all of that said, there is a TD issue ticket for creating EDDN support for TD here https://bitbucket.org/kfsone/tradedangerous/issue/129/eddn-integration and the old EMDN code for TD is still in the source repository here https://bitbucket.org/kfsone/traded...058b31cb55f82f8c7c4b274809057b/?at=emdn-final
 
Last edited:
The EVE data relay works/worked ( haven't used it in some time) the same way. It'd make a fun little Pi project should you happen to have one running as a 24/7 agent topping up your prices file with a small energy bill attached :)
 
Station.csv has many stations without the landing pad size info, I would like to try to map these stations a little bit and add the missing info.

First I would take Station.csv and make new list of system/station names which don't have landing pad info (or can TradeDangerous return such list for me?), then I would need to plot a route for all these systems.

Can I give TD start system and list (loong list) of systems I want to travel to and it would then output a planned route from this start system to the closest system on the list and then the next closest... looping until we are done?


Code:
> pip install ipython     # or pip3 if you're using mac/lin
...
> ipython
In [1]: import tradedb
In [2]: tdb = tradedb.TradeDB()
In [3]: origin = tdb.lookupPlace("Sol/Abraham Lincoln")
In [4]: jumps=5, jumpLy=12.11
In [5]: tdb.getDestinations?
# ... [help on the function]
In [6]: dests = tdb.getDestinations(origin, maxJumps=jumps, maxLyPer=jumpLy, maxPadSize='?')
In [7]: dests.sort(key=lambda dest: dest.distLy)
In [8]: nextStop = dests[0]
In [9]: nextStop
Out[9]: Station(ID=3806, system'WISE\ 1506\+7027', dbname='Silverberg Relay', lsFromStar=100, blackMarket='?', maxPadSize='?')
In [10]: tdb.updateLocalStation(nextStop, maxPadSize='M')

Or you could paste the following into "findpads.py":

Code:
import tradedb
import re

tdb = tradedb.TradeDB()
origin = tdb.lookupPlace("Sol")
jumps = 5
jumpLy = 16.11

print("Commands are: 'quit', 'go', or 'origin placename'.\n")

while True:
    print("jumps:{}, lyPer:{}, origin: {}".format(
        jumps, jumpLy, origin.name()
    ))
    cmd = input("command: ").strip()
    space = cmd.find(' ')
    if space > 0:
        cmd, args = cmd[:space], cmd[space+1:]
    else:
        args = None
    if cmd.startswith('q'):
        raise SystemExit("Right you are")
    try:
        if cmd.startswith('ori'):
            origin = tdb.lookupPlace(args)
        elif cmd == "go":
            dests = tdb.getDestinations(
                origin, maxJumps=jumps, maxLyPer=jumpLy, maxPadSize='?'
            )
            dests.sort(key=lambda dest: dest.distLy)
            print(dests[0])
            for i in range(0, len(dests)):
                if dests[i].system.ID ==20559 and dests[i].station.dbname == "Silverberg Relay":
                    print("pos {}: {}".format(i, dests[i].distLy))
            nextSystem = dests[0].system
            dests = [ dest.station for dest in dests if dest.system == nextSystem ]
            dests.sort(key=lambda dest: dest.lsFromStar)
            for stn in dests:
                print("{}: ls from star: {}, max pad size: {}".format(
                        stn.name(), stn.lsFromStar, stn.maxPadSize
                ))
                newLs = input("Updated ls from star: ")
                if newLs:
                    updateLs = int(newLs)
                else:
                    updateLs = None
                newPad = input("Updated max pad size: ").upper()
                if newPad:
                    assert newPad in "SML?"
                    updatePad = newPad
                else:
                    updatePad = None
                if updateLs or updatePad:
                    tdb.updateLocalStation(stn, lsFromStar=updateLs, maxPadSize=updatePad)
            origin = nextSystem
            print()
    except Exception as e:
        print("Something went horribly wrong.\n"+str(e)+"\n")

And run against the current code ... It'll look up the closest system with ? pads and then prompt you to update the ls-from-star and pad size for each station in the system, and update the database as you go.

Code:
c:\blah\blah\trade> python findpads.py

Adjust the "jumps" and "jumpLy" values in the file to suit.

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

Really? Lol I am gonna go look now at your Batch file. nice menu system i may adapt some of that's in your into mine and compile a joint batch-file :)

It was 3am and it was a quick and dirty batch i made i'll improve it over time and put out newer versions :)

I had just assumed by the 71 pages of skimming in this thread there wasn't one so i made one.

Feel free to distro the batch file as you see fit just wanted to assist the rest of the community in using your great tool.

FYI - It's not my batch file, it's user contributed like yours :) Even if it was, I'd still offer the same option :)
 
Thanks for the code! I ran it and it did this:
Code:
python3 findpads.py
Commands are: 'quit', 'go', or 'origin placename'.

jumps:5, lyPer:16.11, origin: SOL
command: go
Something went horribly wrong.


jumps:5, lyPer:16.11, origin: SOL
command:
Any ideas? :)
 
Try running with the -w debug option (or -ww or -www depending on how much output you want) and see if there is another error or exception being raised. Of course if this error output is from the batch file as opposed to a .py file that may not help much likely.

Thanks for the code! I ran it and it did this:
Code:
python3 findpads.py[/FONT]
[FONT=Verdana]Commands are: 'quit', 'go', or 'origin placename'.[/FONT]

[FONT=Verdana]jumps:5, lyPer:16.11, origin: SOL[/FONT]
[FONT=Verdana]command: go[/FONT]
[FONT=Verdana]Something went horribly wrong.[/FONT]


[FONT=Verdana]jumps:5, lyPer:16.11, origin: SOL[/FONT]
[FONT=Verdana]command:
Any ideas? :)
 
Last edited:
Hi.

Small question - how to avoid only "usual slaves" and still try to search route with "Imperial slaves" ?

And another question - is it possible to add option circle, to found profitable circle route, with parameter - number of hops ...
 
Last edited:
Using
Code:
trade.py run
with the
Code:
--avoid slaves
flag should allow you to avoid slaves and still return routes with imperial slaves (if those are among the winning option for the trade hops). Searching for "slaves" using tdbuy only returns slaves, and searching for "imperial slaves" only imperial slaves, so I am assuming the matching used for --avoid works the same, although I have been known to be wrong in the past.

To do a circle route you just use --via and --hops/--jumps as desired, with --from and --to set to the same system/station. I believe kfsone provided an example of this earlier in the thread.

Hi.

Small question - how to avoid only "usual slaves" and still try to search route with "Imperial slaves" ?

And another question - is it possible to add option circle, to found profitable circle route, with parameter - number of hops ...
 
Last edited:
Thanks for the code! I ran it and it did this:
Code:
python3 findpads.py
Commands are: 'quit', 'go', or 'origin placename'.

jumps:5, lyPer:16.11, origin: SOL
command: go
Something went horribly wrong.


jumps:5, lyPer:16.11, origin: SOL
command:
Any ideas? :)

I suspect it's not finding anything in your database within 5x16.11 lightyears of SOL.

try this version instead:

Code:
import tradedb
import re

tdb = tradedb.TradeDB()
origin = tdb.lookupPlace("Sol")
jumps = 1
jumpLy = 30

print("Commands are: 'quit', 'go', 'jumps N', 'ly N.NN' or 'origin placename'.")

while True:
    print()
    print("origin: {}, jumps:{}, ly/jump:{}".format(
        origin.name(), jumps, jumpLy
    ))
    cmd = input("command: ").strip()
    space = cmd.find(' ')
    if space > 0:
        cmd, args = cmd[:space], cmd[space+1:]
    else:
        args = None
    if cmd.startswith('q'):
        raise SystemExit("Right you are.")
    try:
        if cmd.startswith('ori'):
            if not args:
                print(
                    "'origin' command needs a system/station name, e.g: "
                    "origin i bootis"
                )
                continue
            origin = tdb.lookupPlace(args)
        elif cmd.startswith('ju'):
            if not args:
                print(
                    "'jumps' command needs a number of jumps, e.g: "
                    "jumps 5"
                )
                continue
            jumps = int(args)
        elif cmd.startswith('ly'):
            if not args:
                print(
                    "'ly' command needs a lightyears value, e.g: "
                    "ly 4.2"
                )
                continue
            jumpLy = float(args)
        elif cmd == "go":
            dests = tdb.getDestinations(
                origin, maxJumps=jumps, maxLyPer=jumpLy, maxPadSize='?'
            )
            if not dests:
                print(
                        "Nothing found!\n"
                        "Adjust the search parameters by changing the "
                        "start system ('origin'), max jumps ('jumps') "
                        "or light-years per jump ('ly')."
                )
                continue
            dests.sort(key=lambda dest: dest.distLy)
            for i in range(0, len(dests)):
                if dests[i].system.ID ==20559 and dests[i].station.dbname == "Silverberg Relay":
                    print("pos {}: {}".format(i, dests[i].distLy))
            nextSystem = dests[0].system
            dests = [ dest.station for dest in dests if dest.system == nextSystem ]
            dests.sort(key=lambda dest: dest.lsFromStar)
            for stn in dests:
                print("{}: ls from star: {}, max pad size: {}".format(
                        stn.name(), stn.lsFromStar, stn.maxPadSize
                ))
                newLs = input("Updated ls from star: ")
                if newLs:
                    updateLs = int(newLs)
                else:
                    updateLs = None
                newPad = input("Updated max pad size: ").upper()
                if newPad:
                    assert newPad in "SML?"
                    updatePad = newPad
                else:
                    updatePad = None
                if updateLs or updatePad:
                    tdb.updateLocalStation(stn, lsFromStar=updateLs, maxPadSize=updatePad)
            origin = nextSystem
            print()
    except Exception as e:
        print("Something went horribly wrong.\n"+str(e)+"\n")
 
Updated Code:

- Bruteman's Windows script (scripts\tradebrute.bat)
- tKes change to "BUY" sub-command that recognizes ship names (find a ship vendor nearby),
- Some code cleanup that may provide a little performance boost in some functions,
- Lots of station updates,


My time is a little scarce this week, sorry for the lack of updates.
 
I updated 105 stations last night by checking them from galaxy/system map where available, submitted csv to maddavo's site. Apparently it went through as we saw changes in EDDB after updating :)

I'm spoke person for large ship owners and my enemies are the ? landing pads on station.csv file.
 
Still the same, something went horribly wrong. I placed the .py into TD root dir along side trade.py is that the correct place for it?

Yes, but the error you're getting, without a following exception message, isn't possible. So something is really going horribly wrong. You're trying different origins and jump distances etc, right?

If nothing else, replace print(...) on the last line with just

raise e

to allow the program to crash so maybe get some error info.
 
Last edited:
What the HELL! :)

I did not do nothing to findpads.py, just updated database daily/hourly as usual and now it works!
Code:
python3 findpads.py
Commands are: 'quit', 'go', 'jumps N', 'ly N.NN' or 'origin placename'.

origin: SOL, jumps:1, ly/jump:30
command: go
PROCYON/Manakov Dock: ls from star: 0, max pad size: ?
Updated ls from star: 100
Updated max pad size: L
NOTE: PROCYON/Manakov Dock (#3364) updated in /home/<stuff>/data/TradeDangerous.db: ls=100, bm=?, pad=L


origin: PROCYON, jumps:1, ly/jump:30
command:
I have no clue, but who cares if it works, it works :D

BTW when it says "updated in /..." does it only update it to the SQL .db file like it says, or to Station.csv as well?
 
Back
Top Bottom