Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function rest.SetCollateral post use a wrong permission #234

Open
1 task
TraderWithPython opened this issue Sep 15, 2021 · 0 comments
Open
1 task

Comments

@TraderWithPython
Copy link

Issue type

  • bug

Brief description

In the function rest.SetCollateral,

func (s *WalletService) SetCollateral(symbol string, amount float64) (bool, error) {
	urlPath := path.Join("deriv", "collateral", "set")
	data := map[string]interface{}{
		"symbol":     symbol,
		"collateral": amount,
	}
	req, err := s.requestFactory.NewAuthenticatedRequestWithData(common.PermissionRead, urlPath, data)
	if err != nil {
		return false, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return false, err
	}
	// [[1]] == success, [] || [[0]] == false
	if len(raw) <= 0 {
		return false, nil
	}
	item := raw[0].([]interface{})
	// [1] == success, [] || [0] == false
	if len(item) > 0 && item[0].(int) == 1 {
		return true, nil
	}
	return false, nil
}

it use common.PermissionRead commission. But the api is Ithttps://api.bitfinex.com/v2/auth/w/deriv/collateral/set.
It lead to an error. Hope you can fix it. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@TraderWithPython and others