0xz00n / EDPriceCheckBot

Discord bot to check mineral prices and alert on high prices for Elite: Dangerous
12 stars 5 forks source link

Repeated false alerts for same station #2

Closed pgschk closed 1 year ago

pgschk commented 4 years ago

Hi,

I run my own copy of your (wonderful) bot, however lately (and I would say since the carrier update) it keeps sending alerts for the same station, but they are always wrong. Station in question is Bluford Gateway, Cerktondhs (https://inara.cz/galaxy-station/6663/).

This is the content from the lowtemperaturediamonds file this morning when the bot reported the station (which is consistent, as the content would trigger an alert):

Cardano Ring,Lu Pao,1720208,1342,M,4 mins West Gateway,Khernidjal,1606506,2410,L,10 mins Brooks Enterprise,Khernidjal,1606506,1008,M,10 mins Greenland City,FT Ceti,1579975,6162,L,3 mins Bluford Gateway,Cerktondhs,1554884,17275,L,43 secs O'Brien Vision,Sirius,1497570,3148,M,10 mins Patterson Enterprise,Sirius,1497570,2010,L,10 mins Efremov Plant,Sirius,1497570,840,M,10 mins Swift Vision,Lu Pao,1429459,1192,L,12 secs Al Saud Gateway,Ladabalbasa,1387222,330,M,10 mins However, the price and and demand are both false for this station as this screenshot shows:

blufordgateway

You can see Inara reports a little bit of price fluctuation, but not enough to have this station report as 1.5m. As of now the station also has not been updated for 24 hours, so the price did not recently change.

I also can't find a price of 1.5m on EDDB or EDSM.

This happens roughly every 1-2 days. Any idea what might cause this?

0xz00n commented 4 years ago

Hey there,

Yes, there is what appears to be a single uploaderID that's responsible for providing this false information to EDDN. I'm still in the process of verifying that it's a single uploaderID that's responsible.

With regard to a fix, I've been holding off pushing what I have currently running on the main bot, but if you want to implement a basic 'block anything from this station', here's the code you need to modify in your local copy:

EDDNListener.py original, lines 52-63

                        for commodity in jsonmsg['message']['commodities']:
                            if commodity['name'].lower() in self.minerals:
                                mineralname = commodity['name']
                                stationname = jsonmsg['message']['stationName']
                                systemname = jsonmsg['message']['systemName']
                                sellprice = commodity['sellPrice']
                                demand = commodity['demand']
                                if sendrequest == 0:
                                    padsize = self.pad_size_check(systemname,stationname)
                                    sendrequest += 1
                                recvtime = datetime.now()
                                self.add_to_dict(mineralname,stationname,systemname,sellprice,demand,padsize,recvtime)

What you need to change it to:

                        for commodity in jsonmsg['message']['commodities']:
                            if commodity['name'].lower() in self.minerals:
                                mineralname = commodity['name']
                                stationname = jsonmsg['message']['stationName']
                                systemname = jsonmsg['message']['systemName']
                                sellprice = commodity['sellPrice']
                                demand = commodity['demand']
                                if sendrequest == 0:
                                    padsize = self.pad_size_check(systemname,stationname)
                                    sendrequest += 1
                                if systemname == 'Cerktondhs':
                                    continue
                                else:
                                    recvtime = datetime.now()
                                    self.add_to_dict(mineralname,stationname,systemname,sellprice,demand,padsize,recvtime)

I'll keep this issue open until I push the real fix.

pgschk commented 4 years ago

Gotcha, so it actually is someone uploading false information to EDDN? I was speculating if it could be a ganker trying to lure some miners... ;)

I patched the listener, but changed it to if systemname in self.ignoresystems and defined a list, to easily add the next system should this become a common occurance :)

Thanks for your quick reply!

0xz00n commented 4 years ago

After some discussion with the folks over in the EDCD Discord, we've discovered that this is actually an issue with someone uploading old data. Probably not malicious, just inconvenient.

In this case, there are two timestamps: 'gatewayTimestamp': '2020-06-17T06:54:08.794695Z' <- This is when EDDN received the data 'timestamp': '2020-05-17T23:43:32Z' <- This is when the data was actually generated

So, once I've got some time, I'll be implementing code to check that the difference of the two timestamps isn't greater than x. x will be determined after some analysis of the EDDN market data as it comes in to generate an average time discrepancy.

I'll update here again once this goes live and close the ticket at that point.

myerk2008 commented 4 years ago

hello love the code but just wondering if you had a fix yet on the listener as i used your patch on other systems but im having to change it to another one every few days thanks myerk

0xz00n commented 4 years ago

Hey, sorry. I've had less than 0 time to work on the bot for a while now. There are a few problems I need to address, including this one. I don't currently have an ETA on this, unfortunately.

myerk2008 commented 4 years ago

thats understandable , thought it wouldnt hurt to ask , i have added somethings that are helpful like i wrote in where to mine the items , and a couple of videos links about how to do certain mining styles. once im fully done i'll send you what i have if you like thanks myerk