-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the balance output to ignore the coins that are in the Blacklist #4497
Comments
i think it'll confuse more people than it will help Especially the BNB balance you mention is quite important - as you should be aware when you run out of BNB to eventually buy more of these. Usually, I'd also use the blacklist to forbid the bot to trade a coin i see as high risk, not one that i hold anyway. To correctly represent the "trading" balance, i'd therefore need to only report a subset of my available ETH balance (assume i personally own 1 ETH, and the bot bought 0.5 ETH temporarily), but not the full ETH balance - as this would then make the reported result quite inconsistent (it includes only what the bot uses - + my ETH balance). This will make this a ... rather complex change i'd say, and one that's VERY prone to report false or missleading results. |
Fair enough about keeping the BNB and the potential non-blacklisted currencies. What about we add a Like that :
|
my fear is that it'll make the output much more difficult to read / understand - without really providing much value. you'll also end up with "problem" cases - the bot can own a blacklisted pair (if it bought it before being blacklisted, for example) ... where would you list this? as blacklisted, or not (because the bot owns it) ? these special cases will make it very difficult to both develop (that's probably okish - as it's a simple decision) - but even more difficult to understand from a user perspective. |
I don't think it's making the output hard to read, but if it is, we could return this output only when using a special parameter, like To he honest, my current If I want to see my real, full, exchange wallet, I open the Binance app. To me, the |
i don't necessarily mind changing how it works, but because of the above, you can't tie it to the blacklist. If we assume the definition is to only show "related to freqtrade" - then it must handle at least the cases from above correctly (not sure what correct is yet in all cases):
To me, this adds WAY too much complexity to a command that's supposed to give you a very quick overview - and is not relevant to the trading operations whatsoever. |
I understand your points, and I agree that it will be hard to match all the corner cases. I guess I'll simply write my own external python script that will calculate the balance the way I want it to be calculated, and send the message to Telegram once a day scheduled by a cronjob, that way I won't have to rely on using the On a side topic, how would you feel about allowing the user to add customized Telegram commands ? I.e. storing them in an external plugin or config file. Would you feel it is something that could be worth investigating ? |
it's the corner cases -- and if you're a new user and look at your balance - but half of it is missing, you'll for sure be left wondering. so far, i didn't think about telegram as extensible - but it might be an option - although i don't think many users will be able to - as telegram is quite ... picky in what it'll allow you to send unless it's properly / correctly escaped. |
Actually I think I found the valid way to cover most -if not all- cases efficiently. To get the real value of the balance dedicated to trading, I only has to add all the current values of the open trades (if any), and add the possible leftover of the stake_currency available on the exchange. From an external script point of view that's a pretty straight forward calculation :
My external script is scheduled to run every day at 00:01 AM and calculate the performance of the bot during the previous day, in percentage. I then save that into a JSON file so I can keep the historical values for each days, and I pretty print the result to Telegram as a nice table that shows the performance over the last 30 days. Basically its kind of the same as the I found the |
I would love to have an SQL table that keep the open balance and close balance value for each day (in stake currency). That would allow the user to get a whole new set of information about the bot's performance. |
that's introducing another type of problem ... also, around midnight is where most exchanges schedule downtimes ... so it will have some missing days from time to time (whenever there's a downtime or the bot wasn't running at that time) - both of which are points that need to be considered when consuming the data. |
I'm currently executing it at midnight UTC, as I want all the data to be "timezone-neutral". I've also made a security mechanism that keeps retrying to generate the performances of the previous day as long as it has not been generated already, meaning that if there's an exchange maintenance/outage from 23:00 UTC to 01:00 UTC, the performance calculation will be done somewhere after 01:00 UTC, when the exchange is back up and responding. On my side, I'm totally fine with some small delay in the performance calculation in case of a maintenance/outage on the exchange. |
well if you're interested in integrating this as base functionality (the i think we'd want to store the full balances though, not just what the bot "owns" ... that might allow some "extended" reports as well in the future ... :) |
Yeah, I might take this task of improving the reports, but we first need to ensure that we agree on the requirements and on the expected result, as we need to find a way to get an output that satisfies both of us (me with my balance dedicated for trading, and you with your full balance).
Do you mean that you want to store the full balances details ? Like each currency, with the amount the user owns, and also the estimated value ? I don't really see what's the point of keeping the detail of what constitutes each day's amount, but if you have a precise and valid use case, I guess we could keep it. I think we will want to keep both the "Trading Balance" and the "Total/Exchange Balance", so we can cover all the uses cases, therefore the content of the DB table could be something like below. For the purpose of the examples below, let's imagine that on the Exchange there's $150 worth of a currency that we never trade, and to make the calculation easier, let's imagine that this currency price is not moving (i.e. BUSD). That means that there would always be +$150 on the Exchange Balances, compared to the Trading Balances. Example of DB content :
When the user send the command When the user send the command Basically, the output that I'm expecting would be something like that : Command : Output :
Command : Output :
The Also, we could decide to not show the What do you think about that ? |
personally, i'd say leave the "how to display" out for now - as there can be multiple different usecases for this, and calculating the "tradable" part might not be as easy as it sounds (we'll probably also need to include from the "balances" database, i'd not only store the stake-currency - but all balances (eventually we might end up having 2 tables, one with "all" balances, and one as you describe above - which shows it in stake_currency based on the current (that day's) conversion rate. While the "full" table might not be useful for the telegram output itself (not in the form you describe it above) - we could run apart from the potential "additional" table (i see the usage for that mainly with the rest api to potentially generate graphs of the owned currencies, not with telegram), i think your approach should work. The %change is definitely not necessary in the table, that is too easy to calculate when gathering the output. You might want to be careful with the datatype of the "date" column - i would use "DateTime" not "Date" - as it will allow us to increase the granularity in the future. |
Do we agree that if, for each day (let's say at 00:01 AM UTC), we store :
Then we will be able to calculate absolutely everything we will ever need related to balances and daily reports ? I think it would even allow to generate data that is able to support the cases where an user is running multiple bots with the same stake_currency. It might be a lot of data to store every day, but at the same time it would indeed give us the freedom to generate all kind of historical reports and calculations. Are you OK in storing such amount of data every day ? (I think we don't have much choice, tbh) |
what would we need this data for? |
Yes, of course we won't need exactly everything, but basically we will need to keep quite many information from The problem with that is that we need to keep a "snapshot" of the values for each trades at the time of the new day (let's say 00:01 AM UTC), and I think we don't have this information at this precise time of 00:01 AM in the Maybe you want us to add more data to the I'm going to take some time and try to prepare an example of what could be the table structure, with some data examples, and I will post that here to confirm. |
you can't use the i'm still not sure which info you'd need for this ... i think having the balance at that time will be enough (you can still cross-reference that with the trades table to determine if it's one of your trades or if it isn't). |
Describe your environment
Describe the enhancement
Right now the command
/balance
is showing the balance for everything in the account.But I believe that there's some improvement that we could do here.
Let's imagine that I use Binance for trading with freqtrade, but also to sometimes I buy and hold some specific coins. In this case, I will very likely want to be able to show the balance of all the things that are related to the freqtrade trading, but ignore the assets that I know are not related to trading.
For example, let's say that I trade using
USDT
as stake_currency, and let's say that I own some ETH and some BTC that plan to hold for long time, without trading them. Let's also assume that I have bought some BNB to be able to benefit lower trading fees, and in order to avoid to trade those coins, I have added the following values in the Pair Blacklist :In this scenario, it would be very nice to have some sort of a
/balance trading
command that will ignore my ETH, BTC and BNB balances, and will only show me everything else, which is going to be everything that is related to the trading.And I guess it would even make sense to "rename" the existing command to
/balance all
, and use the/balance
command to default to only showing the balance of everything but the pairs that are in the Blacklist.I think it shouldn't be too complicated to implement, so I can have a look at it if we believe this is something that would be useful.
Thoughts ?
The text was updated successfully, but these errors were encountered: