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

Large ERK!!!

It looks like the latest patch has broken EDCE, which in turn breaks TDH. I note that EDCE hasn't been updated in over a year and its thread is locked. I'll raise this on GIT so Mark sees it, but be aware that the "Commander Profile" part of TDH won't be working right atm.

CAPI is broken/discontinued I fear.
 
Last edited:
Yes, right now the old authentication method for the cAPI doesn't work and the new one still needs to be fledged out. Frontier is working on it.

Seems a bit ridiculous the way they've done this. The actual cAPI is unchanged, so why does the authentication need to be left in a mess? Clearly they've got *something* working, as Anthor has a workaround up and has been working with them on it.

It may well be that the old method is undesirable for some reason, but killing it for no obvious reason than to coincide with a big patch makes no sense.

Fortunately there are ways to skin the cat, if anyone needs them.

EDDiscovery is working correctly, as far as I can see. I generally use it anyway and would recommend it's power to all kinds of things, though it is obviously a much larger piece of kit than EDMC.
EDSM have an EDDN updater running, you will need an EDSM account and need to have the webpage running in background, but it works. https://www.edsm.net/en_GB/settings/import/capi
 
I've updated the EDAPI plugin to the new authorization method.

If someone wanna try it out: plugins/edapi_plug.py

The first time it should open a new tab in your prefered webbrowser. You'll have to login with your frontier credentials and approve the EDAPI plugin. That's all. Everything else should be automagic.

BTW: This now also works for console players.

Hint: If you have problems please do NOT post your access or refresh token.
 
Last edited:
I spent the last three days recovering from a computer meltdown. Still picking up the pieces, which required a clean install of winblows, but I'm finally at the point where all I have to do is install a bunch of stuff. At some point in the hopefully near future, I will take a crack at integrating bgol's update to the edapi plugin into TD. Because I made my own changes, it is unfortunately not as simple as drag and drop, but I highly doubt the changes I made conflict at all.

EDIT: Plugin updated, and my thanks to gazelle.

EDIT2: Oh yes, and it's working just as expected, including the TDH option I added, so Mark should have no trouble switching over to using the plugin within TDH whenever he gets back.
 
Last edited:
I spent the last three days recovering from a computer meltdown. Still picking up the pieces, which required a clean install of winblows, but I'm finally at the point where all I have to do is install a bunch of stuff. At some point in the hopefully near future, I will take a crack at integrating bgol's update to the edapi plugin into TD. Because I made my own changes, it is unfortunately not as simple as drag and drop, but I highly doubt the changes I made conflict at all.

EDIT: Plugin updated, and my thanks to gazelle.

EDIT2: Oh yes, and it's working just as expected, including the TDH option I added, so Mark should have no trouble switching over to using the plugin within TDH whenever he gets back.

I'm back. I've been working on an interim solution to the cAPI problem and just posted that. I'll check out the EDAPI plugin from gazelle and eyeonus as a more permanent solution.
 
Last edited:
Hi Mark, I hope your list things has reduced enough for you to rejoin us! I have found a minor bug in TDH in that if I copy data from the output window to Save#1, Save#2 or Save#3 tabs the data gets transferred but if it is large enough to need scroll bars to read it, scroll bars do not appear. It is minor in the fact that I can maximise the screen to read it but it is an annoyance. The scroll bars seem to work as expected on the output tab but not the other save tabs. Thanks.


Thanks for the report, I'll have a look at it now that real life has calmed down a little.
 
I spent the last three days recovering from a computer meltdown. Still picking up the pieces, which required a clean install of winblows, but I'm finally at the point where all I have to do is install a bunch of stuff. At some point in the hopefully near future, I will take a crack at integrating bgol's update to the edapi plugin into TD. Because I made my own changes, it is unfortunately not as simple as drag and drop, but I highly doubt the changes I made conflict at all.

EDIT: Plugin updated, and my thanks to gazelle.

EDIT2: Oh yes, and it's working just as expected, including the TDH option I added, so Mark should have no trouble switching over to using the plugin within TDH whenever he gets back.

I now have a version of TDH2 that uses the EDAPI plugin but there seems to be a problem in that the file saved does not contain a valid json string.

A valid json string is saved if you change the save code (lines 749-757) to:

Code:
        if self.getOption("save"):
            saveName = tdh_path if self.getOption("tdh") else 'tmp/profile.' + time.strftime('%Y%m%d_%H%M%S') + '.json'
            with open(saveName, 'w', encoding="utf-8") as saveFile:
                if isinstance(api.text, list):
                    # since 4.3.0: list(profile, market, shipyard)
                    res = '{'
                    res += '"profile":' + api.text[0]
                    res += ', "market":'+ api.text[1]
                    res += ', "shipyard":' + api.text[2]
                    res += '}'
                    saveFile.write(res)
                else:
                    saveFile.write(api.text)
                print('API response saved to: {}'.format(saveName))

I have not made this a pull request as I'm not a python programmer and there may well be a better "pythonesque" way to do this. With the file saved this way TDH2 can use the file.

Thanks.

[edit] To preserve existing functionality it's probably a good idea to wrap this new code in an "if TDH" wrapper. But you know that anyway....
 
Last edited:
I've updated the EDAPI plugin to the new authorization method.

If someone wanna try it out: plugins/edapi_plug.py

The first time it should open a new tab in your prefered webbrowser. You'll have to login with your frontier credentials and approve the EDAPI plugin. That's all. Everything else should be automagic.

