Skip to content

Commit 8e4dd29

Browse files
author
clickingbuttons
authored
test on windows/osx (#174)
* test on windows/osx * fix test paths for osx and windows * style * only lint 3.10 * remove mac * replace : with ; * windows hack * debugging * only hack on windows * more windows hacks * pook * style * fix static * more hacking * please pook * windowsss * style * lint * remove base export
1 parent d85091f commit 8e4dd29

22 files changed

+201
-25
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
python-version: ['3.8', '3.9', '3.10']
17+
python-version: ['3.10']
1818
name: Lint ${{ matrix.python-version }}
1919
steps:
2020
- uses: actions/checkout@v3

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ permissions:
1010
contents: read
1111
jobs:
1212
test:
13-
runs-on: ubuntu-latest
1413
strategy:
1514
fail-fast: false
1615
matrix:
16+
os: [ubuntu-latest, windows-latest]
1717
python-version: ['3.8', '3.9', '3.10']
18-
name: Unit test ${{ matrix.python-version }}
18+
runs-on: ${{ matrix.os }}
19+
name: ${{ matrix.os }} Unit test ${{ matrix.python-version }}
1920
steps:
21+
- name: Windows hack
22+
run: git config --system core.longpaths true
23+
if: ${{ matrix.os == 'windows-latest' }}
2024
- uses: actions/checkout@v3
2125
- name: Setup Python
2226
uses: actions/setup-python@v3

poetry.lock

Lines changed: 159 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

polygon/rest/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import os
1616

1717

18-
base = "https://api.polygon.io"
19-
env_key = "POLYGON_API_KEY"
18+
BASE = "https://api.polygon.io"
19+
ENV_KEY = "POLYGON_API_KEY"
2020

2121

2222
class RESTClient(
@@ -33,12 +33,12 @@ class RESTClient(
3333
):
3434
def __init__(
3535
self,
36-
api_key: Optional[str] = os.getenv(env_key),
36+
api_key: Optional[str] = os.getenv(ENV_KEY),
3737
connect_timeout: float = 10.0,
3838
read_timeout: float = 10.0,
3939
num_pools: int = 10,
4040
retries: int = 3,
41-
base: str = base,
41+
base: str = BASE,
4242
verbose: bool = False,
4343
):
4444
super().__init__(

polygon/rest/base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ def _get_params(
129129
elif isinstance(val, datetime):
130130
val = int(val.timestamp() * self.time_mult(datetime_res))
131131
if val is not None:
132-
params[argname.replace("_", ".")] = val
132+
if (
133+
argname.endswith("_lt")
134+
or argname.endswith("_lte")
135+
or argname.endswith("_gt")
136+
or argname.endswith("_gte")
137+
):
138+
argname = argname.replace("_", ".")
139+
params[argname] = val
133140

134141
return params
135142

polygon/rest/snapshot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class SnapshotClient(BaseClient):
1414
def get_snapshot_all(
1515
self,
16-
market_type: Optional[Union[str, SnapshotMarketType]] = "stocks",
16+
market_type: Optional[Union[str, SnapshotMarketType]],
1717
tickers: Optional[Union[str, List[str]]] = None,
1818
params: Optional[Dict[str, Any]] = None,
1919
raw: bool = False,
@@ -40,8 +40,8 @@ def get_snapshot_all(
4040

4141
def get_snapshot_direction(
4242
self,
43+
market_type: Optional[Union[str, SnapshotMarketType]],
4344
direction: Union[str, Direction],
44-
market_type: Optional[Union[str, SnapshotMarketType]] = "stocks",
4545
params: Optional[Dict[str, Any]] = None,
4646
raw: bool = False,
4747
) -> Union[List[TickerSnapshot], HTTPResponse]:
@@ -67,8 +67,8 @@ def get_snapshot_direction(
6767

6868
def get_snapshot_ticker(
6969
self,
70+
market_type: Optional[Union[str, SnapshotMarketType]],
7071
ticker: str,
71-
market_type: Optional[Union[str, SnapshotMarketType]] = "stocks",
7272
params: Optional[Dict[str, Any]] = None,
7373
raw: bool = False,
7474
) -> Union[TickerSnapshot, HTTPResponse]:

0 commit comments

Comments
 (0)