Browse Source

Position

- add GetPnL()
Alexey Kim 6 months ago
parent
commit
1933cc24c0
1 changed files with 8 additions and 0 deletions
  1. 8 0
      position.go

+ 8 - 0
position.go

@@ -9,12 +9,16 @@ type Position interface {
 
 	// GetSymbol returns the ticker symbol of the traded contract
 	GetSymbol() string
+
+	// GetPnL unrealized profit/loss in dollars
+	GetPnL() float64
 }
 
 type PositionStub struct {
 	Symbol string
 	Size   float64
 	Price  float64
+	PnL    float64
 }
 
 func (p PositionStub) GetSize() float64 {
@@ -28,3 +32,7 @@ func (p PositionStub) GetAvgPrice() float64 {
 func (p PositionStub) GetSymbol() string {
 	return p.Symbol
 }
+
+func (p PositionStub) GetPnL() float64 {
+	return p.PnL
+}