Comments (6)
Thank you for all your help! The solution was very simple. I realized the curl function did not have to be used with python. Then all I had to do was add the url to the paper trading account.
api = tradeapi.REST('PK53RZXVSO70ZWANC27Q', 'TOCuoIpJdxPCDi1txOStLsxW4DpdBMm4N3kkdAv7' , 'https://paper-api.alpaca.markets')
from alpaca-trade-api-python.
Your curl example is pointing to paper-api while your python example is to live trading. You can give https://paper-apip.alpaca.markets/
to the third argument of REST()
from alpaca-trade-api-python.
The code looks fine so it's likely the key you are specifying might be wrong.
You can check the actual HTTP header by adding this before the code.
import logging
# You must initialize logging, otherwise you'll not see debug output.
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
from alpaca-trade-api-python.
I'm experiencing a similar issue. Yesterday I was able to generate a key and get this working after trading hours. This morning, I tried using the same key from yesterday and I'm getting:
alpaca_trade_api.rest.APIError: access key verification failed : request is unauthorized (generate APCA-API-KEY-ID and APCA-API-ACCESS-SECRET-KEY from dashboard and include in HTTP header) (Code = 40110000) (Code = 40110000)
I generated a new key, and I was able to get passed this error.
from alpaca-trade-api-python.
Still will not work.
I ran this curl function:
curl -X GET -H "APCA-API-KEY-ID: AKYDIJYFTXUS153CS26T" -H "APCA-API-SECRET-KEY: ZGjtbpBRJV8FfayZNXKkACOYR9/ZAmmszD6nBFch" https://paper-api.alpaca.markets/v1/account
This was the response:
I then run this in Spyder Python.
import sys
sys.version
import alpaca_trade_api as tradeapi
api = tradeapi.REST('AKYDIJYFTXUS153CS26T', 'ZGjtbpBRJV8FfayZNXKkACOYR9/ZAmmszD6nBFch')
account = api.get_account()
account.status
I tried the debug function.
I am not sure what I am missing, but I am missing something.
Do you have any recommendations or anything else I can try?
from alpaca-trade-api-python.
Your curl example is pointing to paper-api while your python example is to live trading. You can give
https://paper-apip.alpaca.markets/
to the third argument ofREST()
https://paper-api.alpaca.markets/
without typo
from alpaca-trade-api-python.
Related Issues (20)
- [Bug]: "TypeError: string indices must be integers" with incoming error messages HOT 1
- asyncio.run() RuntimeError following ReadMe example HOT 1
- Indentation of await self._consume() in stream.py
- [Bug]: data_get() still uses v1
- Move TimeFrame Units To Class Definition
- [Bug]: Status pending_cancel does not exist HOT 1
- [Bug]: OTO take profit bypass the PDT Protection HOT 1
- [Bug]: List orders in rest.py not returning all orders HOT 1
- [Bug]:
- [Bug]: asyncio.run() cannot be called from a running event loop HOT 2
- [Bug]:can't install alpaca-trade-api-python HOT 1
- [Bug]: Fails to install with Python 3.11 due to `aiohttp==3.8.1` dependency HOT 8
- [Bug]: Cannot fill order for a short sale with a trailing stop
- [Bug]: Unable to retrieve any bars. HOT 2
- [Bug]: martingale : self.last_price rounding issue
- [Bug]: Installation error: command '/usr/bin/clang' failed with exit code 1 on macOS Ventura 13.3.1 and Python 3.11.3 and Python 3.10.11 HOT 4
- [Bug]: Get Open Position Error for Crypto Holdings HOT 1
- [Question]: history per minutes
- [Bug]: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)
- Please use a billing/subscription-related exception type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alpaca-trade-api-python.