Close position in OMSType.HEDGING #538
-
Hi In OMSType.HEDGING strategy, I'd like to place an order on specific side of futures position. precondition:Enabled problem:Now I want to close just SHORT position. Normally I will call So, how can NautilusTrader handle such situation? Should we consider add this kind of option for order factories? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @sidnvy You're very close to having that working by the sounds of it. You're correct that this We're currently working on docs and so some of this could be much clearer, however something to highlight is that the only responsibility of the The orders however have no knowledge of positions, even though by consequence they result in changes to positions when executed. Solution
As you know implementing the Binance Futures integration is an open task for the project, and having a quick look at their API it seems that for the
This should result in the order being submitted specifically against that position side for that market, and will either add or reduce to that position. Hope that offers some clues for you. Feel free to continue the discussion and paste any code snippets if you like. Let me know how it goes! |
Beta Was this translation helpful? Give feedback.
Hi @sidnvy
You're very close to having that working by the sounds of it. You're correct that this
dualSidePosition
option is just another term for a hedging account type orOMSType.HEDGING
.We're currently working on docs and so some of this could be much clearer, however something to highlight is that the only responsibility of the
OrderFactory
is to instantiate orders in an easier way than if you had to pass every parameter into the order classes themselves.The orders however have no knowledge of positions, even though by consequence they result in changes to positions when executed.
Solution
So what you'd need to do is once you have your desired order from the factory, pass a
position_id