Additionally, because the site's in Bitcoin, deposits and withdrawals tend to be a lot more frequent than on other sites. Players cash out as a way of managing their bankroll. Often times it will take 1-2 hours for the withdrawal to be approved, and in that time they'll deposit again and lose that deposit, then try to claim a cashback on the loss while the other withdrawal's still pending. What this means is that my code would have to spider through the player's entire transaction history and try to figure out which withdrawals matched which deposits. And most of the time, it's not a 1 to 1 relationship.
In that case maybe it should be considered if cashback could be implemented so that player is eligible if he still has balance left and has pending withdraws.
in case of your simplified cashback:
lets say i deposit 1000 euro, win 10000 euro and withdraw 10000.
I then deposit 1000 and lose with 10000 playtrough. I get 100 cashback.
This case would be equivalent to this:
I deposit 1000 euro and win 10000. 10000 is marked as my highest point and my playtrough is resetted(playtrough is counted from the point when bankroll was highest)
I then continue playing and my bankroll drops to 9000 and ive made 10000 playtrough since i was at the highest point of bankroll.
By pushing claim cashback button in cashier i am rewarded 100 cashback, 9100 euro is marked as the highest point and playtrough is zeroed.
Continuing from the previous case i could withdraw 8000 euro and the highest balance would again be resetted to my current balance of 1000 euro and playtrough zeroed. I then proceed to lose the last 1000 euro with 5000 playtrough and i am rewarded 5% cashback of 50 euro.
I think your system would also prevent people who already have a history of being net winners in the casino from ever claiming a cashback, if I understand it correctly...? And I'm not sure I want to do that.
In most cases player would keep reasonable cashback even if he was net winner(in case of weighted system). The biggest defining factor would be how many % of deposits are winning deposits, and not the actual win amounts.
In your first example, it's true, in the system where withdrawing clears the history, the player would forfeit the cashback just by withdrawing anything. But this is OK because I really only want the cashback to be if the player zeroes out the initial deposit without a withdrawal.
Pending withdraws, people redepositing before they hit 0, etc. might result in some pople being netlosers and never get cashback.