Я хотел бы запустить этот GitHub Source. Я уже создал бумажный альпака api key_id и секретный ключ.
...
if __name__ == '__main__':
...
parser.add_argument(
'--key-id', type=str, default='PKZCNAMQV8VY7ME04TLK',
help='API key ID',
)
parser.add_argument(
'--secret-key', type=str, default='/Qe8LfRa8Q1749qLFQRR2o/clnyW46sGLbdpMNYp',
help='API secret key',
)
parser.add_argument(
'--base-url', type=str, default='https://paper-api.alpaca.markets',
help='set https://paper-api.alpaca.markets if paper trading',
)
args = parser.parse_args()
assert args.quantity >= 100
run(args)
...
Проблема выглядит следующим образом.
WARNING:root:code = 1000 (OK), no reason
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending coro=<StreamConn._ensure_ws() running at C:\ProgramData\Anaconda3\lib\site-packages\alpaca_trade_api\stream2.py:87>>
C:\ProgramData\Anaconda3\lib\asyncio\base_events.py:604: RuntimeWarning: coroutine 'StreamConn._ensure_ws' was never awaited
self._ready.clear()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File ".\tick_taker.py", line 265, in <module>
run(args)
File ".\tick_taker.py", line 236, in run
['trade_updates', tc, qc]
File "C:\ProgramData\Anaconda3\lib\site-packages\alpaca_trade_api\stream2.py", line 159, in run
loop.run_until_complete(self.subscribe(initial_channels))
File "C:\ProgramData\Anaconda3\lib\asyncio\base_events.py", line 579, in run_until_complete
return future.result()
File "C:\ProgramData\Anaconda3\lib\site-packages\alpaca_trade_api\stream2.py", line 128, in subscribe
await self._ensure_polygon()
File "C:\ProgramData\Anaconda3\lib\site-packages\alpaca_trade_api\stream2.py", line 85, in _ensure_polygon
await self.polygon.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\alpaca_trade_api\polygon\streamconn.py", line 44, in connect
if await self.authenticate():
File "C:\ProgramData\Anaconda3\lib\site-packages\alpaca_trade_api\polygon\streamconn.py", line 70, in authenticate
raise ValueError('Invalid Polygon credentials, '
ValueError: Invalid Polygon credentials, Failed to authenticate: {'ev': 'status', 'status': 'auth_failed', 'message': 'authentication failed'}
Я думаю, что проблема связана с env, но я не уверен. Любая помощь приветствуется.