Cheery22487 / hive_arbitrage

This is a small arbitrage bot working on the hive blockchain.
1 stars 0 forks source link

Amazing proof of concept #1

Open options2015 opened 2 weeks ago

options2015 commented 2 weeks ago

Hi,

Thanks a lot for this wonderful poc code. Was wondering if it was possible to trade a different amount other than 10 defined in the script. Is it possible to have a variable, lets say tradeamount=50 or even better 10% of your SWAP.HIVE balance?

Many thanks!

Cheery22487 commented 2 weeks ago

Hello,

thank you for your kind comment and for looking into the code in that much detail. It is definitely possible to include this option. I will update the code to include this option soon (hopefully tomorrow).

From a practical standpoint id be careful with trading with a significantly larger amount of Hive. Yes, the bot is able to decide to trade with less Hive on its own if the liquidity in the market doesnt support a larger Hive amount. But you are exposing yourself to more risk.

And there are losing trades sometimes!! The full execution of a longer route sometimes takes over a minute as we have to wait until the respective API is updated after each trade/swap. This means that sometimes something changes while the traderoute hasnt been executed fully yet. Like someone else trades in a pool and changes the balance or someone may cancel a buy order the bot had relied on.

Thats why i limited the maximum amount to 10 Hive, so it would never be too much of a loss. But as this is just a arbitrary amount, im sure there is alot room for optimization.

Also i am a bit spooked that someone found this code so fast. I was kinda just uploading some of my projects just so i could provide a link in my job application.

Thank you!

options2015 commented 2 weeks ago

Hi,

Many thanks for your prompt response. I have been closely looking into arbitrage lately and that is how I landed on your GitHub profile.

Does running your own node help speed up the rate at which trades/transactions are updated? I have noticed a number of the public nodes are not 100% up.

Thanks for looking into this feature request, much appreciated.

Wishing you all the best with your job application.

Cheery22487 commented 2 weeks ago

Hi,

i updated the script with the requested feature. There are 3 variables now. HIVE_TESTAMOUNT is the amount that is used to probe all the trades and swaps initially. Basically what used to be 10 before.

Then the chosen route with the best return will be checked again with higher amounts of hive up to the limit set by the MAXIMUM_TRADEAMOUNT or MAXIMUM_SHARE_TRADED variables, which are basically the variables you specified. MAXIMUM_TRADEAMOUNT is the maximum amount that will be traded at once and MAXIMUM_SHARE_TRADED is the maximum share of hive owned that will be traded at once.

Ive not run a node yet, so im not 100% sure. But from what i understand running your own node would remove the time spent on waiting for API-updates and performing the API-requests. There would still be delay in waiting for blocks to be processed when performing trades, but it would still be a major speed up. Especially as this script requests buyorders and sellorders of respective tokens one by one and that is fairly time intensive.

Public Node stability wasnt too much of an issue so far. At most every couple of weeks there might be some hiccups for a few hours.

options2015 commented 2 weeks ago

Thank you very much for implementing the requested feature. Let me test it out.

Any strategy on how to get more rc credits? I seem to be hitting <9% very frequently.

Cheery22487 commented 1 week ago

Thats always the issue on Hive. Its basically the Hive version of gas fees.

RC regenerates at slightly less than 1% of your maximum rc per hour. The maximum amount of rc is determined by the amount of hivepower (which is staked hive). Staking Hive is the main way to get more rc, but considering Hive is continuously losing value in the past months, im not sure id recommend this