Relevance of Symbol.MinCommissionType

Created at 03 Jul 2024, 16:50
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CI

cindyarhodia

Joined 31.05.2024

Relevance of Symbol.MinCommissionType
03 Jul 2024, 16:50


Hi all,

I'm not sure to understand the purpose of it. It returns “Asset” or “QuoteAsset”.

I think you can remove it from your API, since we can get the asset of the minimum commission with Symbol.MinCommissionAsset directly, which will return a real value “EUR”, “USD” or whatever, be it the symbol quoteAsset or not.

The only use case I could “see” is if we need to check if MinCommission is expressed in symbol quote asset currency, or in any other asset, so it's like a bool, but that doesn't really offer anything ? Since in that case we still need to make a comparison on our end, which we could do with the returned value of MinCommissionAsset directly.

 

Am I dumb or is there any useful use case for that ?

I'm not flaming, just trying to understand :)

 

Thank you!


@cindyarhodia
Replies

PanagiotisCharalampous
04 Jul 2024, 12:40

Hi there,

The Symbol.MinCommissionType property is indeed designed to provide clarity on how the minimum commission (MinCommission) is expressed. Here are the key reasons for its existence:

  1. Clarity and Explicitness:
    • The property explicitly states whether the MinCommission is denominated in the symbol’s quote asset or a different asset. This helps prevent any ambiguity or misinterpretation, especially when dealing with various symbols and assets.
  2. Ease of Use:
    • By providing a clear indication of the commission type, it simplifies the logic needed to handle different commission structures. This can be particularly useful in complex algorithms where commission calculations play a significant role.
  3. Comparative Check:
    • While you could infer the commission type by comparing the MinCommissionAsset with the quote asset, having a dedicated property like MinCommissionType allows for a quicker, more direct check. This can enhance code readability and maintainability.

Example Use Case:

Consider a scenario where you need to implement different handling or calculations based on whether the MinCommission is in the quote asset or another asset. The MinCommissionType property allows you to write straightforward conditional logic without needing additional comparisons or checks.

While the MinCommissionAsset property provides the specific asset in which the commission is denominated, the MinCommissionType property adds an additional layer of clarity and convenience. It allows you to easily understand and handle the commission structure without needing extra logic for comparison.


@PanagiotisCharalampous

cindyarhodia
04 Jul 2024, 21:25

RE: Relevance of Symbol.MinCommissionType

Hi hi,
Thank you for enlightening me.

I understand it's supposed to add ease of use and improve understanding of developers, but the opposite happened to me when I saw this property in the symbol namespace. It confused me more than anything else. Having said that, I'm not really a dev, so maybe my thinking process isn't the most logical. 

Here is why :

First of all, it's named “Type” so I was expecting something related to CommissionType (which is kinda stupid since, of course, MinimumCommission can only be a fixed amount, when we think about it).

Secondly, I agree that commission fees are a big part of trading, and must be included in every strategy, if not then risk management will be flawed. It's even more true for scalpers with a tight SL but plays a role for swingers too. Either way, I assume everyone will compare and convert MinCommissionAsset to Account.Asset if they are different, independently of MinCommissionType.

About quicker comparative check and enhanced clarity, it returns a specific type value (SymbolMinCommissionType), which is unique for this property. No casting is possible so the only way I can think of to use it is :

                   if (symbol.MinCommissionType == SymbolMinCommissionType.QuoteAsset) { minCommInAccAsset = MinimumCommission / accountAssetToQuoteAssetRate }

                   else { minCommInAccAsset = MinimumCommission / accountAssetToMinimumCommissionAssetRate }

Whereas without accessing that property we can directly do :

                   if (symbol.MinCommissionAsset != Account.Asset) { minCommInAccAsset = MinimumCommission / accountAssetToMinimumCommissionAssetRate }

Actually we don't even need to compare anything, since if both Assets are the same, Rate will equal to 1, so we can divide anyway. The second case is more clear (to me, at least)

I'm assuming you have some statistics about how frequently a property is accessed and I guess some people use it. Developers that implemented that specific property had probably good reasons to do so, but in my eyes it's not useful at all (again, I'm not flaming, just sharing my feedback)

 

On another note, not really related but since I talked about rates, the Asset.Convert method is rounding a lot (!) I find it a bit meh (although not exactly disturbing) that to get precision we need to do something alike :

                   double amount = 1000000000;

                   double accToUsdRate = Account.Asset.Convert("USD", amount) / amount

Not doing that with an account where asset is JPY (for example) will return a rate equals to 0 (if amount = 1, hence skipping the division), instead of 0,00619974333 currently.

 

Thank you for all the work you put in, and the time you take to answer people on the forum. I hope I'm not annoying you with my explanations <3

I'm not waiting for any answer to this post but you're more than welcome if you want to discuss about it :)

Sea yah!


@cindyarhodia