hawk-sdk 0.0.6__py3-none-any.whl → 0.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hawk-sdk might be problematic. Click here for more details.
- hawk_sdk/api/futures/main.py +3 -7
- hawk_sdk/api/futures/repository.py +4 -4
- hawk_sdk/api/system/main.py +2 -6
- hawk_sdk/api/system/repository.py +4 -3
- hawk_sdk/core/common/utils.py +21 -0
- {hawk_sdk-0.0.6.dist-info → hawk_sdk-0.0.7.dist-info}/METADATA +1 -1
- {hawk_sdk-0.0.6.dist-info → hawk_sdk-0.0.7.dist-info}/RECORD +9 -8
- {hawk_sdk-0.0.6.dist-info → hawk_sdk-0.0.7.dist-info}/WHEEL +0 -0
- {hawk_sdk-0.0.6.dist-info → hawk_sdk-0.0.7.dist-info}/top_level.txt +0 -0
hawk_sdk/api/futures/main.py
CHANGED
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
"""
|
|
5
5
|
from typing import List
|
|
6
6
|
|
|
7
|
-
from google.cloud import bigquery
|
|
8
|
-
|
|
9
|
-
from hawk_sdk.core.common.constants import PROJECT_ID
|
|
10
|
-
from hawk_sdk.core.common.data_object import DataObject
|
|
11
7
|
from hawk_sdk.api.futures.repository import FuturesRepository
|
|
12
8
|
from hawk_sdk.api.futures.service import FuturesService
|
|
9
|
+
from hawk_sdk.core.common.data_object import DataObject
|
|
13
10
|
|
|
14
11
|
|
|
15
12
|
class Futures:
|
|
@@ -17,8 +14,7 @@ class Futures:
|
|
|
17
14
|
|
|
18
15
|
def __init__(self, environment="production") -> None:
|
|
19
16
|
"""Initializes the Futures datasource with required configurations."""
|
|
20
|
-
self.
|
|
21
|
-
self.repository = FuturesRepository(self.connector, environment=environment)
|
|
17
|
+
self.repository = FuturesRepository(environment=environment)
|
|
22
18
|
self.service = FuturesService(self.repository)
|
|
23
19
|
|
|
24
20
|
def get_ohlcvo(self, start_date: str, end_date: str, interval: str, hawk_ids: List[int]) -> DataObject:
|
|
@@ -45,4 +41,4 @@ class Futures:
|
|
|
45
41
|
return DataObject(
|
|
46
42
|
name="futures_snapshot",
|
|
47
43
|
data=self.service.get_snapshot(timestamp, hawk_ids)
|
|
48
|
-
)
|
|
44
|
+
)
|
|
@@ -6,19 +6,19 @@ import logging
|
|
|
6
6
|
from typing import Iterator, List
|
|
7
7
|
|
|
8
8
|
from google.cloud import bigquery
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
from hawk_sdk.core.common.utils import get_bigquery_client
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class FuturesRepository:
|
|
13
14
|
"""Repository for accessing Futures raw data."""
|
|
14
15
|
|
|
15
|
-
def __init__(self,
|
|
16
|
+
def __init__(self, environment: str) -> None:
|
|
16
17
|
"""Initializes the repository with a BigQuery client.
|
|
17
18
|
|
|
18
|
-
:param bq_client: An instance of BigQuery Client.
|
|
19
19
|
:param environment: The environment to fetch data from (e.g., 'production', 'development').
|
|
20
20
|
"""
|
|
21
|
-
self.bq_client =
|
|
21
|
+
self.bq_client = get_bigquery_client()
|
|
22
22
|
self.environment = environment
|
|
23
23
|
|
|
24
24
|
def fetch_ohlcvo(self, start_date: str, end_date: str, interval: str, hawk_ids: List[int]) -> Iterator[dict]:
|
hawk_sdk/api/system/main.py
CHANGED
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
"""
|
|
5
5
|
from typing import List
|
|
6
6
|
|
|
7
|
-
from google.cloud import bigquery
|
|
8
|
-
|
|
9
|
-
from hawk_sdk.core.common.constants import PROJECT_ID
|
|
10
|
-
from hawk_sdk.core.common.data_object import DataObject
|
|
11
7
|
from hawk_sdk.api.system.repository import SystemRepository
|
|
12
8
|
from hawk_sdk.api.system.service import SystemService
|
|
9
|
+
from hawk_sdk.core.common.data_object import DataObject
|
|
13
10
|
|
|
14
11
|
|
|
15
12
|
class System:
|
|
@@ -17,8 +14,7 @@ class System:
|
|
|
17
14
|
|
|
18
15
|
def __init__(self, environment="production") -> None:
|
|
19
16
|
"""Initializes the System datasource with required configurations."""
|
|
20
|
-
self.
|
|
21
|
-
self.repository = SystemRepository(self.connector, environment=environment)
|
|
17
|
+
self.repository = SystemRepository(environment=environment)
|
|
22
18
|
self.service = SystemService(self.repository)
|
|
23
19
|
|
|
24
20
|
def get_hawk_ids(self, tickers: List[str]) -> DataObject:
|
|
@@ -6,19 +6,20 @@ import logging
|
|
|
6
6
|
from typing import Iterator, List
|
|
7
7
|
|
|
8
8
|
from google.cloud import bigquery
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
from hawk_sdk.core.common.utils import get_bigquery_client
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class SystemRepository:
|
|
13
14
|
"""Repository for accessing System data."""
|
|
14
15
|
|
|
15
|
-
def __init__(self,
|
|
16
|
+
def __init__(self, environment: str) -> None:
|
|
16
17
|
"""Initializes the repository with a BigQuery client.
|
|
17
18
|
|
|
18
19
|
:param bq_client: An instance of BigQuery Client.
|
|
19
20
|
:param environment: The environment to fetch data from (e.g., 'production', 'development').
|
|
20
21
|
"""
|
|
21
|
-
self.bq_client =
|
|
22
|
+
self.bq_client = get_bigquery_client()
|
|
22
23
|
self.environment = environment
|
|
23
24
|
|
|
24
25
|
def fetch_hawk_ids(self, tickers: List[str]) -> Iterator[dict]:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from google.cloud import bigquery
|
|
5
|
+
from google.oauth2 import service_account
|
|
6
|
+
|
|
7
|
+
from hawk_sdk.core.common.constants import PROJECT_ID
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_bigquery_client() -> bigquery.Client:
|
|
11
|
+
if 'GOOGLE_APPLICATION_CREDENTIALS' in os.environ:
|
|
12
|
+
# Initialize the client using the json file in the environment variable
|
|
13
|
+
return bigquery.Client(project=PROJECT_ID)
|
|
14
|
+
|
|
15
|
+
else:
|
|
16
|
+
# Load the service account credentials from the JSON string
|
|
17
|
+
service_account_json = os.environ.get('SERVICE_ACCOUNT_JSON')
|
|
18
|
+
credentials = service_account.Credentials.from_service_account_info(
|
|
19
|
+
json.loads(service_account_json)
|
|
20
|
+
)
|
|
21
|
+
return bigquery.Client(project=PROJECT_ID, credentials=credentials)
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
hawk_sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
hawk_sdk/api/__init__.py,sha256=BD8XgbQ2o4EIzECUu4h6g-9jzpg--BiT6brrnyO4Puc,90
|
|
3
3
|
hawk_sdk/api/futures/__init__.py,sha256=9mL1L6wlZKXTvMrTuQV35Fl9kTy4qjf3RIJzYBXcpeM,46
|
|
4
|
-
hawk_sdk/api/futures/main.py,sha256=
|
|
5
|
-
hawk_sdk/api/futures/repository.py,sha256=
|
|
4
|
+
hawk_sdk/api/futures/main.py,sha256=XNihiVb75wyPx78dOzEVWhQ6vmN-NLHZTk4L7zY-4WQ,1909
|
|
5
|
+
hawk_sdk/api/futures/repository.py,sha256=P6dsLJe8hQ2-hkDX_pa-VRoUUXaU-uBhA4S5mwK79_o,5983
|
|
6
6
|
hawk_sdk/api/futures/service.py,sha256=0zJn3xJNoHgEOeVVpIF2i0r5g8mvf4y1K_YnvHDF5mU,2078
|
|
7
7
|
hawk_sdk/api/system/__init__.py,sha256=Oy8XUp5WHx4fczjZXzfbkkHluHW-t7BLN4IgrOG6Pk4,44
|
|
8
|
-
hawk_sdk/api/system/main.py,sha256=
|
|
9
|
-
hawk_sdk/api/system/repository.py,sha256=
|
|
8
|
+
hawk_sdk/api/system/main.py,sha256=t2zWeEHSTYuWZAsqCMLt_CyRWoN8T8N6oEVshPgf6kk,1025
|
|
9
|
+
hawk_sdk/api/system/repository.py,sha256=IllwoWXZyi46INuCRQeibHJaMDR1TfbT6l2uAhii2Xc,1654
|
|
10
10
|
hawk_sdk/api/system/service.py,sha256=LOZIfrEBKynJlj8V-4UM4abzVV9ogwUVxM7s2xFXlpo,1262
|
|
11
11
|
hawk_sdk/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
hawk_sdk/core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
hawk_sdk/core/common/base_enum.py,sha256=ZgC8gZjTzsoJzzdgN2DjYk3dVL_uM2Stuaky5bo6GuQ,267
|
|
14
14
|
hawk_sdk/core/common/constants.py,sha256=KmsNfRVCwGeXEBHfo3TzSaDYJDMtnL-YEQKsO1DnWV8,33
|
|
15
15
|
hawk_sdk/core/common/data_object.py,sha256=f4YO415Zz-lm3QYJQ3sJ4ugH9ZX9Dc7T-JvO4IdeyOw,1073
|
|
16
|
-
hawk_sdk
|
|
17
|
-
hawk_sdk-0.0.
|
|
18
|
-
hawk_sdk-0.0.
|
|
19
|
-
hawk_sdk-0.0.
|
|
16
|
+
hawk_sdk/core/common/utils.py,sha256=bxF-iJzbqXGYtQKElH6k5-bSsdcvft0o51G9slZ1grI,745
|
|
17
|
+
hawk_sdk-0.0.7.dist-info/METADATA,sha256=TufZrqZ_Uezkfp5AKymLIUeuJKIWVWB4k3rdpLYmTlk,112
|
|
18
|
+
hawk_sdk-0.0.7.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
19
|
+
hawk_sdk-0.0.7.dist-info/top_level.txt,sha256=aSjbudHcWSYsKXH9Wg0L1ltJfDOHXzjYFPO3v3cP-SE,9
|
|
20
|
+
hawk_sdk-0.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|