EDCD / EDMarketConnector

Downloads commodity market and other station data from the game Elite: Dangerous for use with all popular online and offline trading tools.
GNU General Public License v2.0
988 stars 155 forks source link

Fleet carrier value excluded from assets (at least on INARA) #1401

Closed TheRealTurtler closed 2 years ago

TheRealTurtler commented 2 years ago

Ever since FDev changed the assets to also include fleet carrier values my INARA credit history jumps up and down and I always have to manually delete the "verified" values, which just feels wrong. EDMC submits the asset value without the FC price and Frontier Data Import "corrects" it by around 5B credits (see screenshot).

Screenshot 2022-01-13 165018

The journal files contain the "correct" amount (meaning the same value as the Frontier Import returns): "Current_Wealth":8570515339

EDDLite shows the same behaviour, so please let me know if I'm in the wrong here.

Athanasius commented 2 years ago
  1. EDMC code does not send a commanderAssets value when it sends a setCommanderCredits Inara API call. We only ever set the commanderCredits and commanderLoan key/values in these calls.
  2. When we send a setCommanderGameStatistics Inara API call we use only the data straight from a Journal Statistics event. We're basically dumping that event into the Inara API call, minus the timestamp and event keys:values from the Journal file line.

So, whatever Inara is showing as 'total assets' would seem to be based on:

When no assets value provided, assets value is calculated (based on Inara data).

Athanasius commented 2 years ago

I've double-checked this with my own account:

  1. In-game I see 7,290,414,428 CR on Internal > Codex > Commander > Stats for "Current Assets".
  2. My Journal "Statistics" event includes ... "Bank_Account":{ "Current_Wealth":7290414248, ...
  3. When I enable EDMC's verbose Inara plugin logging I see ..., {"eventName": "setCommanderGameStatistics", "eventTimestamp": "2022-01-20T15:40:18Z", "eventData": {"Bank_Account": {"Current_Wealth": 7290414248, ... in literally what it sends to Inara.
  4. I do indeed see my Inara total assets bounce up to this 7.2B figure, only to come back down to my in-wallet value afterwards, presumably due to having linked my Frontier game account to Inara.
Athanasius commented 2 years ago

Thus I can only conclude this is a problem at the Inara end. We're following the current Inara API documentation and are definitely sending the right data in order for Inara to utilise the correct statistics value.

Athanasius commented 2 years ago

Actually, now that I buy/sell some commodity to get a different value, my Inara 'Assets' value is not including the FC value at all. It's literally just my setCommanderCredits->commanderCredits value. No bouncing around.

In lieu of a commanderAssets value being sent I think Inara should be utilising the Statistics -> Bank_Account -> Current_Wealth value.

Athanasius commented 2 years ago

I've attempted to alert @clonedArtie to this on the Inara discord and via this Inara discussion comment

Athanasius commented 2 years ago

I'm left wondering where the 'Verified' figure comes from. Checking CAPI /profile output for my account the 'Current Assets' value isn't in it anywhere, only my current in-wallet credits count. CAPI /fleetcarrier does contain some information about core and 'services' (additional modules) cost to buy. Is Inara utilising that ?

Doing a fresh 'Import Frontier Data' on Inara hasn't changed my balance at all... yet....

Athanasius commented 2 years ago

OK, so I guess the issue is

  1. Inara never shows the full, including Fleet Carrier, total assets value
  2. If you manually enter the figure from in the game, then
  3. If you have 'Import Frontier Data' active on Inara it will use its best guess from the CAPI data to apply a 'Verified' correct figure, not including the Fleet Carrier assets.

Even if we change EDMC to send commanderAssets on login to the game (the only time the accurate figure is available from the Statistics event) I'm sure that if you have 'Import Frontier Data' on Inara active it will 'correct' things back to a value not including the FC assets.

TheRealTurtler commented 2 years ago

Thank you for looking into this issue.

You seem to be mistaken on point 3. The only time my Fleet Carrier value is included in the assets is whenever INARA fetches data via Frontier Import (as you can see in my original post).

Athanasius commented 2 years ago

You seem to be mistaken on point 3. The only time my Fleet Carrier value is included in the assets is whenever INARA fetches data via Frontier Import (as you can see in my original post).

The problem is that I can't reproduce that. As per all of the above, my total assets with FC included are around 7.2 billion. Having regranted Inara CAPI access it has not (yet) done a 'Verified' to either bring the displayed total up to the FC-included number, or otherwise change the current value.

TheRealTurtler commented 2 years ago

Weird...

I'll check later if the same behaviour still occurs.

Athanasius commented 2 years ago

Aha! Inara finally decided to take note of my with-FC total. Possibly CAPI journals didn't have the relevant records yet, or Inara has some built-in delay, or possibly "minimal delta".

OK, so verified that the Inara "Import Frontier Data" will at least eventually cite an FC-included assets total.

I'll see if we can sanely send commanderAssets in the setCommanderCredits message without causing further issues.

Athanasius commented 2 years ago

Yeah, there's definitely some delay at play. The value it's now updated to is what it was before my most recent "buy some crap commodities and resell at station" that I've been using to cause my balance to change. This makes it fun trying to determine if Inara is citing the Statistics->Bank_Account->Current_Wealth number, or some other that it's worked out itself.

Athanasius commented 2 years ago

OK, it is that Current_Wealth value, now to play with our code to see if we can safely send the matching value.

AJH16 commented 2 years ago

Looks like you may have figured this out, but I'll add that I see the same behavior. There is a delay on pulling verified data from Frontier on Inara, but EDMC has been causing my values to bounce back and forth and the EDMC data is always lower than the verified data, though I'm pretty sure that the verified data does not include the contents of my Fleet carrier as I have quite a large quantity of tritium that doesn't seem to be counted, which I'm not aware of any way to get that out of CAPI either.)

