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

feat: Adding filled_at information to trading.models.Position #536

Open
1 task done
agram20 opened this issue Dec 13, 2024 · 2 comments
Open
1 task done

feat: Adding filled_at information to trading.models.Position #536

agram20 opened this issue Dec 13, 2024 · 2 comments

Comments

@agram20
Copy link

agram20 commented Dec 13, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

I need to be able to re-boot my application at times and if I have open positions need to bring them back to a relevant state. trading.get_all_positions() provides most of the information I need, but in order to calculate a positions p/l I need to know how long it has been opened i.e. margin fees

Describe the solution you'd like.

add trading.models.Position.filled_at attribute so that I can determine when a position was opened

Describe an alternate solution.

No response

Anything else? (Additional Context)

Thanks!

@hiohiohio
Copy link
Contributor

@agram20 Thank you for the request. At a glance, Alpaca Trading API currently returns aggregated positions from the positions endpoints. Therefore, to construct those information, it might be required gathering info from list of orders (filling date and qty) or account activity (not implemented in alpaca-py yet #232).

@agram20
Copy link
Author

agram20 commented Dec 13, 2024

Gotcha. That'll work for what I need

Might be cool if the position objects maintained a sort of memory of their lifecycle i.e. if part of a position was removed or added to at some point, not like you don't have enough other things going on :) Thanks for the direction!

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

2 participants