chrisleekr / binance-trading-bot

Automated Binance trading bot - Trade multiple cryptocurrencies. Buy low/sell high with Grid Trading. Integrated with TradingView technical analysis
MIT License
5.05k stars 1.1k forks source link

feat: endpoint for bot up status #341

Open ilbuonmarcio opened 3 years ago

ilbuonmarcio commented 3 years ago

Is your proposal related to a problem?

I'm trying to monitor my bot using Grafana, but using the bot main page as the checking endpoint puts unnecessary load on the bot itself.

Describe the solution you'd like

Can we make something like a /status endpoint, maybe just a JSON with status OK and an HTTP 200 response code, which we will call with monitoring services?

That can be a nice touch :)

Additional context

That can be useful when you are hosting in an untrusted cloud provider, or checking if your selfhosted at home bot is currently online or not.

ilbuonmarcio commented 3 years ago

Indeed if it's something well accepted upstream I'll try and do the implementation myself 👍

chrisleekr commented 3 years ago

Ah yap, good point. I will add in later.

chrisleekr commented 3 years ago

Actually, can you give me more idea what kind of information to be included rather than just ok?

I would say, following information is to be cached by trailing trade indicator job and show with /status

ilbuonmarcio commented 3 years ago

I'm thinking also about uptime too, but the ones suggested are also good indeed :)

ilbuonmarcio commented 3 years ago

Just to be sure, anything fast to check possibly, so we can call it frequently without making any degradation of the bot's service. I'd see also something with not private data like how much the bot is holding as such, or if you want that, make two separate endpoints, one with /status and the other with maybe /status/<TOKEN_STATUS_PRIVATE_DATA> (added via .env file) for private data, so we can catch both cases and handle both of them properly.

ilbuonmarcio commented 3 years ago

Just implemented the basic endpoint, for the more "private" endpoint (with mandatory token access in the endpoint itself) I'll let you decide on how to implement it, I'm still learning the tech stack and don't wanna mess it up more than I can add :P