response = trading_client.get('/accounts/{}/transfers'.format(get_account(user_account).id))
File "/opt/anaconda3/lib/python3.9/site-packages/alpaca_trade_api/rest.py", line 250, in get
return self._request('GET', path, data)
File "/opt/anaconda3/lib/python3.9/site-packages/alpaca_trade_api/rest.py", line 213, in _request
return self._one_request(method, url, opts, retry)
File "/opt/anaconda3/lib/python3.9/site-packages/alpaca_trade_api/rest.py", line 242, in _one_request
raise APIError(error, http_error)
alpaca_trade_api.rest.APIError: insufficient permission
Same key and secret key I can use in tradeapi, is there any difference between trade api and broker api? Or do I miss anything here? Thank you for your help!
@crispan First off welcome to Alpaca! I’ll start with your question "is there any difference between trade api and broker api?". The two API sets are different and address two separate users.
The Trading APIs allow one to check account balances, fetch positions, submit orders etc, all for ones own trading account. One cannot create an account or move funds. It’s intended for traders who want to automate their trading. Use of the Trading APIs is completely free.
The Broker APIs allow one to create new accounts and move money between accounts as well as trade those accounts. It’s intended for Brokers or Registered Investment Advisors (RIAs) who are managing other users accounts. Use of the Broker APIs (outside of the sandbox) requires a paid subscription.
The two APIs use separate API keys. The Trading APIs use the API keys found in your Alpaca account dashboard as shown below. Note there are separate keys for your paper account and for your live account.
The Broker keys are generated in the Broker dashboard. There is also a subtle difference in how those keys are used to authenticate. The Trading APIs authenticate each API call by placing the key and secret key into the call’s header information. The Broker APIs authenticate using “Basic Auth” by using the key and secret key as the username and password respectively.