oanda-api-v20 icon indicating copy to clipboard operation
oanda-api-v20 copied to clipboard

support the 'distance' parameter

Open hootnot opened this issue 6 years ago • 10 comments

Regarding #145 : Missing distance parameter on StopLossOrderRequest and StopLossDetails implemented

OANDA docs are not 100% clear about where the parameter is supported. The TakeProfitOrderRequest names distance in it's header but in the details nothing is found. Placing a TP-order using distance fails with an error.

I raised a question at OANDA regarding this: docs wrong or is it not implemented (yet)?

2019-07-17: update from OANDA: they are looking into this ...

2019-07-29: update from OANDA: this parameter is not public yet and may contain bugs. So it is not recommended to be used by any script or third-party application.

Bottomline: it can't be used in a TakeProfitOrderRequest !

hootnot avatar Jul 07 '19 21:07 hootnot

Coverage Status

Coverage increased (+0.009%) to 99.288% when pulling 2ea92ee661575c8a10b9b6f1cc861c8a777a6622 on distance-param into f300734238a6a3958e07e60456155fbc53748aa8 on master.

coveralls avatar Jul 07 '19 21:07 coveralls

Coverage Status

Coverage increased (+0.009%) to 99.288% when pulling 2ea92ee661575c8a10b9b6f1cc861c8a777a6622 on distance-param into f300734238a6a3958e07e60456155fbc53748aa8 on master.

coveralls avatar Jul 07 '19 21:07 coveralls

Coverage Status

Coverage increased (+0.009%) to 99.288% when pulling 2ea92ee661575c8a10b9b6f1cc861c8a777a6622 on distance-param into f300734238a6a3958e07e60456155fbc53748aa8 on master.

coveralls avatar Jul 07 '19 21:07 coveralls

merge?

fdwillis avatar Dec 03 '21 18:12 fdwillis

how to set trailing stop loss on JPY pairs? i have Trailing working for USD based pairs but fails at all JPY pairs when trying to do the same 15 pips in JPY like so (0.15 pips). suggestions?

fdwillis avatar Dec 03 '21 18:12 fdwillis

Why ask me and not just try things? Please read the docs developer.oanda.com regarding orders. If you have it working for non-JPY pairs then x100 for JPY seems logical. "It fails" ... what fails with what error?

hootnot avatar Dec 03 '21 19:12 hootnot

@hootnot i have

stopLossPrice = 0.0015
optionsTrail = {'trailingStopLoss' => {'timeInForce' => 'GTC','distance' => (oandaTickerUnderscore.downcase.include?('_jpy') ? (stopLossPrice * 100).round(2) : stopLossPrice.round(4))},}

updatedOrder = actingClient.account(accountToTrade).trade(openTrade['id'], optionsTrail).update

can anyone help?

Screen Shot 2021-12-20 at 12 49 55 PM

distance for trailing stops are off (only on JPY) units when partially closing a position are off (only on JPY)

I cant understand why

fdwillis avatar Dec 20 '21 18:12 fdwillis

It looks like you run a Ruby interpreter, what does that have to do with my Python library ?

I think you are looking for: https://github.com/kobusjoubert/oanda_api_v20

but before you drop any questions, please do your homework

hootnot avatar Dec 20 '21 21:12 hootnot

@hootnot this is the gem im using for a 100% pure ruby on rails project. any other suggestions?

fdwillis avatar Dec 20 '21 23:12 fdwillis

You are asking Ruby related questions regarding my Python oandapyV20 (oanda-api-v20) which is something totally different from https://github.com/kobusjoubert/oanda_api_v20

So, we will end this discussion now!

hootnot avatar Dec 21 '21 09:12 hootnot