tiagosiebler / TriangularArbitrage

Detect triangular arbitrage opportunities within Binance price tickers
566 stars 174 forks source link

fees explained #53

Closed mkutny closed 6 years ago

mkutny commented 6 years ago

I'm not sure I fully understand why fee percentages would be different among arbitrage triplets.

If a fee for a trade is 0.1% then 3 steps should cost a constant fee of 0.1%*3 = 0.3%. Why would they differ?

tiagosiebler commented 6 years ago

Hey Max, I didn't look into this into much depth, just wanted to implement a fee calculation as quick as possible - the simplest route was just doing the math on each step, since each step is a separate transaction.

mkutny commented 6 years ago

@tiagosiebler, thanks for the answer!

I understand that you perform fee calculation on each step and then sum them up together. The issue is that (as far as the percentages involved) the sum of 3 steps should be a fixed 0.3% (three times taker fee of 0.1%).

My understanding is that the commission should be fixed but in the output, it varies for each row.

I would say that it's a bug but it's so apparent so I suppose that I'm probably missing something? If we forget about the code and stick just to mental reasoning - why would the fees be different for each route?