LiqBot 0.1 (alpha) | The open-source liquidity bot!

in bitshares •  9 years ago  (edited)

We are proud to announce the first alpha release of LiqBot. It is currently developed by @mauritso with the support of @linouxis9. It was originally requested by Bitshares Munich to provide liquidity on low liquidity markets which are gonna be used by their new POS systems..

LiqBot 0.1 (alpha) | Long Setup

We are proud to announce the first alpha release of LiqBot. It is currently developed by @mauritso with the support of @linouxis9.
It was originally requested by Bitshares Munich to provide liquidity on low liquidity markets which are gonna be used by their new POS systems. Therefore, LiqBot is currently run by @mauritso and @linouxis9 to provide liquidity to the BitEUR and BitSILVER market as well as the BitCAD market on the behalf of Bitshares Munich.
We will discuss in this post on how to run LiqBot. We will in another post discuss on how it is working as well as how it can help you to bring liquidity to the DEX markets.

What does it does ?

On its first run, LiqBot will register an account using the OpenLedger Faucet and then ask you to send it BTS and the assets you want it to trade. The bot will now ask you to reboot it and with the default mode, it will lends BitAssets and then begin the specified strategy. One of the advantage of the bot is that it take care of the collateral ratio of lended BitAssets for you.

How to set up it?

Requirements

  • Linux >3.10 (You can check with uname -r on a terminal emulator)
  • Docker
  • docker-compose
  • git

Initial Setup

  • git clone https://github.com/linouxis9/bitshares2-liquiditybots.git

You will now have to tweak the bot configuration available at bitshares2-liquiditybots/docker-exchangebot/exchangebot/config.py

You have to:

  • change the wallet_password, that's the password which will be used by the cli_wallet.
  • change the account name, for example "liquidity-bot-linouxisbot"
  • change watch_markets to the markets you want your bot to watch and therefore trade.

We will now help you to configure one of two mode of the bot and how to run it.

Short'n Forget (for SmartCoin)

This is the default mode used by the bot. The bot will borrow the Smartcoin from the network and it will automatically take care of the collateral ratio.

How to setup this mode

  • The markets variable in the bots["LiquidityWall"] array should be in most of the cases the same content of watch_markets.
  • The borrow variable in the bots["LiquidityWall"] array needs to be set to true.
  • You need to modify the borrow_percentage in the bots["LiquidityWall"] array to divide the BTS holding of the bots between borrowing and asking. If you choose 12 for silver, 12 % of the BTS will be used to short silver and therefore 88% of the bot BTS' will be used to maintain the collateral ratio and put liquidity on the ask side according to the spread percentage.
  • You need to set the strategy you want for your bot by modifying spread_percentage and allowed_spread_percentage
  • The markets variable in the bots["Collateral"] array should have the markets pairs of borrowed asset.

Send'n Forget (for SmartCoin and UIA)

This mode doesn't borrow the asset from the network. You should use it only if you want to borrow the smartcoin on another account and then send the asset to the bot or if you want to use an UIA on the bot.