Athanasius commented 2 years ago

Looks like you may have figured this out, but I'll add that I see the same behavior. There is a delay on pulling verified data from Frontier on Inara, but EDMC has been causing my values to bounce back and forth and the EDMC data is always lower than the verified data, though I'm pretty sure that the verified data does not include the contents of my Fleet carrier as I have quite a large quantity of tritium that doesn't seem to be counted, which I'm not aware of any way to get that out of CAPI either.)

That is not something we (or probably Inara) will be able to sanely address. We're only using the Statistics, Bank Account, Current Wealth figure. Taking any cargo, and/or sell orders for it, into account is speculating on what the actual value will be at some undefined point in the future should you have actually sold it.

If it was me, at best I'd list a separate "potential additional assets" figure.

Athanasius commented 2 years ago

For now I'm going to assume our pending changes do fix this to the limit of what we can do given the timely data available.

When there's another (post 5.3.0-beta2) 5.3.0 beta, or its full release, feel free to give further feedback, but for now I'm closing this to note it as done with respect to out 5.3.0 milestone.

Athanasius commented 2 years ago

Please test https://github.com/EDCD/EDMarketConnector/releases/tag/Release%2F5.3.0-beta10 ( not 5.3.0-beta7 now).

Athanasius commented 2 years ago

My Inara definitely picked up the correct "in wallet" and "total assets" values when testing yesterday, so I'm going to assume we do have this fixed correctly for 5.3.0, so I'm closing this issue.

@TheRealTurtler please test https://github.com/EDCD/EDMarketConnector/releases/tag/Release%2F5.3.0-beta10 (or later if available on the general Releases page ) and reply here if it's still not working correctly for you. Remember that it can take up to 35 seconds for Inara API messages to get sent.

TheRealTurtler commented 2 years ago

Sorry for the delay. Yes, it shows the correct total assets value now, thanks!

Athanasius commented 2 years ago

Nope, this isn't fixed yet. We blindly use the CAPI->/profile->commander->credits value, which in my case was last 519_697_658, i.e. only what is in my personal/ship wallet. There is no figure for 'total assets' in the CAPI data. It might be possible to try to synthesize it from the /profile ships list, cargo contents, and the /fleetcarrier details, BUT, that sounds like far too much hassle, and will almost certainly not come to the same conclusion as the Journal value.

We are absolutely sending the correct value on login to the game, using Journal->Statistics->Bank_Account->Current_Wealth.

So, I'm almost certainly going to entirely rip out the Inara credits update from CAPI data. See #1294 which will align us with Inara:API:Docs:setCommanderCredits.

Athanasius commented 2 years ago

With #1456 merged this does look to be working correctly now. The downside is that you will have to game-relog in order to get an update, i.e. you'd want to bounce out and back in at the end of a session to record changes then rather than at the start of the next session.

Without a huge amount of faff, that will probably fail to be accurate, there's no way to guarantee this otherwise.

Athanasius commented 2 years ago

That latest change is in https://github.com/EDCD/EDMarketConnector/releases/tag/Release%2F5.3.0-beta11 for wider testing.