CyberPunkMetalHead / Binance-volatility-trading-bot

This is a fully functioning Binance trading bot that measures the volatility of every coin on Binance and places trades with the highest gaining coins If you like this project consider donating though the Brave browser to allow me to continuously improve the script.
MIT License
3.42k stars 779 forks source link

Sell before buy #42

Closed pawelantczak closed 3 years ago

pawelantczak commented 3 years ago

Hi.

Currently, buy operation is executed first. With limited funds, it would be better to sell first and be able to buy in same cycle.

ShogunMan commented 3 years ago

Change this:

for i in count(): orders, last_price, volume = buy() update_porfolio(orders, last_price, volume) coins_sold = sell_coins() remove_from_portfolio(coins_sold)

to this:

for i in count(): coins_sold = sell_coins() remove_from_portfolio(coins_sold) orders, last_price, volume = buy() update_porfolio(orders, last_price, volume)

CyberPunkMetalHead commented 3 years ago

Good input, I've been testing this my end and it works nicely. I will most likely push the changes