How to setup this mode

  • The markets variable in the bots["LiquidityWall"] array should be in most of the cases the same content of watch_markets.
  • The borrow variable in the bots["LiquidityWall"] array needs to be set to false.
  • You need to set the strategy you want for your bot by modifying spread_percentage and allowed_spread_percentage
  • You need to remove bots["Collateral"] = { and the seven lines behind it.

Now, Run it !

  • Go in the root of LiqBot
  • docker-compose up PLEASE CAREFULLY WRITE THE BRAIN KEY, IT IS NEEDED IF YOU HAVE TO RECOVER THE WALLET OF THE BOT
  • CTRL+C to terminate the bot
  • You now can use your favorite Bitshares Wallet to send BTS and the assets needed by the bot.
  • You can now start the bot by using docker-compose up if you want the bot to run on the foreground or docker-compose start if you want the bot to run on the background, you will be able to check the log by using docker-compose logs

Now, Enjoy !

Special Thanks

We would like to thanks for their precious advices and testing:

The LiqBot Team

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

If this works it will will sure help adoption of the POS system. Merchants will need lots of liquidity in markets so they can withdraw to fiat to pay there bills when necessary.

Looks like Steem is helping to fund BitShares development based on how these posts are getting voted on.

You've got it Pontiac! (please pardon the very outdated reference).

There is a possibility. It would be to use multisig. Each BOINC "miner" (I don't know the name so I will use miner even though it's not that) would have a key in the multisig of an account holding the money. Each x minute, a BOINC "miner" would propose a tx to change the orders of the bot in a market pair according to the strategy and each BOINC "miner" would have to see if you need to change the orders like the other BOINC "miner" proposed it (by computing the strategy) and if the change seems correct, each BOINC "miner" would approve/sign this proposal then if this proposal has enough votes for the defined threshold the transaction would be sent and the orders will be changed.

But this is very inefficient and expensive (Like Ethereum where each computations are run on each node).

  ·  8 years ago (edited)

Ah OK, so you're proposing a P2P network between volunteers? I was initially thinking more along the lines of a distributed (rather than decentralized) liquidity bot system where each volunteer node dialed home (to the BOINC project) for instructions and perhaps used a multisig system to prevent unauthorized transmission of liquidity funds.

I like your idea! Whilst it may be 'inefficient and expensive', we're not running this on top of a blockchain - BOINC allows you to distribute software that can utilize the full resources of the volunteer's computer & network at no cost to the BOINC project (aside from web server costs).

Whilst a significant quantity of users may run BOINC on low performance hardware, there is a significant quantity of users with serious computing power at their disposal (individuals with hundreds to thousands of CPU cores).

Theoretically, you could be as inefficient and expensive as you want/need since it isn't running as a smart contract on a blockchain (unless you created a blockchain specifically for the BOINC project, which would be seriously cool).

"I was initially thinking more along the lines of a distributed liquidity bot system where each volunteer node dialed home (to the BOINC project) for instructions" // That's actually the opposit of my idea.
"BOINC allows you to distribute software that can utilize the full resources of the volunteer's computer & network at no cost to the BOINC project" // Exactly, you will be able to distribute the strategy to the volunteers so they would be able to see if the proposed tx is correct and they sign/approve it if that looks correct (In an automated way, of course).

It's not a P2P network between volunteers nor a smart contract on top of the blockchain, it's just a matters of saying (signing) to the blockchain that the proposed tx is correct and should be proceeded (if it reaches the threshold of approving volunteers before the expiration of the proposal).

"Whilst a significant quantity of users may run BOINC on low performance hardware" // You don't need something powerful for that at all! It's just that you need to find something that prevent a guy to do a 51% attack (by creating 51% more accounts and use it approve a tx which the money to their account) and for that you do random computations to differentiate the volunteers by their computation power (their voting weight would be their computation power).

That said, wouldn't the liquidity bot need to dial home to the BOINC project for the 'strategy' Yes it could be (if for example you want to give the ability to customers to provide their custom strategy for their assets) or it could be bundled with the software.

When you say 'strategy' do you mean these different modes? Or new liquidity strategies? For me a strategy is the algorithm defining what the bot should do. Both modes you mentionned are in fact the liquidity_wall strategy which has now been merged in StakeMachine but I guess there are better and safer strategies for your needs.

Ok, you mean to distribute software that performs a large collaborative multisig verification to approve a single liquidity bot instance's transactions?Exactly.

You could potentially issue an UIA to your BOINC volunteers and use that to decide voting weight? Perhaps users could buy into that to have more stake weight?That's actually a good idea which is how Bitshares has ever wanted to do things. You could issue the token over the time to (so if they stop participating for some times, they would have less weight).

Their voting weight would be with their computation power? Like the computing power they contribute towards other BOINC projects, or do you mean implementing some form of Proof Of Work?I meant implementing some form of POW but your idea with the UIA is better.

Loading...

You have to:
change the wallet_password, that’s the password which will be used by the cli_wallet.
change the account name, for example “liquidity-bot-linouxisbot”
change watch_markets to the markets you want your bot to watch and therefore trade.

The wallet_password and account should be new / non-existing ones, should they? And can the wallet_user be left empty?

I tried to set up a bot but gotexchange-bot_1 | Account creation failed and exchange-bot_1 | https://bitshares.openledger.info/ response: {"status":"500","error":"Internal Server Error"}

Yes wallet_user needs to be empty but account and wallet_password need to be non-existing ones. BTW, You can't use a premium name.

It seems the problem is coming from the OL faucet. I've sent them a message and they are investigating.

EDIT: The problem seems to be fixed, please retry :-)

It works!

Did you have a testing? If so, what was the ROI?

Copy pasted from the bitsharestalk.org post:

The bot costs less than 3 bts a day to run.
Currently I have no real data about bot performance, because there isn’t much happening on the markets.

The most active market at the moment seems to be the OPEN.BTC : OPEN.DGD market. I could setup a bot on that market to gather some data.

As OPEN.BTC and OPEN.DGD are not smartcoins and the bot currently depends on the feed price, I can't set up a bot like that at the moment. I"ll try to figure out a way to generate a reliable price, but as you can see here: https://coinmarketcap.com/assets/digixdao/#markets it greatly depends on the market etc. The biggest market with a feed price looks to be the CNY : BTS market at the moment, so I could try that.

