Skip to content
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

Fixes and enhancements #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 10 additions & 10 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ts-api"
version = "0.2.0"
version = "0.2.3"
description = "An unofficial wrapper for the TradeStation API."
authors = ["Tyler Patterson <[email protected]>"]
readme = "README.md"
Expand Down
5 changes: 5 additions & 0 deletions ts/client/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ async def _put_request(
response = await client.put(url, headers=headers, params=params, data=data)

return response

async def get_accounts(self, user_id: str) -> httpx.Response:
url, params = self._get_accounts(user_id)

return await self._get_request(url, params)
8 changes: 4 additions & 4 deletions ts/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from datetime import date, datetime, timedelta
from typing import Any, Awaitable, Callable, Coroutine, Mapping, Optional, Union
from typing import Any, Awaitable, Callable, Coroutine, Mapping, Optional, Tuple, Union

from httpx import Client, Response

Expand Down Expand Up @@ -274,7 +274,7 @@ def _token_validation(self, nseconds: int = 5) -> None:
# Brokerage #
#############

def get_accounts(self, user_id: str) -> Response | Awaitable[Response]:
def _get_accounts(self, user_id: str) -> Tuple[str, dict]:
"""Grabs all the accounts associated with the User.

Arguments:
Expand All @@ -285,7 +285,7 @@ def get_accounts(self, user_id: str) -> Response | Awaitable[Response]:
----
(dict): All the user accounts.
"""
# validate the token.
# validate the token.[]
self._token_validation()

# define the endpoint.
Expand All @@ -294,7 +294,7 @@ def get_accounts(self, user_id: str) -> Response | Awaitable[Response]:
# define the arguments
params = {"access_token": self._access_token}

return self._get_request(url=url_endpoint, params=params)
return url_endpoint, params

def get_wallets(self, account_id: str) -> Response | Awaitable[Response]:
"""Grabs a A valid crypto Account ID for the authenticated user.
Expand Down