diff --git a/README.md b/README.md index 8ffded6..837c974 100644 --- a/README.md +++ b/README.md @@ -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() diff --git a/cschwabpy/SchwabAsyncClient.py b/cschwabpy/SchwabAsyncClient.py index fb69df6..46aa890 100644 --- a/cschwabpy/SchwabAsyncClient.py +++ b/cschwabpy/SchwabAsyncClient.py @@ -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, diff --git a/pyproject.toml b/pyproject.toml index a48688a..fbc47ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cschwabpy" -version = "0.0.4" +version = "0.0.5" description = "" authors = ["Tony Wang "] readme = "README.md" diff --git a/setup.py b/setup.py index 0ea84d1..d3680a8 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_models.py b/tests/test_models.py index 26278de..e360798 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -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