pylivetrader
pylivetrader copied to clipboard
Allow algo's to influence client_order_id for algo grouping
It is useful to use client_order_id to help group different algos. If there was a way to define a order_prefix for example it could be used in alpaca.Backend._new_order_id for users to change.
Unfortunately, with the shorting changes, handling client order IDs is not just as simple as passing through a parameter. One order, from Pylivetrader's point of view, can actually become two orders by the time it reaches the brokerage. (E.g. you have 50 shares and you submit a sell order for 100 orders, a 50 share sell order will be created and, once it fills, another 50 share short sell order will be created.) I'll see if I can think of a good way to handle this - I may just do as you suggest and use a limited prefix. Maybe the first 8 characters of the ID string could be customizable.