chief-gant / SplinterlandsTraderBot

A trading bot written in Python that makes a profit by buying underpriced cards and quickly reselling them.
18 stars 0 forks source link

Why now Splinterlands? Lol #7

Closed Macpayne closed 2 years ago

Macpayne commented 2 years ago

My current thoughts and questions on the endpoint issue.

  1. I've spend a lot of time these last few days on Splinterlands Discord ( https://discord.gg/dGP5MFf7 ) in the developers-3rd-party channel, I'm curious if any of my time there can help. The first is this https://docs.splinterlands.com/platform/upcoming-changes which makes me think they want us to now use the for_sale_grouped and for_rent_grouped endpoints. I saw where you said they dont pull listings, and I think I recall discord conversations like theres another step or steps with card ids being transaction ids now? I admit I have 0 coding experience so the conversations about the market/for_sale_grouped change I followed, could be for another entire issue.

  2. A dev there named kbux posted on the 20th " Please hit me up here (in developers-3rd-party channel) if you have any concerns and we can walk you through the preferred endpoints that are grouped and way faster. They seem very knowledgable and walked a few people though other issues so maybe give them an @ in the developers-3rd-party channel on Splinterlands discord if you would like, of course if you haven't already as you do seem on top of things and I mean no insult in seeking their knowledge.

  3. I also saw a post where someone mentioned their steps for python as "can you suggest a better method than going here https://api.splinterlands.io/market/for_sale_grouped finding a certain card based on ID, checking its price against a threshold then going here 'https://api.splinterlands.io/market/for_sale_by_card?card_detail_id=' + str(C_ID) + '&gold=' + str(GOLD).lower() + 'false&edition=' + str(EDITION)' pulling the market id and price then using beam to broadcast_tx? Can I optimize this better in terms of speed, now that https://api.splinterlands.io/market/for_sale has been deprecated? Any advice is supper appreciated!"

    Another poster told them seems the correct way, yet we have days prior where devs had a conversation about, "Please use https://api2.splinterlands.com/ , not https://api.splinterlands.io/, you’ll get more consistent performance." "when in doubt, try to use https://api2.splinterlands.com/ for all your needs." From game-api to even cache-api sounds like they have redirects to api2, but even those will be eventually removed and deleted for the long term single use of https://api2.splinterlands.com/ for it all? So the posters question on speed and optimizing, if that's the correct way to call all they are trying to do, would not updating to the https://api2.splinterlands.com/ give it a boost that they asked for?

So my thought on #3 is a previous API issue here, there was talk of redundancies if one API is down, yet if others give "less consistent performance" should we not remove/update api.splinterlands.io, and the other legacy ones and use only https://api2.splinterlands.com/ and just have the patience that if its down, etc., they will bring it back soon as possible? I'm also curious if having all those redundancies is why a full market scan is now 500 seconds as its polling from each or if it only polls from one and the rest don't come into play until one fails and we are back to the whole issue with for_sale_grouped endpoint? Or could this thing alone at least make market scans tolerable again to see "no good offers." Lol

All in all, this is a good bot that allows me to flip cards that I barely have time to try and do on my own, I made some good holiday gifting money from a small investment and even though I get Splinterlands wants to improve/fix their 3-4 yr old code now lol, I would love to see what a few months with this bot can do once this endpoint issue is fixed. Thank you for being a great caretaker of this project.

chief-gant commented 2 years ago

I took all of that into consideration, and I am working on a huge refactor. I will try to get it up these next few days, and I will count on you to try it and let me know!

chief-gant commented 2 years ago

Version 2.0 is live! The bot is now longer using the Splinterlands API to check for all the listings, but rather scouts the Blockhain looking for new postings. And whenever a new card is posted, it checks whether it's a good offer or not.

Please execute git pull and let me know how it goes!

knightblaster commented 2 years ago

Getting this error:

Checking latest blocks...

Updating our posts Traceback (most recent call last): File "splinterlands_trader_bot.py", line 745, in File "splinterlands_trader_bot.py", line 734, in run File "splinterlands_trader_bot.py", line 583, in update_posts TypeError: '<' not supported between instances of 'str' and 'float'

knightblaster commented 2 years ago

Also, I think you need to add ipdb to requirements.txt I had to install that module manually.,

chief-gant commented 2 years ago

I'll fix both things asap

chief-gant commented 2 years ago

I just pushed the necessary fix. Let me know how it goes from here.

knightblaster commented 2 years ago

Excellent! Seems to have fixed the error messages I was seeing, thanks! :)

chief-gant commented 2 years ago

Since it appears to be working (as far as I can see from my end) I will close this issue. If I missed something, feel free to open a new one!

Macpayne commented 2 years ago

Well done going with the blockchain route I laughed so hard when my first three cards bought were from what seemed like a bot mass listing that I scooped up almost right the second after they were listed, and at the same time. Don't think I recall being able to buy more than 1 card at a time before so nice touch when it happens.

There's been a few issues mostly API related that you've always fixed relatively fast, and even this one where we had no clue if it would ever get better beyond a single group scan or a 9 min full scan, (Thanks Splinterlands for depreciating that endpoint, lol.) and yet were back in business flipping cards within days. Great job maintaining this bot and def worth your cut keeping it running.