alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
143 stars 13 forks source link

Can't fetch price data with get_barset using new v2 api #77

Closed fightthepower closed 5 years ago

fightthepower commented 5 years ago

I am using alpaca for paper trading and can't fetch price data using get_barset in v2 api (works in v1). Getting this error.

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://data.alpaca.markets/v2/bars/1D?symbols=AAPL&limit=1

Can we do short trading with v2 api in paper trading account?

api = tradeapi.REST(
    key_id=api_key,
    secret_key=secret,
    api_version='v2',
    base_url='https://paper-api.alpaca.markets'
)

api.get_barset('AAPL','1D',limit=1)
bdowling commented 5 years ago

The data API still uses the v1 label at this time, sorry for any confusion. If you are using the python SDK, you may need to upgrade it as an earlier release did try to use v2 by mistake for data.alpaca.markets.