BTW: This now also works for console players.

Hint: If you have problems please do NOT post your access or refresh token.

For testing purposes, how do you invalidate the current token so that the user has to logon in again? Thanks.
 
I thought that TD was giving odd prices, 752 tonnes of goods giving a profit of 8MCr and taking 12 minutes to complete. That's 32MCr per hour. So I tried it and TD is correct!

I like the trading returns at the moment!
 
I now have a version of TDH2 that uses the EDAPI plugin but there seems to be a problem in that the file saved does not contain a valid json string.

A valid json string is saved if you change the save code (lines 749-757) to:

.
.
.

I have not made this a pull request as I'm not a python programmer and there may well be a better "pythonesque" way to do this. With the file saved this way TDH2 can use the file.

Thanks.

[edit] To preserve existing functionality it's probably a good idea to wrap this new code in an "if TDH" wrapper. But you know that anyway....
The existing output is valid json. Test it out yourself: https://jsonformatter.curiousconcept.com/
"Valid JSON (RFC 4627)"
The three sections not being labelled does not make the json invalid. It may make it a bit harder for you to use the result, but that's not the same as "invalid".

That said, I'd say the three sections really do need to be labelled, so I've made the needed changes to the plugin. Not with an "if TDH" wrapper, either.

It's a fairly simple one-line change:
Code:
                if isinstance(api.text, list):
                    # since 4.3.0: list(profile, market, shipyard)
                    saveFile.write('{{"profile":{}, "market":{}, "shipyard":{}}}'.format(*api.text))
                else:
I honestly don't think there is any usage for the json output other than TDH, so I'm not really concerned about "existing functionality". All it means is that anything which used to use the output will have to go from using "json_file[0]['commander']" to using "json_file['profile']['commander']", for example.

For testing purposes, how do you invalidate the current token so that the user has to logon in again? Thanks.

edapi.config in the "<td install>/data" folder.
 
Last edited:
TD has been updated to start using the names of things according to EDMC and the rest of the ED community rather than the incorrect names EDDB.io is using. I'm pretty sure I got all of them, but let me know if you find any others.
This change is backwards compatible with older TD versions, so you can update in-place, and the next time you run an eddblink import, it'll update the item names automagically.

The only file affected by this change is the "Item.csv" produced by TD. Since the listener uses that file to do its thing, anyone who is running a listener will have to update the listener as well as TD. Pretty sure that's just Tromador.

It's also not super-important that Tromador updates the server, since the dump files it produces currently will work just as well as those that would be produced after updating TD and the listener.
 
Last edited:
The existing output is valid json. Test it out yourself: https://jsonformatter.curiousconcept.com/
"Valid JSON (RFC 4627)"
The three sections not being labelled does not make the json invalid. It may make it a bit harder for you to use the result, but that's not the same as "invalid".

Curious. All the json importers/formatters I tried choked on the string. The main ones were the Sublime Text Pretty Json formatter and the Newtonsoft json library for .NET. Several others also had problems.

That said, I'd say the three sections really do need to be labelled, so I've made the needed changes to the plugin. Not with an "if TDH" wrapper, either.

It's a fairly simple one-line change:
Code:
                if isinstance(api.text, list):
                    # since 4.3.0: list(profile, market, shipyard)
                    saveFile.write('{{"profile":{}, "market":{}, "shipyard":{}}}'.format(*api.text))
                else:

Many thanks for doing that, I was fairly sure that there was a better Python way of doing it.

I honestly don't think there is any usage for the json output other than TDH, so I'm not really concerned about "existing functionality". All it means is that anything which used to use the output will have to go from using "json_file[0]['commander']" to using "json_file['profile']['commander']", for example.

Fair point.

edapi.config in the "<td install>/data" folder.

Ah, that's where it is. Thanks.
 
Last edited:
Okay, I just got done with a round of updates.

Since EDDB.io is so very, very slow at adding new commodities to its database, but EDMC is super-quick, the plugin has been updated to check to see if EDDB's dump is missing any new items using EDMC's list, and automatically adding any that are found. This means any time FDev adds new things to the game, like all the new minerals and Thargoid tissue samples that were added recently, TD will have them "as soon as" they're added to EDMC, where "as soon as" means once the item list is imported by the EDDBlink plugin after they show on EDMC. They'll be using the fdev_id as their item_id until they get added to EDDB, at which point the plugin will update the item_id to be whatever EDDB assigned to it.

The listener has also been updated with similar improvements, so once Tromador updates it, the new items will start showing up in TD with current market data.

(So, anybody that wants to starts trading Dynadrives can start cheering.)

Latest commit (TD): faa2ffd
Latest commit (EDDBlink-listener): a5f4aee
 
Last edited:
Version 2.1.0.1 of TD Helper 2 has been release and may be found at https://github.com/MarkAusten/TDHelper/releases. This version uses the newly updated EDAPI plugin to authenticate access to the Companion API. Please read the blurb carefully.

Thanks to gazelle and eyeonus for updating the EDAPI plugin and making the results easily available to TD Helper 2.

It asks me to pick my trade.py, and then errors out when I've done so. EDIT: Clean install seems to've fixed that.

EDIT2: Two things:

Looks like the (Un)Laden LY isn't set anymore? Is it just my imagination that they were ever set?
All the tooltips are broken. They all say 'Tooltip-nnn' where 'n'=[0-9].
 
Last edited:
Back
Top Bottom