Good question. If it manages to make any profit, it would be awesome for the liquidity...

For "dead" markets you won't make a profit. But if you have users for a market that has no (or not enough) liquidity then you can make money.

I've had two bots both on EUR and GOLD for about 2 days with different spreads. Both are currently at a combined loss of 4% in BTS. One bot has a 3% spread / 90% uptime and the other has 3.2%/100%. The one with the bigger spread makes a bigger loss. This is just 2 days and it's a bear market for BTS. Long on BTS in a bear market doesn't seem to generate lots of profit.

The loss in BTS has to do with the price movement and not with the bot, right?

I just looked at the bitshares home-interface TOTAL VALUE column. I gave the bots 70k and 60k, and the total value shows me 66,788 BTS and 58,282 BTS. I don't know how debt positions etc are calculated into the value, but if it's relevant, then I am at a small loss.

I downvoted this post accidentally -.-

The total value can go up and down depending on price swings of the assets your bot account has. The loss probably stems from that.

I see no trades on http://cryptofresh.com/u/liquidity-bot-msp2
and 3 trades on http://cryptofresh.com/u/liquidity-bot-msp (probably when the bot went down, the price moved and the bot wasn't online to adjust the price of the orders)

That is basically the problem, not enough is happening on these markets to assess bot performance at the moment. I will run a test on the CNY:BTS market soon, but I have my doubts about that market having enough volume.

No problem, I got over it...

GOLD and EUR have gone up in BTS, so I should have made some profit. I guess you're right that the reason is price swings while being offline.

I hope to help the "nothing happening in the markets" problem by providing the little liquidity I can. So thanks for the bot.

I have no experience, so I'm wondering if it's sensible to have 2.50 collateral ratio for a bot?

2.50 is a good compromise in case of a sudden market change IMO. Moreover, LiqBot will increase the collaterals if the ratio goes down. LiqBot checks the collateral ratio each two blocks.

Can I set target price to feed*1.015? The price on the DEX tends to be 1-2% above the feed price, so I have a feeling that the target price as such isn't optimum. What happens is that the bot creates and sells bitAssets a little above feed price, and then tries to buy back way below feed price. That doesn't do much to help liquidity.

https://github.com/xeroc/python-graphenelib/blob/master/scripts/exchangebots/config-example.py

  • target_price_offset_percentage: +-percentage offset from target_price

This config option is available for that (hidden in the config.py that came with liqbot, will add that)

You could call it liquor

Are you intending to continue working on the bot?

Of course! It is just the alpha release that we released in order to get feedback for the official 1.0 Release.

Ok, that's great!

What kind of feedback do you want? I guess you have enough ideas. Do you problems and bugs reported on github?

Any feedback is appreciated but feedbacks about user friendlines, features improval, the bot strategy or even about this article are even more appreciated.

Yes all issues, bugs and problems should be reported on the GitHub repository, You are free to send Pull Request too ;-)

Anyway, feel free to come on Telegram to talk with us :-) and thank you for your testings.

Can I run several bots simultaneously on one machine? I would like to test different parameters like bots on the same market with different spreads.

Yes you can, you just have to have one folder per bot ^^

Sorry, but which folder? Thanks for your patience!

The folder of the repository (It should be bitshares2-liquiditybots).

I couldnt make it work. I cloned the git repo into a different folder and tried to run docker there. It always shut down the other instance in another folder. I tried with screen and without it.

Could you give some simple instructions?

Change the folder name, if the folder has the same name it won't work because the created containers get a name based on the folder docker-compose.yml is in.

Thanks, that solved it for me.

It is working for me if I run the bots with docker-compose up in two screen where each screen is in one folder.

You may also try docker-compose start in each folder.

My LiqBot is handling/borrowing collateral, yet failing to write any orders. Any clues?

Exact :-)
@Methodise You now need to run the new LiqBot strategy with StakeMachine.

Install StakeMachine and change the config to use liquidity_wall (The LiqBot strategy) and maintain_collateral_ratio (The LiqBot strategy which take care of borrowing and maintaining the collateral ratio).

@linouxis9 Neither liquidity_wall nor maintain_collateral_ratio seem to be available in the most recent stakemachine version. I'd love to see a sample config.yaml that actually works (I've been having problems with walls.py)

Here is an Archive of Cryptocurrency App building Code on Github for anyone creating a Steemit app
https://steemit.com/steem/@marsresident/github-cryptocurrency-app-creation-archive