eyeonus / Trade-Dangerous

Mozilla Public License 2.0
98 stars 31 forks source link

Not pulling the most profitable and fresh prices/trades #82

Closed McRayJason closed 3 years ago

McRayJason commented 3 years ago

Hello. First of all I want to thank you for the work you put in this Tool. It is pretty much what i have been looking for that can support FAR jumps with fleet carriers.

However I am either not understanding it, or there is something wrong.

I wanted to check Direct trades to LP 787-52/Tanner Orbital, what would be the most profitable. Silver to Tanner Orbital

This gave me I should buy Silver in Slatus/Hadifeld Station. The price when I check Inara for buying Silver from there: Silver Hadfield It is 33,961 Cr, with supply of 76k tons. Updated 18 days ago.

But when i check all the Best exports of Silver i see: Silver Arimpox There is 3,494 Cr. it has high supply of 3,517 tons, updated 6 minutes ago

So my question is, why is the tool not showing me that i should go and buy it from Arimpox System, since it would be much more profitable. And it has been updated only few minutes ago, whilst Hadfield was 18 days ago.

(I just in case updated the listings, so it would fetch the most current data)

eyeonus commented 3 years ago

Unfortunately that's not enough information to know.

Try running it with at least '-v' in the future, it might provide enough information to figure it out.

Also, it's helpful to me to put the command in question in the issue report directly, rather than as a screenshot, as that enables me to copy/paste the command to run myself, rather than having to retype it by hand.

I'm looking into it.

eyeonus commented 3 years ago

After some investigating, this looks like Inara's fault:

Trade-Dangerous\test>trade run --to="LP 787-52/Tanner Orbital" --cap=760 --cr=2015504735 --ly=500.00 --empty=500.0 --direct --pad=ML --progress
* Hop   1: ....41,377 origins
Secoya/Ulloa Port -> LP 787-52/Tanner Orbital
  Secoya/Ulloa Port: 760 x Gold,
  LP 787-52/Tanner Orbital +7,549,080cr (9,933/ton)

As you can see, I got a different commodity than you, because the market data has changed. In my case, Inara does not show TD's proposed buy station at all: image image

But if you search the system of TD's proposed station, you see that the station does show then: image

And TD's proposed station ( Ulloa Port | Secoya 30,897 Cr ) is a better price than the best station in Inara's list ( Fullerton Terminal | Corbenic 33,476 Cr ) with 760+ silver that is listed on Inara as shown in the first picture, so TD did indeed find the best trade.

Taking a look at Inara, I see that "Slatus/Hadifeld Station" isn't in the "Best Export" list for gold either, so it was probably the same in your case.

Inara doesn't seem to handle Fleet Carriers very well.

eyeonus commented 3 years ago

I should also mention Inara is showing different prices for commodities than TD is, for reasons I don't know.

TD pulls the live listings market data directly from EDDN, the network used to broadcast market data by programs like the Elite Dangerous Market Connector, and gets the rest from EDDB.io, which also gets its market data directly from EDDN, so I'm confident TD's data is correct.

I thought that Inara also got its market data from EDDN, so I've no idea why it has different prices, but again, this looks like Inara's fault.

McRayJason commented 3 years ago

Ok. I went ahead and just did a real scenario for checking the stuff up. This time i used EDDB.io to find a trade nearby.

image

Ok so Bertrandite only 40ly from the selling point. Went there, and the prices were correct (eddb.io and real prices). Went to sell it to Tanner Orbital, sold it for what eddb.io said.

I used the same filter for eddb.io and TD. But TD found something else, which was less profitable.

Command line: run --to="LP 787-52/Tanner Orbital" --cap=500 --cr=2015504735 --ly=50 --empty=50 --age=1 --direct --planetary=YN --pad=ML -vvv --progress
* Hop   1: .....6,803 origins 

Barathaona/Ejeta Dock -> LP 787-52/Tanner Orbital (score: 4776378.209974)
Start CR: 2,015,504,735
Hops    :          1
Jumps   :          1
Gain CR :  4,888,500
Gain/Hop:  4,888,500
Final CR: 2,020,393,235

  Load from Barathaona/Ejeta Dock (41ls, BMk:Y, Pad:M, Plt:N, Flc:N, Shp:N, Out:N, Ref:Y):
      500 x Metals/Silver   30,530cr vs   40,307cr, 17 hrs vs 17 hrs, total: 15,265,000cr
  Unload at LP 787-52/Tanner Orbital (1.48Kls, BMk:Y, Pad:M, Plt:N, Flc:N, Shp:N, Out:Y, Ref:Y) => Gain 4,888,500cr (9,777cr/ton) => 2,020,393,235cr
  ----------------------------------------------------------------------------
