example-scalping
example-scalping copied to clipboard
status:active but still "Failed to authneticate"
I really like your scalping strategy and Python implementation!
I have a live account and a paper account, and regularly work with Polygon. However, when I try to run your code with my paper account, I get the following error:
c:\users\gil\envs\utils\lib\site-packages\alpaca_trade_api\stream2.py in _connect(self)
44 status = msg.get('data').get('status')
45 if status != 'authorized':
---> 46 raise ValueError(
47 (f"Invalid Alpaca API credentials, Failed to "
48 f"authenticate: {msg}")
ValueError: Invalid Alpaca API credentials, Failed to authenticate: {'stream': 'authorization', 'data': {'action': 'authenticate', 'message': 'access key verification failed', 'status': 'unauthorized'}}
-- this is despite the fact my account is active:
ipdb> api.get_account()
Account({ 'account_blocked': False,
'account_number': 'PA28K7UTZQSB',
'buying_power': '160000',
'cash': '40000',
'created_at': '2020-12-23T01:29:09.496085Z',
'currency': 'USD',
'daytrade_count': 0,
'daytrading_buying_power': '160000',
'equity': '40000',
'id': 'e3d0cd29-078a-484e-856b-6819912ca25d',
'initial_margin': '0',
'last_equity': '40000',
'last_maintenance_margin': '0',
'long_market_value': '0',
'maintenance_margin': '0',
'multiplier': '4',
'pattern_day_trader': False,
'portfolio_value': '40000',
'regt_buying_power': '80000',
'short_market_value': '0',
'shorting_enabled': True,
'sma': '0',
'status': 'ACTIVE',
'trade_suspended_by_user': False,
'trading_blocked': False,
'transfers_blocked': False})
Can you please advise?
Thanks, Gil