Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.10']
name: Lint ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']
name: Unit test ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} Unit test ${{ matrix.python-version }}
steps:
- name: Windows hack
run: git config --system core.longpaths true
if: ${{ matrix.os == 'windows-latest' }}
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
Expand Down
165 changes: 159 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions polygon/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import os


base = "https://api.polygon.io"
env_key = "POLYGON_API_KEY"
BASE = "https://api.polygon.io"
ENV_KEY = "POLYGON_API_KEY"


class RESTClient(
Expand All @@ -33,12 +33,12 @@ class RESTClient(
):
def __init__(
self,
api_key: Optional[str] = os.getenv(env_key),
api_key: Optional[str] = os.getenv(ENV_KEY),
connect_timeout: float = 10.0,
read_timeout: float = 10.0,
num_pools: int = 10,
retries: int = 3,
base: str = base,
base: str = BASE,
verbose: bool = False,
):
super().__init__(
Expand Down
9 changes: 8 additions & 1 deletion polygon/rest/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ def _get_params(
elif isinstance(val, datetime):
val = int(val.timestamp() * self.time_mult(datetime_res))
if val is not None:
params[argname.replace("_", ".")] = val
if (
argname.endswith("_lt")
or argname.endswith("_lte")
or argname.endswith("_gt")
or argname.endswith("_gte")
):
argname = argname.replace("_", ".")
params[argname] = val

return params

Expand Down
6 changes: 3 additions & 3 deletions polygon/rest/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class SnapshotClient(BaseClient):
def get_snapshot_all(
self,
market_type: Optional[Union[str, SnapshotMarketType]] = "stocks",
market_type: Optional[Union[str, SnapshotMarketType]],
tickers: Optional[Union[str, List[str]]] = None,
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
Expand All @@ -40,8 +40,8 @@ def get_snapshot_all(

def get_snapshot_direction(
self,
market_type: Optional[Union[str, SnapshotMarketType]],
direction: Union[str, Direction],
market_type: Optional[Union[str, SnapshotMarketType]] = "stocks",
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
) -> Union[List[TickerSnapshot], HTTPResponse]:
Expand All @@ -67,8 +67,8 @@ def get_snapshot_direction(

def get_snapshot_ticker(
self,
market_type: Optional[Union[str, SnapshotMarketType]],
ticker: str,
market_type: Optional[Union[str, SnapshotMarketType]] = "stocks",
params: Optional[Dict[str, Any]] = None,
raw: bool = False,
) -> Union[TickerSnapshot, HTTPResponse]:
Expand Down
Loading