scrtlabs / catalyst

An Algorithmic Trading Library for Crypto-Assets in Python
http://enigma.co
Apache License 2.0
2.49k stars 725 forks source link

Commission (fee) calculation in live trading #511

Open superluminance opened 5 years ago

superluminance commented 5 years ago

Dear Catalyst Maintainers,

Before I tell you about my issue, let me describe my environment:

Environment

Now that you know a little about me, let me tell you about the issue I am having:

Description of Issue

Exchanges can quote fees in different coins. For instance, when trading XMR/ETH on Binance, the fee is quoted in XMR when entering a long position or in ETH when going short. Besides, if BNB fee is enabled, the fee is quoted in BNB. On the other hand, my understanding is that catalyst only takes quote coin into account when calculating PnL, as I see in period.py._calculate_execution_cash_flow(txn). image

The problem arises when I try to calculate performance using catalyst PnL. The PnL is neither net nor gross, but somewhere in between. It nets fees for only the sells. I suspect this is one of the reasons that introduces mismatch to my live & sim.

What steps have you taken to resolve this already?

I am currently commenting out line 396 - 397. I would like to know whether I understand it correctly.

Sincerely, Frank

superluminance commented 5 years ago

I came from here #496

AvishaiW commented 5 years ago

Hey, Catalyst currently does not support this feature on Binance. We are currently swamped with work and it would take some time until we would fix this. any contributions are welcome. Thanks!