//-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance from the security identifier and net quantity.
 /// <para>
 /// The net quantity is the long quantity minus the short quantity, which may be negative.
 /// If the quantity is positive it is treated as a long quantity.
 /// Otherwise it is treated as a short quantity.
 ///
 /// </para>
 /// </summary>
 /// <param name="securityId">  the identifier of the underlying security </param>
 /// <param name="netQuantity">  the net quantity of the underlying security </param>
 /// <returns> the position </returns>
 public static SecurityPosition ofNet(SecurityId securityId, double netQuantity)
 {
     return(ofNet(PositionInfo.empty(), securityId, netQuantity));
 }
 /// <summary>
 /// Obtains an instance from position information, security identifier, long quantity and short quantity.
 /// <para>
 /// The long quantity and short quantity must be zero or positive, not negative.
 /// In many cases, only a long quantity or short quantity will be present with the other set to zero.
 /// However it is also possible for both to be non-zero, allowing long and short positions to be treated separately.
 ///
 /// </para>
 /// </summary>
 /// <param name="positionInfo">  the position information </param>
 /// <param name="securityId">  the identifier of the underlying security </param>
 /// <param name="longQuantity">  the long quantity of the underlying security </param>
 /// <param name="shortQuantity">  the short quantity of the underlying security </param>
 /// <returns> the position </returns>
 public static SecurityPosition ofLongShort(PositionInfo positionInfo, SecurityId securityId, double longQuantity, double shortQuantity)
 {
     return(new SecurityPosition(positionInfo, securityId, longQuantity, shortQuantity));
 }
 /// <summary>
 /// Sets the identifier of the underlying security.
 /// <para>
 /// This identifier uniquely identifies the security within the system.
 /// </para>
 /// </summary>
 /// <param name="securityId">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder securityId(SecurityId securityId)
 {
     JodaBeanUtils.notNull(securityId, "securityId");
     this.securityId_Renamed = securityId;
     return(this);
 }
 /// <summary>
 /// Obtains an instance from the security identifier, long quantity and short quantity.
 /// <para>
 /// The long quantity and short quantity must be zero or positive, not negative.
 /// In many cases, only a long quantity or short quantity will be present with the other set to zero.
 /// However it is also possible for both to be non-zero, allowing long and short positions to be treated separately.
 ///
 /// </para>
 /// </summary>
 /// <param name="securityId">  the identifier of the underlying security </param>
 /// <param name="longQuantity">  the long quantity of the underlying security </param>
 /// <param name="shortQuantity">  the short quantity of the underlying security </param>
 /// <returns> the position </returns>
 public static SecurityPosition ofLongShort(SecurityId securityId, double longQuantity, double shortQuantity)
 {
     return(ofLongShort(PositionInfo.empty(), securityId, longQuantity, shortQuantity));
 }