|
1 | | -import deprecation |
2 | 1 | import logging |
3 | 2 | import os |
4 | 3 | from typing import Iterator, List, Optional, Union |
|
15 | 14 | ) |
16 | 15 | from .entity import ( |
17 | 16 | Bar, Entity, Account, AccountConfigurations, AccountActivity, |
18 | | - Asset, Order, Position, BarSet, Clock, Calendar, |
19 | | - Aggs, Trade, Quote, Watchlist, PortfolioHistory |
| 17 | + Asset, Order, Position, Clock, Calendar, |
| 18 | + Trade, Quote, Watchlist, PortfolioHistory |
20 | 19 | ) |
21 | 20 | from .entity_v2 import ( |
22 | 21 | BarV2, BarsV2, LatestBarsV2, LatestQuotesV2, LatestTradesV2, |
@@ -542,92 +541,6 @@ def get_asset(self, symbol: str) -> Asset: |
542 | 541 | resp = self.get('/assets/{}'.format(symbol)) |
543 | 542 | return self.response_wrapper(resp, Asset) |
544 | 543 |
|
545 | | - @deprecation.deprecated(deprecated_in="v1.0.0", |
546 | | - details="Use get_bars instead") |
547 | | - def get_barset(self, |
548 | | - symbols, |
549 | | - timeframe: str, |
550 | | - limit: int = None, |
551 | | - start: str = None, |
552 | | - end: str = None, |
553 | | - after: str = None, |
554 | | - until: str = None) -> BarSet: |
555 | | - """ |
556 | | - read the documentation here: |
557 | | - https://alpaca.markets/docs/api-documentation/api-v2/market-data/bars/ |
558 | | - Get BarSet(dict[str]->list[Bar]) |
559 | | - :param symbols: The parameter symbols can be either a comma-split |
560 | | - string or a list of string. Each symbol becomes the key of the |
561 | | - returned value. |
562 | | - :param timeframe: One of minute, 1Min, 5Min, 15Min, day or 1D. minute |
563 | | - is an alias of 1Min. Similarly, day is of 1D. |
564 | | - :param limit: The maximum number of bars per symbol. It can be between |
565 | | - 1 and 1000. Default is 100. |
566 | | - :param start: ISO Format str, ex: '2019-04-15T09:30:00-04:00' or |
567 | | - '2019-04-15' |
568 | | - :param end: ISO Format str |
569 | | - :param after: ISO Format str |
570 | | - :param until: ISO Format str |
571 | | - :return: BarSet |
572 | | -
|
573 | | - note: start can't be used with after. end cannot be used with until. |
574 | | - """ |
575 | | - if not isinstance(symbols, str): |
576 | | - symbols = ','.join(symbols) |
577 | | - params = { |
578 | | - 'symbols': symbols, |
579 | | - } |
580 | | - if limit is not None: |
581 | | - params['limit'] = limit |
582 | | - if start is not None: |
583 | | - params['start'] = start |
584 | | - if end is not None: |
585 | | - params['end'] = end |
586 | | - if after is not None: |
587 | | - params['after'] = after |
588 | | - if until is not None: |
589 | | - params['until'] = until |
590 | | - resp = self.data_get('/bars/{}'.format(timeframe), params) |
591 | | - return self.response_wrapper(resp, BarSet) |
592 | | - |
593 | | - @deprecation.deprecated(deprecated_in="v1.0.0", |
594 | | - details="Use get_bars instead") |
595 | | - def get_aggs(self, |
596 | | - symbol: str, |
597 | | - multiplier: int, |
598 | | - timespan: str, |
599 | | - _from: str, |
600 | | - to: str) -> Aggs: |
601 | | - """ |
602 | | -
|
603 | | - :param symbol: str eg AAPL |
604 | | - :param multiplier: must be 1 |
605 | | - :param timespan: day or minute |
606 | | - :param _from: yyyy-mm-dd |
607 | | - :param to: yyyy-mm-dd |
608 | | - :return: |
609 | | - """ |
610 | | - resp = self.data_get('/aggs/ticker/{}/range/{}/{}/{}/{}'.format( |
611 | | - symbol, multiplier, timespan, _from, to |
612 | | - )) |
613 | | - return self.response_wrapper(resp, Aggs) |
614 | | - |
615 | | - @deprecation.deprecated(deprecated_in="v1.0.0", |
616 | | - details="Use get_latest_trade instead") |
617 | | - def get_last_trade(self, symbol: str) -> Trade: |
618 | | - """ |
619 | | - Get the last trade for the given symbol |
620 | | - """ |
621 | | - resp = self.data_get('/last/stocks/{}'.format(symbol)) |
622 | | - return self.response_wrapper(resp['last'], Trade) |
623 | | - |
624 | | - @deprecation.deprecated(deprecated_in="v1.0.0", |
625 | | - details="Use get_latest_quote instead") |
626 | | - def get_last_quote(self, symbol: str) -> Quote: |
627 | | - """Get the last quote for the given symbol""" |
628 | | - resp = self.data_get('/last_quote/stocks/{}'.format(symbol)) |
629 | | - return self.response_wrapper(resp['last'], Quote) |
630 | | - |
631 | 544 | def _data_get(self, |
632 | 545 | endpoint: str, |
633 | 546 | symbol_or_symbols: Union[str, List[str]], |
|
0 commit comments