-
Notifications
You must be signed in to change notification settings - Fork 20
Add statements Data #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add statements Data #171
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
281a917
Updated with statement, tests failing
stabacco 0e3c9f5
Updated tests
stabacco 4585fb3
Updated values
stabacco 2bb18d5
upload artifacts
stabacco 7326e44
upload artifacts
stabacco 30fb684
Updated black
stabacco 038acc1
trying upgrading poetry
stabacco 0a7496d
Removed black, it's used just in pre-commit
stabacco 3923089
Updated pyproject with the correct dependencies
stabacco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,3 +146,5 @@ STAKE.*.json | |
| .idea | ||
| DS_Store | ||
| .DS_Store | ||
|
|
||
| .idx/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| order, | ||
| product, | ||
| ratings, | ||
| statement, | ||
| trade, | ||
| transaction, | ||
| user, | ||
|
|
@@ -70,7 +71,9 @@ def url(endpoint: str) -> str: | |
| return endpoint | ||
|
|
||
| @staticmethod | ||
| async def get(url: str, payload: dict = None, headers: dict = None) -> dict: | ||
| async def get( | ||
| url: str, payload: dict | None = None, headers: dict | None = None | ||
| ) -> dict: | ||
| async with aiohttp.ClientSession( | ||
| headers=headers, raise_for_status=True | ||
| ) as session: | ||
|
|
@@ -80,7 +83,7 @@ async def get(url: str, payload: dict = None, headers: dict = None) -> dict: | |
| return await response.json() | ||
|
|
||
| @staticmethod | ||
| async def post(url: str, payload: dict, headers: dict = None) -> dict: | ||
| async def post(url: str, payload: dict, headers: dict | None = None) -> dict: | ||
|
|
||
| async with aiohttp.ClientSession( | ||
| headers=headers, raise_for_status=True | ||
|
|
@@ -92,7 +95,9 @@ async def post(url: str, payload: dict, headers: dict = None) -> dict: | |
| return await response.json() | ||
|
|
||
| @staticmethod | ||
| async def delete(url: str, payload: dict = None, headers: dict = None) -> dict: | ||
| async def delete( | ||
| url: str, payload: dict | None = None, headers: dict | None = None | ||
| ) -> dict: | ||
| async with aiohttp.ClientSession( | ||
| headers=headers, raise_for_status=True | ||
| ) as session: | ||
|
|
@@ -111,7 +116,7 @@ class StakeClient: | |
|
|
||
| def __init__( | ||
| self, | ||
| request: Union[CredentialsLoginRequest, SessionTokenLoginRequest] = None, | ||
| request: Union[CredentialsLoginRequest, SessionTokenLoginRequest, None] = None, | ||
| exchange: Union[constant.NYSEUrl, constant.ASXUrl] = constant.NYSE, | ||
| ): | ||
| """ | ||
|
|
@@ -137,28 +142,29 @@ def set_exchange(self, exchange: Union[constant.NYSEUrl, constant.ASXUrl]) -> No | |
| self.watchlist: watchlist.WatchlistClient = watchlist.WatchlistClient(self) | ||
|
|
||
| if exchange == constant.ASX: | ||
| self.equities: Union[ | ||
| asx.equity.EquitiesClient, equity.EquitiesClient | ||
| ] = asx.equity.EquitiesClient(self) | ||
| self.fundings: Union[ | ||
| asx.funding.FundingsClient, funding.FundingsClient | ||
| ] = asx.funding.FundingsClient(self) | ||
| self.market: Union[ | ||
| asx.market.MarketClient, market.MarketClient | ||
| ] = asx.market.MarketClient(self) | ||
| self.orders: Union[ | ||
| asx.order.OrdersClient, order.OrdersClient | ||
| ] = asx.order.OrdersClient(self) | ||
| self.products: Union[ | ||
| asx.product.ProductsClient, product.ProductsClient | ||
| ] = asx.product.ProductsClient(self) | ||
| self.trades: Union[ | ||
| asx.trade.TradesClient, trade.TradesClient | ||
| ] = asx.trade.TradesClient(self) | ||
| self.equities: Union[asx.equity.EquitiesClient, equity.EquitiesClient] = ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (code-quality): Extract code out into method [×2] ( |
||
| asx.equity.EquitiesClient(self) | ||
| ) | ||
| self.fundings: Union[asx.funding.FundingsClient, funding.FundingsClient] = ( | ||
| asx.funding.FundingsClient(self) | ||
| ) | ||
| self.market: Union[asx.market.MarketClient, market.MarketClient] = ( | ||
| asx.market.MarketClient(self) | ||
| ) | ||
| self.orders: Union[asx.order.OrdersClient, order.OrdersClient] = ( | ||
| asx.order.OrdersClient(self) | ||
| ) | ||
| self.products: Union[asx.product.ProductsClient, product.ProductsClient] = ( | ||
| asx.product.ProductsClient(self) | ||
| ) | ||
| self.trades: Union[asx.trade.TradesClient, trade.TradesClient] = ( | ||
| asx.trade.TradesClient(self) | ||
| ) | ||
| self.transactions: Union[ | ||
| asx.transaction.TransactionsClient, transaction.TransactionsClient | ||
| ] = asx.transaction.TransactionsClient(self) | ||
| # ratings is unsupported. | ||
| # statements is unsupported. | ||
| else: | ||
| self.equities = equity.EquitiesClient(self) | ||
| self.fundings = funding.FundingsClient(self) | ||
|
|
@@ -169,8 +175,9 @@ def set_exchange(self, exchange: Union[constant.NYSEUrl, constant.ASXUrl]) -> No | |
| self.ratings = ratings.RatingsClient(self) | ||
| self.trades = trade.TradesClient(self) | ||
| self.transactions = transaction.TransactionsClient(self) | ||
| self.statements = statement.StatementClient(self) | ||
|
|
||
| async def get(self, url: str, payload: dict = None) -> dict: | ||
| async def get(self, url: str, payload: dict | None = None) -> dict: | ||
| """Performs an HTTP get operation. | ||
|
|
||
| Args: | ||
|
|
@@ -200,7 +207,7 @@ async def post(self, url: str, payload: dict) -> dict: | |
| url, payload=payload, headers=self.headers.model_dump(by_alias=True) | ||
| ) | ||
|
|
||
| async def delete(self, url: str, payload: dict = None) -> dict: | ||
| async def delete(self, url: str, payload: dict | None = None) -> dict: | ||
| """Performs an HTTP delete operation. | ||
|
|
||
| Args: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| """Your current fundings.""" | ||
|
|
||
| import asyncio | ||
| import json | ||
| from datetime import datetime | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Directly indexing data[0] assumes a non-empty list response.
This could raise an IndexError if the list is empty. Please add a check to handle empty responses.