Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connecting position with order_id/tag #138

Closed
akshaythakker opened this issue Nov 30, 2021 · 9 comments
Closed

connecting position with order_id/tag #138

akshaythakker opened this issue Nov 30, 2021 · 9 comments

Comments

@akshaythakker
Copy link

Is there anyway for me to link order_id/ or tag passed during placing the order with the position. So lets say I place a sell order for Nifty 17000 PE from one strategy and then another order for the same security through another strategy, I would like to track the two positions independently and right now the only way to do so is through maintaining an extensive log of the traded price, current price, etc for each of the orders in each of the strategy. The problem with the logging system is that it doesn't allow a manual intervention or modification of some position (from outside the algo) which then throws the entire tracking & logging at the algo level into a tizzy.

@vijaykz
Copy link

vijaykz commented Dec 1, 2021

Visit https://zerodha.com/z-connect/console/tagging-on-console-trading-journal-tracking-goals

Note that I have not personally tried this feature. And, I also don't find an option to tag existing open positions; seems it's only for holdings.

Let us know if this helps.

@akshaythakker
Copy link
Author

Hi Vijaykz... thank you so much for writing back. Tags are a great, and when I am trading using the api - I CAN tag each order placed through the api. However, when i retrieve the current day position using kite.position.... the positions do not segregate as per the tags that created them. This defeats the purpose as I would like to track, modify, and exit positions in the same security placed as part of different strategies. The position command only sends a consolidated list of all positions for the security irrespective of the tag they carry. This is something that zerodha should work on if possible.

To elaborate lets say i shorted a call option for nifty 02 December 17100 CE as part of strategy1 and tagged it strategy1 and then again shorted 2 nifty 02 December 17100 CE as part of strateg2 and tag it as strategy2... i CANNOT retrieve current positions based on their tags, i only get a consolidated number of 3 nifty 02 December 17100 short!

@vijaykz
Copy link

vijaykz commented Dec 1, 2021

In my view, Kite cannot (and should not) provide such features, in order to remain simple and cater to larger demography.

You can maintain a database of sorts and also create a custom (ex: HTML-based) UI and group your positions. And issue exit orders from within your app. You can tag and track orders effectively this way.

@akshaythakker
Copy link
Author

hi vijay, are you part of kite development team?

@vijaykz
Copy link

vijaykz commented Dec 1, 2021

Nope, I am not. I'm an independent developer.

@rhnvrm
Copy link
Member

rhnvrm commented Dec 2, 2021

Hey @akshaythakker

We currently provide aggregate positions, so it is not possible to show a breakdown of the positions by tags at the moment. Splitting positions is tricky, as you said as well, there are multiple variables like qty, price etc to track.

For now, you will have to resort to maintaining the positions and splitting them according to your logic. For interactions outside your program, such as those made manually on Kite; you could maybe listen to on_order_update using the ticker connection and handle them appropriately.

@akshaythakker
Copy link
Author

Hi Rohan, this on_order_update suggestion looks promising... will the order_update include the tag of the order that got updated? even that can solve my problem. Also where can i learn more about that feature?

Thanks!

@rhnvrm
Copy link
Member

rhnvrm commented Dec 2, 2021

You can refer to the example here: https://github.com/zerodha/pykiteconnect/blob/master/examples/ticker.py#L31 and read more about it on the docs.

@knadh knadh closed this as completed Dec 2, 2021
@akshaythakker
Copy link
Author

The order update will post the tag for the new order from outside the algo...so that wont be useful for what I need to achieve. Looks like, there is nothing much that can be done for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants