alpacahq / alpaca-py

The Official Python SDK for Alpaca API
https://alpaca.markets/sdks/python/getting_started.html
Apache License 2.0
543 stars 135 forks source link

[Bug]: StockHistoricalDataClient ignores raw_data parameter #299

Closed Jark5455 closed 1 year ago

Jark5455 commented 1 year ago

Is there an existing issue for this?

Current Behavior

The following code should return a dictionary:

def _grab_latest_data(start: datetime, end: datetime, symbols: List[str]) -> Dict:
    client = StockHistoricalDataClient(os.environ['ALPACA_KEY'],  os.environ['ALPACA_SECRET'], raw_data=True)
    request = StockBarsRequest(symbol_or_symbols=symbols, start=start, end=end, timeframe=TimeFrame.Minute)
    results = client.get_stock_bars(request)
    return results

_grab_latest_data(datetime.now() - timedelta(hours=7), datetime.now(), ["AAPL"])

The code is returning an object the type of "BarSet"

Expected Behavior

The code should return a dictionary of the bars values.

SDK Version I encountered this issue in

alpaca-py version 0.8.2

Steps To Reproduce

1. Create a venv environment and install the package alpaca-py.
2. Set environment variables ALPACA_KEY and ALPACA_SECRET to your alpaca api key and alpaca api secret respectively.
3. Run the code segment, and check the type of the output

Filled out the Steps to Reproduce section?

Anything else?

No response

Jark5455 commented 1 year ago

Ahh, Did not notice the part in the docs where it says "has not been implemented yet"