hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
402 stars 107 forks source link

support the 'distance' parameter #147

Open hootnot opened 5 years ago

hootnot commented 5 years ago

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 !

coveralls commented 5 years ago

Coverage Status

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

coveralls commented 5 years ago

Coverage Status

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

coveralls commented 5 years ago

Coverage Status

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

fdwillis commented 2 years ago

merge?

fdwillis commented 2 years ago

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?

hootnot commented 2 years ago

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?

fdwillis commented 2 years ago

@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

hootnot commented 2 years ago

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

fdwillis commented 2 years ago

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

hootnot commented 2 years ago

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!