Closing Positions - questions

Created at 18 Apr 2017, 06:35
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!
YC

ycomp

Joined 16.10.2013

Closing Positions - questions
18 Apr 2017, 06:35


What is the quoteToDepositConversionRate in ProtoOAClosePositionDetails?

Can someone show an example calculation using the quoteToDepositConversionRate so that I can better understand how to use it?


@ycomp
Replies

ycomp
18 Apr 2017, 06:39

profitInPips

profitInPips is available in the Accounts API, is there any way to get the profit in Pips via the Trading API

1. for closed positons?

2. for open positions?


@ycomp

ycomp
18 Apr 2017, 07:02

ProtoOAClosePositionDetails: closedVolume

can there be a situation where you send a close request (specifying the full position volume) and the position gets closed only partially? (i.e. ProtoOAClosePositionDetails: closedVolume is less than the volume you specified ? )


@ycomp

ycomp
18 Apr 2017, 08:48

TRADING_BAD_VOLUME

this is unrelated to the previous question

I received a TRADING_BAD_VOLUME, I can't replicate it anymore so I'm not sure why it occured. When trying to close a position.

but the message was "error_code:TRADING_BAD_VOLUME closeVolume 200000 is bigger than position volume 0 for trader (some numbers)"

how can a position have a 0 volume? Does it mean that I closed it already and I'm trying to close it again ?

 

 


@ycomp

ycomp
20 Apr 2017, 08:20

Hi, can someone answer these questions? thanks... 


@ycomp

Spotware
20 Apr 2017, 11:11

Hi ycomp,

1. What is the quoteToDepositConversionRate in ProtoOAClosePositionDetails?

It is the conversion rate between the deposit currency and the quote currency at the time that the position was closed. It is used to calculate your profit or loss in your deposit currency.

2. profitInPips is available in the Accounts API, is there any way to get the profit in Pips via the Trading API?

No, this is not possible using Trading API. If you don't want to use the accounts API, then you will need to find a way to calculate this information yourself.

3. can there be a situation where you send a close request (specifying the full position volume) and the position gets closed only partially? (i.e. ProtoOAClosePositionDetails: closedVolume is less than the volume you specified ? )

Theoretically it is possible. In the case there is not enough available liquidity to fill the entire order, then your order will be filled partially.

4. TRADING_BAD_VOLUME. how can a position have a 0 volume? Does it mean that I closed it already and I'm trying to close it again ?

This message usually appears when your volume is not within an acceptable range defined by the broker (minimum, maximum or within acceptable steps). In order to explain what happened in your case, we would need more information. It could be what you describe but we cannot be sure. In case it is reproducible, please provide us with steps to reproduce.


@Spotware

ycomp
20 Apr 2017, 12:11

thanks


@ycomp

ycomp
20 Apr 2017, 12:21

re: 2, I know how to calculate for Forex pairs but I don't know anything about how CFDs are calculated.

Do you have any info regarding CFDs ? examples how to calculate anything might be useful to me, or at least a description of what a CFD 'pip' is compared to a Forex pip.

For example, a stock index CFD


@ycomp

ycomp
29 Apr 2017, 17:17

RE:

Spotware said:

Hi ycomp,

1. What is the quoteToDepositConversionRate in ?

It is the conversion rate between the deposit currency and the quote currency at the time that the position was closed. It is used to calculate your profit or loss in your deposit currency.

 

can the quoteToDepositConversionRate ever be 0 ? my guess is no, but I'm asking because if it can be 0 I would get a DIV/0 error


@ycomp

Spotware
02 May 2017, 09:55

Hi ycomp,

no it should never be 0.


@Spotware