module Position: sig
.. end
type
t = private {
}
val account_code : t -> Account_code.t
val realized_pnl : t -> Price.t
val unrealized_pnl : t -> Price.t
val average_cost : t -> Price.t
val market_value : t -> Price.t
val market_price : t -> Price.t
val size : t -> Volume.t
val contract : t -> [< Security_type.t ] Contract.t
module Fields: sig
.. end
include Response_intf.S
val create : contract:[< Security_type.t ] Contract.t ->
size:Volume.t ->
market_price:Price.t ->
market_value:Price.t ->
average_cost:Price.t ->
unrealized_pnl:Price.t ->
realized_pnl:Price.t -> account_code:Account_code.t -> t
val contract : t -> [< Security_type.t ] Contract.t
val total_pnl : t -> Price.t
val return : t -> float
return position
calculates the return of a portfolio position
, ie
sign(position) * (market_value / (average_cost * position) - 1)
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
return position
calculates the return of a portfolio position
, ie
sign(position) * (market_value / (average_cost * position) - 1)