github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/v1/account.go (about) 1 package bitfinex 2 3 type AccountService struct { 4 client *Client 5 } 6 7 type AccountPairFee struct { 8 Pair string 9 MakerFees float64 `json:"maker_fees,string"` 10 TakerFees float64 `json:"taker_fees,string"` 11 } 12 13 type AccountInfo struct { 14 MakerFees float64 `json:"maker_fees,string"` 15 TakerFees float64 `json:"taker_fees,string"` 16 Fees []AccountPairFee 17 } 18 19 // GET account_infos 20 func (a *AccountService) Info() (AccountInfo, error) { 21 req, err := a.client.newAuthenticatedRequest("GET", "account_infos", nil) 22 23 if err != nil { 24 return AccountInfo{}, err 25 } 26 27 var v []AccountInfo 28 _, err = a.client.do(req, &v) 29 30 if err != nil { 31 return AccountInfo{}, err 32 } 33 34 return v[0], nil 35 } 36 37 type KeyPerm struct { 38 Read bool 39 Write bool 40 } 41 42 type Permissions struct { 43 Account KeyPerm 44 History KeyPerm 45 Orders KeyPerm 46 Positions KeyPerm 47 Funding KeyPerm 48 Wallets KeyPerm 49 Withdraw KeyPerm 50 } 51 52 func (a *AccountService) KeyPermission() (Permissions, error) { 53 req, err := a.client.newAuthenticatedRequest("GET", "key_info", nil) 54 55 if err != nil { 56 return Permissions{}, err 57 } 58 59 var v Permissions 60 _, err = a.client.do(req, &v) 61 if err != nil { 62 return Permissions{}, err 63 } 64 return v, nil 65 } 66 67 type SummaryVolume struct { 68 Currency string `json:"curr"` 69 Volume string `json:"vol"` 70 } 71 type SummaryProfit struct { 72 Currency string `json:"curr"` 73 Volume string `json:"amount"` 74 } 75 type Summary struct { 76 TradeVolume SummaryVolume `json:"trade_vol_30d"` 77 FundingProfit SummaryProfit `json:"funding_profit_30d"` 78 MakerFee string `json:"maker_fee"` 79 TakerFee string `json:"taker_fee"` 80 } 81 82 func (a *AccountService) Summary() (Summary, error) { 83 req, err := a.client.newAuthenticatedRequest("GET", "summary", nil) 84 85 if err != nil { 86 return Summary{}, err 87 } 88 89 var v Summary 90 _, err = a.client.do(req, &v) 91 if err != nil { 92 return Summary{}, err 93 } 94 return v, nil 95 }