edeng23 / binance-trade-bot

Automated cryptocurrency trading bot
GNU General Public License v3.0
7.96k stars 2.2k forks source link

Web GUI / Machine Readable Log #81

Open j-waters opened 3 years ago

j-waters commented 3 years ago

In my fork I've added some machine readable logs to keep track of when trades happen, the value of the current coin in BTC and USD, and how close we are to jumping to another coin.

These logs can then be used to make graphs of gains/losses or monitor the real time performance of the bot. If this project continues and proves useful, I'd probably end up making a basic web interface using this data.

I was thinking of making a pull request but I thought I'd open an issue first to ask a couple of questions:

I'd be happy to write whatever and make a pull request, or leave it to you if there's a specific way you want to do things

rel-s commented 3 years ago

Hi @j-waters! I think it's a great idea to have a web interface with some pretty data, and better logs. Using SQLite sounds like a good direction. Why don't you submit a PR when you have something ready? We can discuss it in more detail in the Discord channel, but I think the data points you mentioned would be a great start. Just keep in mind we also have a Telegram bot "frontend", so we might want to integrate those somehow... What do you think, @edeng23 ?

edeng23 commented 3 years ago

I definitely agree, I always wanted to have a "frontend" graph view so that I can tell if I'm getting any closer to trades instead of being in the dark.

The thing about emphasising the current coin value in USD and BTC is that it confuses people and makes them think that the bot is supposed to constantly increase this parameter. This is not the point of the bot. Ideally, the GUI should show the amount of BTC or USD you would have if you didn't run the bot (if you were just holding the current coin the whole time), compared to the amount you have now.

diedline commented 3 years ago

Have you considered testing whether historical data can be profitable。

ch3ckmat3 commented 3 years ago

The console can also be improved using Text UI for example: https://www.willmcgugan.com/blog/tech/post/building-rich-terminal-dashboards/

tkarakasoglu commented 3 years ago

For now I have added a method, maybe you want to add this simple function. This method prints near 5 coins to current coin.

Method:

def botUI(source_coin: Coin, ratio_dict):
    t = datetime.datetime.utcnow().strftime('%H:%M:%S')
    string = '{} - {}: '.format(t, source_coin)
    i = 0;
    for pair in sorted(ratio_dict, key=ratio_dict.get, reverse=True):
        if i == 5:
            break
        string += '{} {:.5f} | '.format(pair, ratio_dict[pair])
        i += 1

    print(string, end='\r')

Usage:

.
.
.
    for pair in get_pairs_from(current_coin):
        if not pair.to_coin.enabled:
            continue
        optional_coin_price = get_market_ticker_price_from_list(all_tickers, pair.to_coin + BRIDGE)

        if optional_coin_price is None:
            logger.info("Skipping scouting... optional coin {0} not found".format(pair.to_coin + BRIDGE))
            continue

        # Obtain (current coin)/(optional coin)
        coin_opt_coin_ratio = current_coin_price / optional_coin_price

        # save ratio so we can pick the best option, not necessarily the first
        ratio_dict[pair.to_coin] = (coin_opt_coin_ratio - transaction_fee * multiplier * coin_opt_coin_ratio) - pair.ratio

    botUI(current_coin, ratio_dict) # <--- ADDED --->

    # keep only ratios bigger than zero
    ratio_dict = dict(filter(lambda x: x[1] > 0, ratio_dict.items()))
.
.
.

PREVIEW Screenshot_19

rel-s commented 3 years ago

Just linking #180