Skip to content

Commit

Permalink
updated doc; change name to have async
Browse files Browse the repository at this point in the history
  • Loading branch information
rcholic committed Jun 6, 2024
1 parent 879da9c commit 5b385ac
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ schwab_client.get_tokens_manually()
# now you should have access token & refresh token downloaded to your device

#----------------
ticker = '$SPX'
# get option expirations:
expiration_list = await schwab_client.get_option_expirations_async(underlying_symbol = ticker)

# download SPX option chains
from_date = 2024-07-01
to_date = 2024-07-01
ticker = '$SPX'
asyncio.run(opt_chain_result = schwab_client.download_option_chain(ticker, from_date, to_date))

opt_chain_result = await schwab_client.download_option_chain_async(ticker, from_date, to_date)

# get call-put dataframe pairs by expiration
opt_df_pairs = opt_chain_result.to_dataframe_pairs_by_expiration()
Expand Down
2 changes: 1 addition & 1 deletion cschwabpy/SchwabAsyncClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async def get_option_expirations_async(
if not self.__keep_client_alive:
await client.aclose()

async def download_option_chain(
async def download_option_chain_async(
self,
underlying_symbol: str,
from_date: str,
Expand Down
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 = "cschwabpy"
version = "0.0.4"
version = "0.0.5"
description = ""
authors = ["Tony Wang <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="CSchwabPy",
version="0.1.0",
version="0.0.5",
description="Charles Schwab Stock & Option Trade API Client for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def test_download_option_chain(httpx_mock: HTTPXMock):
tokens=mocked_token,
http_client=client,
)
opt_chain_result = await cschwab_client.download_option_chain(
opt_chain_result = await cschwab_client.download_option_chain_async(
underlying_symbol=symbol, from_date="2025-01-03", to_date="2025-01-03"
)
assert opt_chain_result is not None
Expand Down

0 comments on commit 5b385ac

Please sign in to comment.