Selectable funds by bot for TLP?

I don’t know how easily it can be implementred in bots. But it would be nice to be able to select via one bot
the amount of funds to be available for a trading pair and then to select another amount via another bot
for another pair from the same exchange account!
your opinion boys and girls?

1 Like

So, let’s assume I have a float called “acctblnc” that is the account balance for my account. You basically want the bot to take acctblnc and divide it by some user-defined number and put that up as an order on a tllp bot. But then, you want the bot to register that order as part of acctblnc still and divide it by a different number to put up for a different tllp bot.

1 of the questions I have: if I have an order up on the DOGE/BTC market, is that part of acctblnc? Better yet, how do I convert stuff like btc into nbt to figure out what fraction I have? I use the price feed right? So that means I can’t even count stuff like doge that we don’t have a price feed for. That limits me to using supported fiats, btc, and nbt (i.e. only the stuff we have pools for). Well that’s fine, no big deal, but that leads us to another question. If I have all my funds in btc, does the bot only put up a fraction of them on the btc pool, hoping to put the rest up on some other pool? Or is this just a fraction of the nbt on the account? Should acctblnc just be equal to the total nbt on the account?

If you just want me to give you a user-defined fraction of total nbt on account to put up as an ask order for a given pool, I think I can do that. I haven’t looked at the code yet, so no promises. The trick will be counting nbt that are up as orders on another pair.

thanks for asking.

  1. i assume that i have an account only for TLP purposes, not messing up with manual orders of other pairs.

  2. a specific example:
    i have 100 NBT and i select for the NBT/BTC bot to put 50% of total (account+orders) NBT for that pair
    and the other 50% for the NBT/USD bot to put in this pair :smile:
    then those 2 bots should be alligned not “fighting” each other since they will see as total the account+orders balances :wink:

OK, so to do something like this we want to think about what it is we’re trying to do. We want to change the way the ALP bot trades, right? So we go to github, find the lastest branch on nupool, and go to

First, go down to pybot rather than nubot. Next, we look for the subroutine. Placeorder looks good, but it just calls the preceding subroutine ‘place’, so let’s look there. Scanning the code, we quickly find a ‘response[balance]’ variable. By finding where that response is defined, we see that we can specify a side. If I weren’t worried about not counting nbt already in an order, I’d almost be done.

Anyway, I’ll keep looking at it, I just wanted to let everyone know my general approach.

Discuss.nubits Won’t let me post unless I change it cause its dumb…

The issue becomes more clear if we look at the ‘run’ subroutine and see that the bot first sends a ‘cancel_order’ call to cancel both sides on just the pair the bot is running on. Then, it runs the ‘place_order’ routine. That means we basically need it to calculate the orders you have up on all nbt pairs on the exchange within the ‘place’ subroutine. To do that, I’ll most likely use something like:

order_response = self.conn.get(self.key, trials=1)

Ok, so here’s what I got, presented in the laziest fashion possible:

Completely uncommented for your displeasure, copy and paste that as your file and modify line 181: fillfactor = 5 to be however much you want to put up with that bot. A fillfactor of 5 means that the bot will only put up a maximum of 5 nbt on the sell side.

The use I made of a timer based off when the bot places orders gave me some ideas for patches when the bot misbehaves. I implemented those too, just for fun.

Be careful if that python folder is shared by other ALP bots you intend to run - it will affect all of them!

I started playing with this version of on the fixed rate ALP bot, but when I realized that I’m altering a setting all ALP bots use and checked the other ALP bots, I already had run into trouble :wink:

If this setting is going to be wanted by a lot more people, I need to redesign the “Universal ALP bot collection” layout and provide each bot with an own set of python files…

Good one, I came to the same conclusion looking at it. It is a global parameter. We really need such a thing as a local config parameter for the bot. This would also fix the issue of running three accounts if you want to provide on 3 pairs on CCEDK.
Not sure how hard this is, but a change I would definitely support even at some cost. It would make liquidity provision a lot simpler. It also provide the LP with the flexibility to move between Tier 2 and Tier 1 liquidity without moving funds on the exchange.

There’s no cost, it’s done. I just have to make it look pretty, maybe add a comment or two, and wire it up to the config file. You will be able to specify it as a config parameter for each pool individually. I’m just hoping a few people maybe test it a little bit before we pull it into all the main branches?

If you like you can make pull requests for :wink:
I can test the parameters on some ALP bots :slight_smile:

How’s the best way to make config changes? Implement with a default fillingfactor (50,000 nbt?) and let you figure out if you want to wire it into each directory or not?

I’m not familiar with python. If I were, I’d take your adjusted, make the 50,000 a variable and put it into the pool config of each bot.
At least I hope it can work this way.
If you can give me the direction, I try to move there :wink:

Yah, I need to spruce up that code some. There’s an ‘if’ statement where it does the same thing on either case, for example. I’ll submit a pull in the next day or two (after I learn a bit more how to use github).

1 Like