- ago
Wouldm't it be nice to have a PositionType.Flat for Position as well as Positions. Instead of a null risking an Exception (e.g. in a loop or a portfolio), PositionType.Flat is explicit and can be counted for e.g. risk-adjusted return measures. Who wants to be always exposed in a market?

Until that day I will have to roll my own PositionType.Flat, I am afraid.

Regards,

Hermann
0
105
Solved
7 Replies

Reply

Bookmark

Jump to End
Cone8
- ago
#1
It depends on what you need it for. If you're evaluating positions, we will not change PositionType.Long or .Short to .Flat - you'd lose the trade type. That would have terrible repercussions (so that Feature Request is denied!)

In a script, you can determine if any positions are open like this:
CODE:
if (OpenPositions.Count == 0) // flat


If you need to know if a position has exited, you can use the exit bar number:
CODE:
foreach (var p in GetPositions())             if (p.ExitBar > -1)                WriteToDebugLog($"{p} is flat");
0
Best Answer
- ago
#2
Thanks Cone for your reply. The code snippets just illustrate my request: how much more concise and legible would PositionType.Flat be! Your position is flat when you have sold or covered your entire position and thus sensitivity to price changes is zero ( 0 times Pnl ). Simple really!
0
Cone8
- ago
#3
It's not that simple. It would be a disaster for legacy code that depends on identifying the Position "Type". Flat is a Status, not a Type.
1
- ago
#4
Being flat a commodity is a conscious investment decision as much as being long or short is: you forego a potential opportunity and it shapes your risk profile. If 'Long' is a Positiontype, then 'Flat' is right up there, too. That applies to judging performance relative to a benchmark, in particular.

WL users of their own C# scripts are forced to graduate to the latest WL API anyway. Why not make PositionType.Flat instead of or on top of the legacy non-state 'null' part of a future WL10 release?
0
- ago
#5
In WL’s framework a Position object only exists if you have a position. If you have no Position then you’re “flat.” I guess you could technically be “flat” too if you hold two positions, one long and one short, of equal quantities. So adding a PisitionType.Flat to the enum just doesn’t make sense. What are you hoping to accomplish via this idea?
0
- ago
#6
I understand your (technical) reasoning. As I have ried to point out, when you manage relative to a non-cash benchmark, running a flat exposure is a rather risky position. Performance relative to a benchmark means comparing TimeSeries of results for the benchmark as well as one or more for the risk assets. The results are calculated by holding period returns (e.g. daily) times risk exposure (long, short as % of equity or flat (zero)). This is the starting point for risk management discussions and performance analysis relative to benchmark. -- I am not talking about net flat exposure as a result of calendar spreads or yield curve bets, which can be very risky. WL is not geared up for that.

I suspect most users of WL come from a CTA perspective aiming for total return against an implicit cash benchmark. In this world, selling an asset just bumps up the cash position, which is a non-risky position (given the implied cash benchmark).

Thank you for attention

Hermann



0

Reply

Bookmark

Jump to Top