Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API function requests in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

commision in pips or any other commision determination
 Post subject: commision in pips or any other commision determination Post rating: 0   New post Posted: Fri 07 Mar, 2014, 21:57 
User avatar

User rating: 0
Joined: Fri 07 Mar, 2014, 20:46
Posts: 14
Location: NetherlandsNetherlands
Introduction

I am working on a full automatic trading solution. as part of my evaluation before opening a trade it should be possible to know the (exact) commission (in pips) that i have to pay for opening the position.

Problem

Actually there are 3 "problems"

  • get the commission when the system starts (so get it without opening/closing an order first)
  • get the commission when the system is running (so that we always know the current commission rate)
  • get the commission in pips without using instruments that we do not trade

Getting the commission when the system starts

The current commission rate is available in Portfolio->my commission, however i don't want to manually look it up and input it in my trading system.

A workaround could be to do a small trade (1000 base units) and calculate the commission, however this is inaccurate (commission is rounded at small trades, for example 1000000 EUR/USD @ 18 costs 24.95 USD one way but 1000 cost me 0.02 USD)

Another problem with the workaround is that you need to receive different instrument quotes to do the calculation (if account currency is EUR, and you do a USD/JPY trade, you also need the EUR/USD quotes to calculate).

Solution: It would be nice to create a method like (double) IAccount.getCommission that returns the commissions in USD$ per MIL.

Get the commission when the system is running

When the system is running we want to be sure to get the current commission rate, after we started it could be changed (because we do a lot of trades for example). So it would be nice to update the commission.

In my opinion there are different ways to do this

  • Every time we want to know the commission we run the above method (IAccount.getCommission). this is not preferred is costs time/CPU and is a bad practice.
  • Calculate/save commission based on the commission costs of the most recent order. this is not preferred either because it is inaccurate for small trades/orders due to rounding
  • Include the current commission rate in the order stats. this is not preferred because the commission could be downgraded when we don't trade a lot and we don't know this if we don't do an order for some time.
  • Save the commission when we receive an iMessage telling us that the commission rate changed. this is preferred

The best way (in my opinion) is to send an iMessage when the commission rate is changed. one way of doing it is to include the new commission rate in the message content. another way is to run the new method (IAccount.getCommission) when the message is recieved.

Get the commission in pips without using instruments that we do not trade

Another great feature would be to know/retrieve the commission rate in Pips. if we know the rate (with the suggested method) we still need to do some conversions to get the pip value (for example base currency EUR, and want to know pip value for EUR/JPY. then we need to know the EUR/USD quote).

It is not hard to calculate it if we have the quotes but i don't want to receive all the quotes all the time for the different instruments that i don't trade.

Solution: A better way should be to to send them once every while so that the API has some quotes available when the new method is run: (double) Instrument.getCommissionInPips

There is a chance that the quotes for the non-traded instruments are out-dated if they are send once every while, however when calculating the commission a small 'rounding' error has not much impact.


 
 Post subject: Re: commision in pips or any other commision determination Post rating: 0   New post Posted: Mon 10 Mar, 2014, 17:49 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Such feature request has already been registered. See:
viewtopic.php?t=49826


 
 Post subject: Re: commision in pips or any other commision determination Post rating: 0   New post Posted: Mon 10 Mar, 2014, 21:12 
User avatar

User rating: 0
Joined: Fri 07 Mar, 2014, 20:46
Posts: 14
Location: NetherlandsNetherlands
Quote:
fantom wrote:
Also, why classes Commissions and Overnights are depricated?


Quote:
your answer
Because those values change over time and it is not possible to release JForex-API in sync with every new Overnight/Commission rate change.


I do not understand this.

When i place an order in the strategy tester, the API should know the commission rate because it subtracts it from my equity.
When i place an order in live mode, the server should know the commission rate because it subtracts it from my equity.


 
 Post subject: Re: commision in pips or any other commision determination Post rating: 0   New post Posted: Tue 11 Mar, 2014, 08:50 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tabacco wrote:
When i place an order in the strategy tester, the API should know the commission rate because it subtracts it from my equity.
Only certain parts from the Historical Tester are part of the API.
tabacco wrote:
When i place an order in live mode, the server should know the commission rate because it subtracts it from my equity.
Server is not part of our API.


 
 Post subject: Re: commision in pips or any other commision determination Post rating: 0   New post Posted: Tue 11 Mar, 2014, 19:29 
User avatar

User rating: 0
Joined: Fri 07 Mar, 2014, 20:46
Posts: 14
Location: NetherlandsNetherlands
do you mean that i should place the feature requests in the trading platforms - feature requests board ?


 
 Post subject: Re: commision in pips or any other commision determination Post rating: 0   New post Posted: Wed 12 Mar, 2014, 08:20 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
No the place is right.


 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com