cryptoeax / arbbot

Arbitrator, a bitcoin/altcoin arbitrage trading bot
https://gitter.im/cryptoeax-arbbot/Lobby
GNU General Public License v3.0
200 stars 78 forks source link

Take deposit costs into account #121

Closed andygoossens closed 6 years ago

andygoossens commented 6 years ago

Most coins on most exchanges can be deposited for free. But there are some that have a deposit cost. Take those into account when calculating the "transfer fee".

For ccxt based exchanges this information can be found in $this->exchange->fees[ 'funding' ][ 'deposit' ];.

It would probably be a good idea to rename the current transferFees field into withdrawFees' and introduce a newdepositFees` field. When needed, look up the withdraw fee for the source exchange, add the deposit fee for the target exchange and compute the total transfer fee.

cryptoeax commented 6 years ago

Hmm, interesting, yes we should definitely take this into account.

Can you please give me some examples of the exchanges/coins you have seen this fee being non-zero on?

andygoossens commented 6 years ago

When an exchange does not expose the deposit fees through its API, most often you can find the list of costs at the top of the ccxt class.

e.g. HitBTC (ccxt: hitbtc2.php) has:

'deposit' => array (
    'BTC' => 0.0006,
    'ETH' => 0.003,
...

I know that HitBTC is not yet supported and that implementing this change can be considered a low priority. But it does not hurt to mention that these kind of costs are not yet taken into account.

cryptoeax commented 6 years ago

Pushed a number of commits to the binance branch which should fix this: https://github.com/cryptoeax/arbbot/compare/21fe01f...e6cc40f

Please test and reopen if there are any remaining issues. Thanks!

andygoossens commented 6 years ago

I don't have time this week to try out these changes. :-(

But it seems like we forgot to check for the deposit cost when balancing our coins: https://github.com/cryptoeax/arbbot/compare/21fe01f...e6cc40f#diff-e43e0520e5296919453b7aaf2ce9bc2bR307

cryptoeax commented 6 years ago

But it seems like we forgot to check for the deposit cost when balancing our coins: 21fe01f...e6cc40fdiff-e43e0520e5296919453b7aaf2ce9bc2bR307

That code is specialized for BTC transfers where we have a different way of deciding when to make a transfer and pay less attention to transfer fees alone. But in general it's hard to just inject this info into our balancing algorithm because it first picks a highest exchange as the source and then chooses a target. I've been thinking about a better algorithm that would take this information into account as well, but for now all we do with the deposit fee during rebalancing is just record it. :-)