Hey guys, I am trying to get this boilerplate code working at the very least. I did pip install alpaca-py
, it ran fine, and even when I pip show alpaca-py
it will show version 0.8.1 and the rest is:
Name: alpaca-py
Version: 0.8.1
Summary: The Official Python SDK for Alpaca APIs
Home-page: https://github.com/alpacahq/alpaca-py
Author: Rahul Chowdhury
Author-email: rahul.chowdhury@alpaca.markets
License: Apache-2.0
Location: /Users/kushshah/opt/anaconda3/lib/python3.9/site-packages
Requires: msgpack, pandas, pydantic, requests, sseclient-py, websockets
Required-by:
My boilerplate code to start with is:
from alpaca.data.historical import CryptoHistoricalDataClient
from alpaca.data.requests import CryptoBarsRequest
from alpaca.data.timeframe import TimeFrame
from datetime import datetime
# no keys required for crypto data
client = CryptoHistoricalDataClient()
request_params = CryptoBarsRequest(
symbol_or_symbols=["BTC/USD", "ETH/USD"],
timeframe=TimeFrame.Day,
start=datetime(2022, 7, 1)
)
bars = client.get_crypto_bars(request_params)
I have it in my alpaca.py file and when I run python alpaca.py
I get the following error message, what gives?
(base) Me@My-MacBook-Pro robin % python alpaca.py
Traceback (most recent call last):
File "/Users/Me/source/repos/robin/alpaca.py", line 1, in <module>
from alpaca.data.historical import CryptoHistoricalDataClient
File "/Users/Me/source/repos/robin/alpaca.py", line 1, in <module>
from alpaca.data.historical import CryptoHistoricalDataClient
ModuleNotFoundError: No module named 'alpaca.data'; 'alpaca' is not a package