12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package sentio
- type Position interface {
- // GetSize returns the total size of the position
- GetSize() float64
- // GetAvgPrice returns the average cost of each share in the position when purchased
- GetAvgPrice() float64
- // GetSymbol returns the ticker symbol of the traded contract
- GetSymbol() string
- // GetPnL returns unrealized profit/loss in dollars
- GetPnL() float64
- // GetCurrentPrice returns current asset price per share
- GetCurrentPrice() float64
- }
- type PositionStub struct {
- Symbol string
- Size float64
- Price float64
- PnL float64
- Current float64
- }
- func (p PositionStub) GetSize() float64 {
- return p.Size
- }
- func (p PositionStub) GetAvgPrice() float64 {
- return p.Price
- }
- func (p PositionStub) GetSymbol() string {
- return p.Symbol
- }
- func (p PositionStub) GetPnL() float64 {
- return p.PnL
- }
- func (p PositionStub) GetCurrentPrice() float64 {
- return p.Current
- }
|