freqtrade / frequi

Freqtrade UI - Frontend for Freqtrade
https://github.com/freqtrade/freqtrade
GNU General Public License v3.0
609 stars 274 forks source link

Fix cost currency sign #2122

Closed xzmeng closed 1 month ago

xzmeng commented 1 month ago
截屏2024-10-17 06 42 09 截屏2024-10-17 06 42 18

I am not sure if it's intentional, but intuitively (for spot trading) we -$344 when we buy, and +$348 when we sell, right?

xmatthias commented 1 month ago

err no? when you buy, you add money to the trade - so sign should be positive when you sell - you remove money out of the trade - so sign should be negative

It's not really a "spot or futures" question either i think.

This PR seems to invert this - using "-" for buys, suggesting we're subtracting money when buying? What from?

I guess your argument is "you subtract money from the account" - but i don't think that's intuitive. I've never seen this displayed in this way on any exchange platform so far - everywhere it's "bought 200$" - not "bought -200$"

So from from looking and testing this (spot, futures, backtesting and dry-run) - i don't think this change is correct - and kinda contradicts (my?) logic. Your screenshots look correct to me - but the new code inverts that behavior, causing a long entry to be "-".

New logic

image

2nd screenshot from a short entry ... (which is a sell)

image

xzmeng commented 1 month ago

"add money to the trade/remove money out of the trade" makes sense to me.

I guess your argument is "you subtract money from the account" - but i don't think that's intuitive. I've never seen this displayed in this way on any exchange platform so far - everywhere it's "bought 200$" - not "bought -200$"

My intuition probably comes partly from some backtesting libraries that display an "available cash" curve alongside in the result.

Thanks for your patient explaination.

xmatthias commented 1 month ago

Thanks for your patient explaination.

I wouldn't call it explanation - rather discussion 😆 it's how it is now - built by me - based on how i thought (and think) about this - which doesn't mean it couldn't be improved or benefit from other views.