Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
24 changes: 18 additions & 6 deletions 24 polygon/rest/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,23 @@ def forex_currencies_last_quote_for_a_currency_pair(self, from_, to,
**query_params) -> models.ForexCurrenciesLastQuoteForACurrencyPairApiResponse:
endpoint = f"{self.url}/v1/last_quote/currencies/{from_}/{to}"
return self._handle_response("ForexCurrenciesLastQuoteForACurrencyPairApiResponse", endpoint, query_params)

def forex_currencies_grouped_daily(self, date, **query_params) -> models.ForexCurrenciesGroupedDailyApiResponse:
endpoint = f"{self.url}/v2/aggs/grouped/locale/global/market/fx/{date}"
return self._handle_response("ForexCurrenciesGroupedDailyApiResponse", endpoint, query_params)

# FIXME: add daily open/close
# FIXME: add grouped daily bars
# FIXME: add previous close
# FIXME: add snapshot for single ticker
def forex_currencies_previous_close(self, ticker, **query_params) -> models.ForexCurrenciesGroupedDailyApiResponse:
endpoint = f"{self.url}/v2/aggs/ticker/{ticker}/prev"
return self._handle_response("ForexCurrenciesPreviousCloseApiResponse", endpoint, query_params)

def forex_currencies_snapshot_all_tickers(self,
**query_params) -> models.ForexCurrenciesSnapshotAllTickersApiResponse:
endpoint = f"{self.url}/v2/snapshot/locale/global/markets/forex/tickers"
return self._handle_response("ForexCurrenciesSnapshotAllTickersApiResponse", endpoint, query_params)

def forex_currencies_snapshot_single_ticker(self, ticker, **query_params) -> models.ForexCurrenciesSnapshotSingleTickerApiResponse:
endpoint = f"{self.url}/v2/snapshot/locale/global/markets/forex/tickers/{ticker}"
return self._handle_response("ForexCurrenciesSnapshotSingleTickerApiResponse", endpoint, query_params)