Finish at LP 787-52/Tanner Orbital (1.48Kls, BMk:Y, Pad:M, Plt:N, Flc:N, Shp:N, Out:Y, Ref:Y) gaining 4,888,500cr (9,777cr/ton) => est 2,020,393,235cr total

I am really getting bit confused and don't know what to trust.

eyeonus commented 3 years ago

I'm not going to lie, I don't know. Maybe the market data on eddb.io was updated since the last time you ran an import on TD.

TD tries to account for the time different trade runs take. (Less time spent flying = more time making money) Maybe the --ls-penalty , which makes a stations score lower the further it is from the arrival point, has something to do with it.

Do you look up the station data for Ramon Settlement in TD?

I don't know why, there are too many different variables that could cause the difference. Again, it's impossible for me to investigate your results because the market data changes constantly and when I ran the TD command you did I got a different route.

McRayJason commented 3 years ago

If by station data you mean Market, yes I did. And it saw the Bertrandite selling for 1615. I ran it also on the Tanner Orbital, and got actually nothing for the buy, so that might be why it wasnt picked up by it.

Maybe because the actual station demand was 0, but when it is 0 you can in some cases still sell it in there, which eddb.io is aware off (not case for inara tho).

McRayJason commented 3 years ago

@eyeonus I am sorry to still be on this, but i have done some more testing and i tested like 5 direct trades from specific station to specific station and i never got a single trade with profit higher that 9,999cr/t. Could that be something? I found trades that are worth 24k cr/t on eddb.io, but TD showed only a trade that is below 10k cr/t.

Here is an example:

run --fr="HIP 98621/Herbig Terminal" --to="Turir/Brooks Terminal" --cap=700 --cr=2015504735 --ly=500.00 --empty=500.00 --direct --planetary=YN --pad=ML -vvv --progress
* Hop   1: .........1 origins 

HIP 98621/Herbig Terminal -> Turir/Brooks Terminal (score: 6857527.965940)
Start CR: 2,015,504,735
Hops    :          1
Jumps   :          1
Gain CR :  6,462,400
Gain/Hop:  6,462,400
Final CR: 2,021,967,135

  Load from HIP 98621/Herbig Terminal (745ls, BMk:N, Pad:M, Plt:N, Flc:N, Shp:N, Out:N, Ref:Y):
      700 x Metals/Cobalt    2,747cr vs   11,979cr, 11 hrs vs 1 hr, total:  1,922,900cr
  Unload at Turir/Brooks Terminal (42ls, BMk:N, Pad:L, Plt:N, Flc:N, Shp:Y, Out:Y, Ref:Y) => Gain 6,462,400cr (9,232cr/ton) => 2,021,967,135cr
  ----------------------------------------------------------------------------
Finish at Turir/Brooks Terminal (42ls, BMk:N, Pad:L, Plt:N, Flc:N, Shp:Y, Out:Y, Ref:Y) gaining 6,462,400cr (9,232cr/ton) => est 2,021,967,135cr total

image

As you can see eddb.io showed two extra trades that are worth more than 10k, and the one that is 9,232cr/t TD only shows the one that is 9,232cr/t

And this happened for all the trades i was looking randomly for that were above 10k profit on eddb.io

I also checked TD's market data on both stations. And Herbig shows that it is selling Gold for 40,552 (with supply 65,440) and that the Brooks Terminal is buying gold for 67,036 (with demand of 31,653)

eyeonus commented 3 years ago

I have no idea, I didn't write the route finder code.

Fell free to have a look: https://github.com/eyeonus/Trade-Dangerous/blob/006b58b448ff915af2e33f73a8665de608d22144/tradedangerous/commands/run_cmd.py#L1111

McRayJason commented 3 years ago

I will be not much help with coding, but can it be something with this? https://github.com/eyeonus/Trade-Dangerous/blob/006b58b448ff915af2e33f73a8665de608d22144/tradedangerous/commands/run_cmd.py#L160-L164 i see default set to 10000

tested to actually add something to the mgpt and got the correct results:

