alpacahq / alpacahq/alpaca-py

[Bug]: `StockQuotesRequest` does not work for multiple symbols

Ouverte
#214 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Python
Étoiles
1.5k
Forks
398
Merge moyen
1 j 16 h
PR mergées (30 j)
6

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I'm trying to question `SPY` and `AAPL` the following way:
```
multisymbol_request_params = alp.data.requests.StockQuotesRequest(symbol_or_symbols=["AAPL", "SPY"],
start=timezone.localize(datetime.datetime.strptime("2022-12-02 10:59:00",
'%Y-%m-%d %H:%M:%S')),
end=timezone.localize(datetime.datetime.strptime("2022-12-02 11:01:00",
'%Y-%m-%d %H:%M:%S')),
limit=1)

multisymbol_quotes = stock_client.get_stock_quotes(multisymbol_request_params)
```

and I am getting
```
{ 'AAPL': [ { 'ask_exchange': 'Q',
'ask_price': 146.29,
'ask_size': 2.0,
'bid_exchange': 'Q',
'bid_price': 146.28,
'bid_size': 12.0,
'conditions': ['R'],
'symbol': 'AAPL',
'tape': 'C',
'timestamp': datetime.datetime(2022, 12, 2, 15, 59, 0, 17884, tzinfo=datetime.timezone.utc)}]}
```

### Expected Behavior

I would expect to get both of the tickers. Something like:

```
{ 'AAPL': [ { 'ask_exchange': 'Q',
'ask_price': 146.29,
'ask_size': 2.0,
'bid_exchange': 'Q',
'bid_price': 146.28,
'bid_size': 12.0,
'conditions': ['R'],
'symbol': 'AAPL',
'tape': 'C',
'timestamp': datetime.datetime(2022, 12, 2, 15, 59, 0, 17884, tzinfo=datetime.timezone.utc)}]
'SPY': [ { 'ask_exchange': 'P',
'ask_price': 404.24,
'ask_size': 3.0,
'bid_exchange': 'Z',
'bid_price': 404.23,
'bid_size': 1.0,
'conditions': ['R'],
'symbol': 'SPY',
'tape': 'B',
'timestamp': datetime.datetime(2022, 12, 2, 15, 59, 0, 7392, tzinfo=datetime.timezone.utc)}]
}
```

### SDK Version I encountered this issue in

alpaca-py version v0.6.0

### Steps To Reproduce

```markdown
Please see the above code snippets
```

### Filled out the Steps to Reproduce section?

- [X] I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

### Anything else?

_No response_

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.