Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions massive/rest/aggs.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ def get_previous_close_agg(
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
options: Optional[RequestOptionBuilder] = None,
) -> Union[PreviousCloseAgg, HTTPResponse]:
) -> Union[List[PreviousCloseAgg], HTTPResponse]:
"""
Get the previous day's open, high, low, and close (OHLC) for the specified stock ticker.

:param ticker: The ticker symbol of the stock/equity.
:param adjusted: Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.
:param params: Any additional query params
:param raw: Return raw object instead of results object
:return: Previous close aggregate
:return: List of previous close aggregates (the API returns a one-element list)
"""
url = f"/v2/aggs/ticker/{ticker}/prev"

Expand Down
4 changes: 2 additions & 2 deletions massive/rest/economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def list_treasury_yields(
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
options: Optional[RequestOptionBuilder] = None,
) -> Union[List[TreasuryYield], HTTPResponse]:
) -> Union[Iterator[TreasuryYield], HTTPResponse]:
"""
Retrieve treasury yield data.

Expand All @@ -51,7 +51,7 @@ def list_treasury_yields(
:param params: Additional query parameters.
:param raw: Return raw HTTPResponse object if True, else return List[TreasuryYield].
:param options: RequestOptionBuilder for additional headers or params.
:return: A list of TreasuryYield objects or HTTPResponse if raw=True.
:return: An iterator of TreasuryYield objects or HTTPResponse if raw=True.
"""
url = "/fed/v1/treasury-yields"

Expand Down
12 changes: 6 additions & 6 deletions massive/rest/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def list_tickers(
type: Optional[str] = None,
market: Optional[str] = None,
exchange: Optional[str] = None,
cusip: Optional[int] = None,
cusip: Optional[Union[int, str]] = None,
cik: Optional[int] = None,
date: Optional[str] = None,
active: Optional[bool] = None,
Expand All @@ -115,7 +115,7 @@ def list_tickers(
:param type: Specify the type of the tickers. Find the types that we support via our Ticker Types API. Defaults to empty string which queries all types.
:param market: Filter by market type. By default all markets are included.
:param exchange: Specify the assets primary exchange Market Identifier Code (MIC) according to ISO 10383. Defaults to empty string which queries all exchanges.
:param cusip: Specify the CUSIP code of the asset you want to search for. Find more information about CUSIP codes at their website. Defaults to empty string which queries all CUSIPs.
:param cusip: Specify the CUSIP code of the asset you want to search for. The API treats a CUSIP as a string, so pass a string such as "037833100": an int drops leading zeros and cannot hold the letters some CUSIPs contain. An int is still accepted for backward compatibility. Find more information about CUSIP codes at their website. Defaults to empty string which queries all CUSIPs.
:param cik: Specify the CIK of the asset you want to search for. Find more information about CIK codes at their website. Defaults to empty string which queries all CIKs.
:param date: Specify a point in time to retrieve tickers available on that date. Defaults to the most recent available date.
:param search: Search for terms within the ticker and/or company name.
Expand Down Expand Up @@ -606,7 +606,7 @@ def list_short_interest(
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
options: Optional[RequestOptionBuilder] = None,
) -> Union[List[ShortInterest], HTTPResponse]:
) -> Union[Iterator[ShortInterest], HTTPResponse]:
"""
Retrieve short interest data for stocks.

Expand All @@ -632,7 +632,7 @@ def list_short_interest(
:param params: Additional query parameters.
:param raw: Return raw HTTPResponse object if True, else return List[ShortInterest].
:param options: RequestOptionBuilder for additional headers or params.
:return: A list of ShortInterest objects or HTTPResponse if raw=True.
:return: An iterator of ShortInterest objects or HTTPResponse if raw=True.
"""
url = "/stocks/v1/short-interest"

Expand Down Expand Up @@ -669,7 +669,7 @@ def list_short_volume(
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
options: Optional[RequestOptionBuilder] = None,
) -> Union[List[ShortVolume], HTTPResponse]:
) -> Union[Iterator[ShortVolume], HTTPResponse]:
"""
Retrieve short volume data for stocks.

Expand All @@ -695,7 +695,7 @@ def list_short_volume(
:param params: Additional query parameters.
:param raw: Return raw HTTPResponse object if True, else return List[ShortVolume].
:param options: RequestOptionBuilder for additional headers or params.
:return: A list of ShortVolume objects or HTTPResponse if raw=True.
:return: An iterator of ShortVolume objects or HTTPResponse if raw=True.
"""
url = "/stocks/v1/short-volume"

Expand Down
4 changes: 2 additions & 2 deletions massive/rest/vX.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def list_ipos(
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
options: Optional[RequestOptionBuilder] = None,
) -> Union[List[IPOListing], HTTPResponse]:
) -> Union[Iterator[IPOListing], HTTPResponse]:
"""
Retrieve upcoming or historical IPOs.

Expand All @@ -108,7 +108,7 @@ def list_ipos(
:param params: Additional query params.
:param raw: Return raw HTTPResponse object if True, else return List[IPOListing].
:param options: RequestOptionBuilder for additional headers or params.
:return: A list of IPOListing objects or HTTPResponse if raw=True.
:return: An iterator of IPOListing objects or HTTPResponse if raw=True.
"""
url = "/vX/reference/ipos"

Expand Down
8 changes: 4 additions & 4 deletions massive/websocket/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ class CryptoQuote:

event_type: Optional[Union[str, EventType]] = None
pair: Optional[str] = None
bid_price: Optional[int] = None
bid_price: Optional[float] = None
bid_size: Optional[float] = None
ask_price: Optional[int] = None
ask_size: Optional[int] = None
ask_price: Optional[float] = None
ask_size: Optional[float] = None
timestamp: Optional[float] = None
exchange_id: Optional[int] = None
received_timestamp: Optional[int] = None
Expand Down Expand Up @@ -328,7 +328,7 @@ class IndexValue:
event_type: Optional[Union[str, EventType]] = None
value: Optional[float] = None
ticker: Optional[str] = None
timestamp: Optional[str] = None
timestamp: Optional[int] = None

@staticmethod
def from_dict(d):
Expand Down
1 change: 1 addition & 0 deletions test_rest/test_aggs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def test_get_daily_open_close_agg(self):

def test_get_previous_close_agg(self):
aggs = self.c.get_previous_close_agg("AAPL")
self.assertIsInstance(aggs, list)
expected = [
PreviousCloseAgg(
ticker="AAPL",
Expand Down
15 changes: 15 additions & 0 deletions test_rest/test_pagination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import types

from base import BaseTest


class PaginationTest(BaseTest):
def test_list_methods_return_iterators(self):
# The iterators are lazy, so no request is sent.
for result in (
self.c.list_treasury_yields(),
self.c.list_short_interest(),
self.c.list_short_volume(),
self.c.vx.list_ipos(),
):
self.assertIsInstance(result, types.GeneratorType)
Loading