trade run --fr="HIP 98621/Herbig Terminal" --to="Turir/Brooks Terminal" --cap=700 --cr=2015504735 --ly=500.00 --empty=500.00 --mgpt=90000 --direct --planetary=YN --pad=ML -vvv --progress
* Hop   1: .........1 origins
HIP 98621/Herbig Terminal -> Turir/Brooks Terminal (score: 19663396.914466)
Start CR: 2,015,504,735
Hops    :          1
Jumps   :          1
Gain CR : 18,530,400
Gain/Hop: 18,530,400
Final CR: 2,034,035,135

  Load from HIP 98621/Herbig Terminal (745ls, BMk:N, Pad:M, Plt:N, Flc:N, Shp:N, Out:N, Ref:Y):
      700 x Metals/Gold   40,552cr vs   67,024cr, 13 hrs vs 2 hrs, total: 28,386,400cr
  Unload at Turir/Brooks Terminal (42ls, BMk:N, Pad:L, Plt:N, Flc:N, Shp:Y, Out:Y, Ref:Y) => Gain 18,530,400cr (26,472cr/ton) => 2,034,035,135cr
  ----------------------------------------------------------------------------
Finish at Turir/Brooks Terminal (42ls, BMk:N, Pad:L, Plt:N, Flc:N, Shp:Y, Out:Y, Ref:Y) gaining 18,530,400cr (26,472cr/ton) => est 2,034,035,135cr total

So looks like default is set to too low

eyeonus commented 3 years ago

Well, to be honest, that default was set long before Fleet Carriers were a twinkle in some dev's eyes. No idea why there is a max, but I imagine it has to do with lessening how long it takes to calculate potential routes.

Since most players can't afford Fleet Carriers and not many of those who can use them to conduct trading (as opposed to letting ships dock and trade with them), it makes sense to leave it as default, and you'll just have to remember to override the default when doing your FC-based trade runs.

Good job figuring it out, that is obviously the culprit.

McRayJason commented 3 years ago

Well its not only for FC trading. In general, 10k profit is too low. Even if you are doing like 20ly trade jump with your T10. I guess its because before, this high GPT was not really a thing, because commodities were much cheaper and the profit was never that high.

eyeonus commented 3 years ago

Right, yes, we're talking profit per ton, not profit as a whole, My mistake.

Okay, I found where it's used in the code: (L819, L826) https://github.com/eyeonus/Trade-Dangerous/blob/006b58b448ff915af2e33f73a8665de608d22144/tradedangerous/tradecalc.py#L803-L833

So it looks like this exists just to give the end-user the ability to specify the allowable profit margin range. As in, "I don't care about any trade that doesn't make at least 300/ton" = --min-gpt 300.

I assume when the default was originally set to 10,000cr/ton it was thought by the author to be higher than any trade was likely to be, but rather than make the same mistake by guessing some higher "sensible" number, I'll just turn it off by setting the default to '0':

trade run --fr="HIP 98621/Herbig Terminal" --mgpt=0 --to="Turir/Brooks Terminal" --cap=700 --cr=2015504735 --ly=500.00 --empty=500.00 --direct --planetary=YN --pad=ML -vvv --progress
* Hop   1: .........1 origins
HIP 98621/Herbig Terminal -> Turir/Brooks Terminal (score: 19610658.127033)
Start CR: 2,015,504,735
Hops    :          1
Jumps   :          1
Gain CR : 18,480,700
Gain/Hop: 18,480,700
Final CR: 2,033,985,435

  Load from HIP 98621/Herbig Terminal (745ls, BMk:N, Pad:M, Plt:N, Flc:N, Shp:N, Out:N, Ref:Y):
      700 x Metals/Gold   40,552cr vs   66,953cr, 14 hrs vs <1 hr, total: 28,386,400cr
  Unload at Turir/Brooks Terminal (42ls, BMk:N, Pad:L, Plt:N, Flc:N, Shp:Y, Out:Y, Ref:Y) => Gain 18,480,700cr (26,401cr/ton) => 2,033,985,435cr
  ----------------------------------------------------------------------------
Finish at Turir/Brooks Terminal (42ls, BMk:N, Pad:L, Plt:N, Flc:N, Shp:Y, Out:Y, Ref:Y) gaining 18,480,700cr (26,401cr/ton) => est 2,033,985,435cr total

Already pushed, should be able to update TD soon.