position.go 711 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package sentio
  2. type Position interface {
  3. // GetSize returns the total size of the position
  4. GetSize() float64
  5. // GetAvgPrice returns the average cost of each share in the position when purchased
  6. GetAvgPrice() float64
  7. // GetSymbol returns the ticker symbol of the traded contract
  8. GetSymbol() string
  9. // GetPnL unrealized profit/loss in dollars
  10. GetPnL() float64
  11. }
  12. type PositionStub struct {
  13. Symbol string
  14. Size float64
  15. Price float64
  16. PnL float64
  17. }
  18. func (p PositionStub) GetSize() float64 {
  19. return p.Size
  20. }
  21. func (p PositionStub) GetAvgPrice() float64 {
  22. return p.Price
  23. }
  24. func (p PositionStub) GetSymbol() string {
  25. return p.Symbol
  26. }
  27. func (p PositionStub) GetPnL() float64 {
  28. return p.PnL
  29. }