You are viewing a single comment's thread from:

RE: Liquidity balancer (My little Python project)

in #hive • 4 months ago

This is beyond impressive 😅 no surprise you had to work on it for quite some time...

I wouldn’t call myself a programmer just yet

It always makes me a bit sad reading that something like that is still not enough to be called a programer... it looks so amazing, difficult to realize and almost unreachable for me, so it makes me question if I will ever become decent at coding 😅 I guess not !LOL (a sad lol!)

Sort:  

Why did the art thief's vehicle run out of fuel?
He had no Monet to buy Degas to make the Van Gogh

Credit: reddit
$LOLZ on behalf of arc7icwolf

(2/10)
Delegate Hive Tokens to Farm $LOLZ and earn 110% Rewards. Learn more.@gamer00, I sent you an

 4 months ago (edited) 

Hey, @Arc7icWolf, thanks a ton! 😊

I totally get what you’re saying — I’ve been there too, doubting if I could ever call myself a programmer. (Edit: Still find myself there occasionally...) But trust me, all of this was just small steps and learning through mistakes. What you’re seeing now is the result of lots of trial and error (and a few headaches along the way).

The truth is, I still feel like I’m learning every day, and I bet every programmer out there feels the same. We all start from the same place — not knowing anything — but I guess the key is to keep at it. I’ve seen the ideas you’ve been working on, and I know you’re well on your way.

The fact that you’re passionate about learning means you’re already on the right track. Keep pushing, and one day you’ll look back at this and realize just how far you’ve come! Also, that I wasn't after all that far ahead... In some respects, I am looking at you from behind.

!PIZZA !WINE

I'll keep doing my best to learn new stuff :) and hopefully one day I'll be able to code a bit more properly 😅

In some respects, I am looking at you from behind

Only if we talk about errors or questions asked to ChatGPT, otherwise I'm the only one looking from behind !LOL

Now something I'd like to start understanding a bit more are databases and how to create, manage and access them.

I know, for example, that in your script you save in a cache some info about the fetched tokens (so you don't have to fetch them again each time you run the script), and I was asking myself: can be this considered as some sort of database? And if you would like to create a more complex one, you could use something like Pandas, right? And if wont to get even more complex, this is where you should consider using SQL?

Am I getting the steps right or I'm mixing different things together? 😅

!PIZZA

How many jazz musicians does it take to replace a lightbulb?
A-one, a-two, a one-two-three-four!

Credit: reddit
$LOLZ on behalf of arc7icwolf

(1/10)
Delegate Hive Tokens to Farm $LOLZ and earn 110% Rewards. Learn more.@gamer00, I sent you an

Glad you asked! I’ve worked with SQL, so I’ve got some knowledge to share.

On a computer, pretty much everything is some form of a database. It can be as simple as a list object in Python, a static file on a disk (like we do with the token cache), or even a blockchain! Each of these stores data in different ways. SQL databases are more structured and designed for serving large collections of data to clients — for example, websites or accounting software. They’re like a more formal system for managing and retrieving data efficiently.

You mentioned Pandas — but since I don't personally know much of them, I had to ask ChatGPT in my own turn... and yes, Pandas seems to be a great tool for handling data in Python, especially when working with data frames (like big tables of data in memory). But it’s not quite a database in the traditional sense. It's is more of a tool for manipulating and analyzing data once it’s already loaded into your program. If you wanted to persist that data across sessions or handle really large datasets, then you’d want to consider something like SQL.

SQL databases can handle large, complex queries efficiently, and allow you to store, retrieve, update, and delete data as needed. Pandas can help you work with data in your code, but it doesn't have the persistence of a proper database unless you save it to a file.

So you’ve got the right idea! Pandas can be cool for working with data in your code, but if you need something more powerful or persistent, SQL is the next step.

!WINE

No idea how I missed your reply, sorry 😅

Luckily I came back to read again your script and, while scrolling through the comments, I noticed one I hadn't seen before!

Thanks for the answer :)

So, databases are a bit too much for me, that's for sure, but if I ever need to manage data in a persistent way, they are the right tool. Gotcha!

!PIZZA !LOL !HUG

Did you hear about the cat who ate a ball of yarn?
She had mittens.

Credit: marshmellowman
$LOLZ on behalf of arc7icwolf

(2/10)
Delegate Hive Tokens to Farm $LOLZ and earn 110% Rewards. Learn more.@gamer00, I sent you an

I wonder if I should rename the script to "Liquidity Reverse Balancer" instead, now that I think of it. Since it doesn't really "balance" anything, quite contrary. And my 'explanation' was bit silly too. The script is basically a "stock" enhancer, as its main purpose is to target price reversals by advance stocking the other side of the pair in anticipation of one. It took me quite a while to fully understand what I had created.

Oh well, when we talk about trading I'm even more clueless than with coding 😅

There is a difference though. Trading comes with fees (and risk), but manipulating liquidity pools doesn't have any, if you deal with small margins and a large enough reserve to handle the changes.

I may try it with a small pool where I already have some liquidity in.

Putting it to the test will also help me better understand how it works.

!PIZZA

Good luck! :) Be sure to have some reserve in your wallet. The script tends to die sometimes if tokens run out when adding liquidity. (I used to have an error handler for it, but I forgot to add it back when I rewrote the thing for the n'th time.)