How to trade within portfolios - coinbase-advanced-py

I had originally used coinbase pro and its api to run trading algorithms in separate portfolios to monitor performance and prevent access from funds that they should not have for security reasons.

I have followed the documentation and created another portfolio using the api.

Also, I have been able to successfully get account and portfolio information and perform a trade using the api in my default portfolio.

However, even with an api key created for my 2nd portfolio, I keep getting an error “requests.exceptions.HTTPError: 403 Client Error: Forbidden {“error”:“PERMISSION_DENIED”,“error_details”:“Target Account Not Tradable”,“message”:“Target Account Not Tradable”}”

The code I am running is:
client = RESTClient(key_file=“coinbase_cloud_api_key.json”)

I have all 3 permissions set in coinbase cloud for the api key. Is there something else I need to do?
I just want to be able to complete simple buy and sell orders between BTC and USD in separate portfolios like I did on coinbase pro without having to give access to my whole balance to my algorithms.

If your API key is for a portfolio != Default, I think you have to manually set your portfolio as part of the “retail_portfolio_id” arg in the payload.

1 Like

I just tested that and indeed portfolio id is required, otherwise mentioned error is returned.

I would call that a bug! Cloud API key is created for portfolio, so system should know correct portfolio automatically.

Hey @TreyGallun @muktupavels! Thank you for sharing this with us. Can you please let us know if you are still facing this issue?

@Loop_11 Was there changes that makes you believe that this should be fixed? Perhaps we should get paid for finding and/re-verifying bugs!?

But to answer your question - yes it is still issue.

Using other portfolio key without specifying retail_portfolio_id fails to create order / returns mentioned error. This can be worked around by specifying retail_portfolio_id, but as cloud key is associated with portfolio it should happen automatically.