package response import ( "encoding/xml" ) type PositionEvent struct { XMLName xml.Name `xml:"position"` AccountId int64 `xml:"accountId"` InstrumentId int64 `xml:"instrumentId"` Valuation float64 `xml:"valuation"` ShortUnfilledQuantity float64 `xml:"shortUnfilledQuantity"` LongUnfilledQuantity float64 `xml:"longUnfilledQuantity"` ShortUnfilledCost float64 `xml:"shortUnfilledCost"` LongUnfilledCost float64 `xml:"longUnfilledCost"` OpenQuantity float64 `xml:"openQuantity"` CumulativeCost float64 `xml:"cumulativeCost"` OpenCost float64 `xml:"openCost"` Margin float64 `xml:"-"` Profit float64 `xml:"-"` CurPrice float64 `xml:"-"` OpenPrice float64 `xml:"-"` Currency string `xml:"-"` ExchangeRate *ExchangeRateEvent `xml:"-"` } type Positions struct { XMLName xml.Name `xml:"positions"` Data []*PositionEvent `xml:"page>order"` HasMoreResults bool `xml:"hasMoreResults"` CorrelationId int64 `xml:"correlationId"` } /* 1334343885 4001 -57.895 0 0 1 12996.7 12996.7 */ func NewPositionEvent(data string) *PositionEvent { r := PositionEvent{} err := xml.Unmarshal([]byte(data), &r) if err != nil { return nil } return &r }