order-manager
is an application responsible for keeping track of the owned positions of various strategies, reading in new position-intent
s, and emitting order-intent
s. The goal of this setup is to move all of the order management logic to one central application and have each strategy only be responsible for emitting desired positions.
The order-manager
stores stateful data in postgres and is aware of brokerage limitations such as order constraints. For example, the alpaca brokerage does not allow orders that would change the holdings of an asset from net-long to net-short or vice-versa, so order-manager
detects any position-intent
s that would create such a state and instead generates two orders: one to bring the total ownership down to net-zero, and one to fulfill the net position. This second order is only allowed to be sent once the original order has been filled, and so order-manager
also keeps track of dependent-order
s to ensure transmission at the correct time.