-
Notifications
You must be signed in to change notification settings - Fork 199
Description
You are basically leaving fees to yourself. But they should go to the exchange provider.
Line should be self.balance -= self.crypto_bought * current_priceself.balance = 0 as is written in comment "buy with 100% of current balance" - this means balance should become zero after that (in your code you basically subtract from balance your balance reduced by fee so after this your balance contains fee which should be instead given to the exchange provider):
RL-Bitcoin-trading-bot/RL-Bitcoin-trading-bot_7/RL-Bitcoin-trading-bot_7.py
Lines 265 to 268 in a01c8c8
| # Buy with 100% of current balance | |
| self.crypto_bought = self.balance / current_price | |
| self.crypto_bought *= (1-self.fees) # substract fees | |
| self.balance -= self.crypto_bought * current_price |
Line should be self.crypto_held -= self.crypto_soldself.crypto_held = 0 as you are selling here all your coins (instead you are just subtracting amount of coins reduced by fee so in your purse is left this "fee" amount of coins which should go to the exchange provider).
RL-Bitcoin-trading-bot/RL-Bitcoin-trading-bot_7/RL-Bitcoin-trading-bot_7.py
Lines 274 to 278 in a01c8c8
| # Sell 100% of current crypto held | |
| self.crypto_sold = self.crypto_held | |
| self.crypto_sold *= (1-self.fees) # substract fees | |
| self.balance += self.crypto_sold * current_price | |
| self.crypto_held -= self.crypto_sold |