def forex_currencies_snapshot_gainers_losers(self, direction,
**query_params) -> models.ForexCurrenciesSnapshotGainersLosersApiResponse:
Expand Down Expand Up @@ -219,8 +226,13 @@ def crypto_historic_crypto_trades(self, from_, to, date,
endpoint = f"{self.url}/v1/historic/crypto/{from_}/{to}/{date}"
return self._handle_response("CryptoHistoricCryptoTradesApiResponse", endpoint, query_params)

# FIXME: add grouped daily bars
# FIXME: add previous close
def crypto_grouped_daily(self, date, **query_params) -> models.CryptoGroupedDailyApiResponse:
endpoint = f"{self.url}/v2/aggs/grouped/locale/global/market/crypto/{date}"
return self._handle_response("CryptoGroupedDailyApiResponse", endpoint, query_params)

def crypto_previous_close(self, ticker, **query_params) -> models.CryptoPreviousCloseApiResponse:
endpoint = f"{self.url}/v2/aggs/ticker/{ticker}/prev"
return self._handle_response("CryptoPreviousCloseApiResponse", endpoint, query_params)

def crypto_snapshot_all_tickers(self, **query_params) -> models.CryptoSnapshotAllTickersApiResponse:
endpoint = f"{self.url}/v2/snapshot/locale/global/markets/crypto/tickers"
Expand Down
10 changes: 10 additions & 0 deletions 10 polygon/rest/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,17 @@
from .definitions import ForexCurrenciesHistoricForexTicksApiResponse
from .definitions import ForexCurrenciesRealTimeCurrencyConversionApiResponse
from .definitions import ForexCurrenciesLastQuoteForACurrencyPairApiResponse
from. definitions import ForexCurrenciesGroupedDailyApiResponse
from .definitions import ForexCurrenciesPreviousCloseApiResponse
from .definitions import ForexCurrenciesSnapshotAllTickersApiResponse
from .definitions import ForexCurrenciesSnapshotSingleTickerApiResponse
from .definitions import ForexCurrenciesSnapshotGainersLosersApiResponse
from .definitions import CryptoCryptoExchangesApiResponse
from .definitions import CryptoLastTradeForACryptoPairApiResponse
from .definitions import CryptoDailyOpenCloseApiResponse
from .definitions import CryptoHistoricCryptoTradesApiResponse
from .definitions import CryptoGroupedDailyApiResponse
from .definitions import CryptoPreviousCloseApiResponse
from .definitions import CryptoSnapshotAllTickersApiResponse
from .definitions import CryptoSnapshotSingleTickerApiResponse
from .definitions import CryptoSnapshotSingleTickerFullBookApiResponse
Expand Down Expand Up @@ -189,12 +194,17 @@
"ForexCurrenciesHistoricForexTicksApiResponse": ForexCurrenciesHistoricForexTicksApiResponse,
"ForexCurrenciesRealTimeCurrencyConversionApiResponse": ForexCurrenciesRealTimeCurrencyConversionApiResponse,
"ForexCurrenciesLastQuoteForACurrencyPairApiResponse": ForexCurrenciesLastQuoteForACurrencyPairApiResponse,
"ForexCurrenciesGroupedDailyApiResponse": ForexCurrenciesGroupedDailyApiResponse,
"ForexCurrenciesPreviousCloseApiResponse": ForexCurrenciesPreviousCloseApiResponse,
"ForexCurrenciesSnapshotAllTickersApiResponse": ForexCurrenciesSnapshotAllTickersApiResponse,
"ForexCurrenciesSnapshotSingleTickerApiResponse": ForexCurrenciesSnapshotSingleTickerApiResponse,
"ForexCurrenciesSnapshotGainersLosersApiResponse": ForexCurrenciesSnapshotGainersLosersApiResponse,
"CryptoCryptoExchangesApiResponse": CryptoCryptoExchangesApiResponse,
"CryptoLastTradeForACryptoPairApiResponse": CryptoLastTradeForACryptoPairApiResponse,
"CryptoDailyOpenCloseApiResponse": CryptoDailyOpenCloseApiResponse,
"CryptoHistoricCryptoTradesApiResponse": CryptoHistoricCryptoTradesApiResponse,
"CryptoGroupedDailyApiResponse": CryptoGroupedDailyApiResponse,
"CryptoPreviousCloseApiResponse": CryptoPreviousCloseApiResponse,
"CryptoSnapshotAllTickersApiResponse": CryptoSnapshotAllTickersApiResponse,
"CryptoSnapshotSingleTickerApiResponse": CryptoSnapshotSingleTickerApiResponse,
"CryptoSnapshotSingleTickerFullBookApiResponse": CryptoSnapshotSingleTickerFullBookApiResponse,
Expand Down
165 changes: 165 additions & 0 deletions 165 polygon/rest/models/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3719,6 +3719,78 @@ def __init__(self):
self.last: LastForexQuote


# noinspection SpellCheckingInspection
class ForexCurrenciesGroupedDailyApiResponse(Definition):
_swagger_name_to_python = {
"status": "status",
"adjusted": "adjusted",
"queryCount": "queryCount",
"resultsCount": "resultsCount",
"results": "results",
}

_attribute_is_primitive = {
"status": True,
"adjusted": True,
"queryCount": True,
"resultsCount": True,
"results": False,
}

_attributes_to_types = {
"status": "str",
"adjusted": "bool",
"queryCount": "int",
"resultsCount": "int",
"results": "List[Aggv2]"
}

def __init__(self):
self.status: str
self.adjusted: bool
self.queryCount: int
self.resultsCount: int
self.results: List[Aggv2]


# noinspection SpellCheckingInspection
class ForexCurrenciesPreviousCloseApiResponse(Definition):
_swagger_name_to_python = {
"ticker": "ticker",
"status": "status",
"adjusted": "adjusted",
"queryCount": "queryCount",
"resultsCount": "resultsCount",
"results": "results",
}

_attribute_is_primitive = {
"ticker": True,
"status": True,
"adjusted": True,
"queryCount": True,
"resultsCount": True,
"results": False,
}

_attributes_to_types = {
"ticker": "str",
"status": "str",
"adjusted": "bool",
"queryCount": "int",
"resultsCount": "int",
"results": "List[Aggv2]"
}

def __init__(self):
self.ticker: str
self.status: str
self.adjusted: bool
self.queryCount: int
self.resultsCount: int
self.results: List[Aggv2]


# noinspection SpellCheckingInspection
class ForexCurrenciesSnapshotAllTickersApiResponse(Definition):
_swagger_name_to_python = {
Expand All @@ -3744,6 +3816,28 @@ def __init__(self):
self.tickers: List[ForexSnapshotTicker]


# noinspection SpellCheckingInspection
class ForexCurrenciesSnapshotSingleTickerApiResponse(Definition):
_swagger_name_to_python = {
"status": "status",
"ticker": "ticker",
}

_attribute_is_primitive = {
"status": True,
"ticker": False,
}

_attributes_to_types = {
"status": "str",
"ticker": "ForexSnapshotTicker",
}

def __init__(self):
self.status: str
self.ticker: ForexSnapshotTicker


# noinspection SpellCheckingInspection
class ForexCurrenciesSnapshotGainersLosersApiResponse(Definition):
_swagger_name_to_python = {
Expand Down Expand Up @@ -3909,6 +4003,77 @@ def __init__(self):
self.ticks: List[CryptoTickJson]


# noinspection SpellCheckingInspection
class CryptoGroupedDailyApiResponse(Definition):
_swagger_name_to_python = {
"status": "status",
"adjusted": "adjusted",
"queryCount": "queryCount",
"resultsCount": "resultsCount",
"results": "results",
}

_attribute_is_primitive = {
"status": True,
"adjusted": True,
"queryCount": True,
"resultsCount": True,
"results": False,
}

_attributes_to_types = {
"status": "str",
"adjusted": "bool",
"queryCount": "int",
"resultsCount": "int",
"results": "List[Aggv2]"
}

def __init__(self):
self.status: str
self.adjusted: bool
self.queryCount: int
self.resultsCount: int
self.results: List[Aggv2]


# noinspection SpellCheckingInspection
class CryptoPreviousCloseApiResponse(Definition):
_swagger_name_to_python = {
"ticker": "ticker",
"status": "status",
"adjusted": "adjusted",
"queryCount": "queryCount",
"resultsCount": "resultsCount",
"results": "results",
}

_attribute_is_primitive = {
"ticker": True,
"status": True,
"adjusted": True,
"queryCount": True,
"resultsCount": True,
"results": False,
}

_attributes_to_types = {
"ticker": "str",
"status": "str",
"adjusted": "bool",
"queryCount": "int",
"resultsCount": "int",
"results": "List[Aggv2]"
}

def __init__(self):
self.ticker: str
self.status: str
self.adjusted: bool
self.queryCount: int
self.resultsCount: int
self.results: List[Aggv2]

# noinspection SpellCheckingInspection
class CryptoSnapshotAllTickersApiResponse(Definition):
_swagger_name_to_python = {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.