github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/v1/margin_info.go (about) 1 package bitfinex 2 3 type MarginInfoService struct { 4 client *Client 5 } 6 7 type MarginInfo struct { 8 MarginBalance float64 `json:"margin_balance,string"` 9 TradableBalance float64 `json:"tradable_balance,string"` 10 UnrealizedPl float64 `json:"unrealized_pl,string"` 11 UnrealizedSwap float64 `json:"unrealized_swap,string"` 12 NetValue float64 `json:"net_value,string"` 13 RequiredMargin float64 `json:"required_margin,string"` 14 Leverage float64 `json:"leverage,string"` 15 MarginRequirement float64 `json:"margin_requirement,string"` 16 MarginLimits []MarginLimit `json:"margin_limits,string"` 17 Message string `json:"message"` 18 } 19 20 type MarginLimit struct { 21 OnPair string `json:"on_pair"` 22 InitialMargin float64 `json:"initial_margin,string"` 23 MarginRequirement float64 `json:"margin_requirement,string"` 24 TradableBalance float64 `json:"tradable_balance,string"` 25 } 26 27 // GET /margin_infos 28 func (s *MarginInfoService) All() ([]MarginInfo, error) { 29 req, err := s.client.newAuthenticatedRequest("GET", "margin_infos", nil) 30 if err != nil { 31 return nil, err 32 } 33 34 var v []MarginInfo 35 _, err = s.client.do(req, &v) 36 37 return v, err 38 }