braverock / blotter

blotter provides transaction infrastructure for defining transactions, portfolios and accounts for trading systems and simulation. Provides portfolio support for multi-asset class and multi-currency portfolios. Actively maintained and developed.
112 stars 49 forks source link

[R-Forge #852] generate transactions from difference between current and desired position targets #25

Open joshuaulrich opened 8 years ago

joshuaulrich commented 8 years ago

Submitted by: Xin Xiao Assigned to: Brian Peterson R-Forge link

now i can change portfolio by adding new trade.

i want a function that accept target position and figure out the correspondent trades, and then change the internal data structure, according to the difference between current position and target position.

in this way, i can use the result of a portfolio optimizer directly.

and how to take part in the development of blotter, since i find the package is very useful.

thanks

Followups:

Date: 2013-09-18 22:13 Sender: Rashid Rasul Has any more progress been made on this? I am also looking for similar functionality, i.e. to calculate target positions and create transactions to move from the current position to the target positions.I'm writing this now when I came across this note. I will attach once completed, but it is a little more complicated than I expected as the positions are in different currencies and I need to work out the correct GBP equivalent to go long/short in a basket of other pairs and then calculate P&L and carry in GBP! Regards, - Rashid

Date: 2010-03-29 11:25 Sender: Brian Peterson Thanks for your note. I agree that this would be useful functionality to have available for a portfolio manager. One way to participate in the development of blotter would be to write the function you are requesting, and attach the file to this feature request.I think that the function is relatively straightforward.First, one would getPos() for a given time, and then calculate the difference between current and desired position. If the position crosses through zero, you would want to split the transaction into two transactions, one to get to zero, and one to go to the new position.These could then be added via addTxn() or addTxns()I do wonder whether this functionality is better modeled as orders in a trading/strategy system than directly modeled as transactions, but any implementation will be a good starting point. Perhaps there will be one function that will take weights and generate target changes in position based on current positions, and another that generates the transactions from that.As for broader involvement, the best thing to do is just get involved. write test cases, report issues, write code to enhance functionality and add it as feature requests, etc. We actively desire participation of other R finance community users and developers.Regards, - Brian