123456789101112131415161718192021222324252627282930313233343536 |
- package response
- import (
- "encoding/xml"
- "log"
- )
- type Wallet struct {
- Currency string `xml:"currency"`
- Balance float64 `xml:"balance"`
- Freeze float64 `xml:"freeze"`
- }
- type AccountStateEvent struct {
- XMLName xml.Name `xml:"accountState"`
- AccountId int64 `xml:"accountId"`
- Balance float64 `xml:"balance"`
- Freeze float64 `xml:"freeze"`
- AvailableFunds float64 `xml:"availableFunds"`
- AvailableToWithdraw float64 `xml:"availableToWithdraw"`
- UnrealisedProfitAndLoss float64 `xml:"unrealisedProfitAndLoss"`
- Margin float64 `xml:"margin"`
- Wallets []Wallet `xml:"wallets>wallet"`
- Active bool `xml:"active"`
- Equity float64 `xml:"-"`
- }
- func NewAccountStateEvent(data string) *AccountStateEvent {
- r := AccountStateEvent{}
- err := xml.Unmarshal([]byte(data), &r)
- if err != nil {
- log.Println(err)
- return nil
- }
- return &r
- }
|