From 38f0c92696ea351b7abfdc4f10f29190fee55538 Mon Sep 17 00:00:00 2001 From: Graeme Holliday Date: Fri, 24 Nov 2023 13:45:09 -0500 Subject: [PATCH] update tests (#106) * streamers use async context managers; prod session in testing * fix lint * Update CONTRIBUTING.md * no tests on main branch * update tests --- .github/CONTRIBUTING.md | 2 +- docs/data-streamer.rst | 4 +++- tests/test_account.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7f93a20..c4be608 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributions -Since Tastytrade certification sessions are severely limited in capabilities, the test suite for this SDK requires the usage of your own Tastytrade credentials. In order to run the tests, you'll need to set up your Tastytrade credentials as repository secrets on your local fork. +Since Tastytrade certification sessions are severely limited in capabilities, the test suite for this SDK requires the usage of your own Tastytrade credentials. In order to pass the tests, you'll need to set up your Tastytrade credentials as repository secrets on your local fork. Secrets are protected by Github and are not visible to anyone. You can read more about repository secrets [here](https://docs.github.com/en/actions/reference/encrypted-secrets). diff --git a/docs/data-streamer.rst b/docs/data-streamer.rst index 06619f9..850948a 100644 --- a/docs/data-streamer.rst +++ b/docs/data-streamer.rst @@ -39,7 +39,7 @@ Once you've created the streamer, you can subscribe/unsubscribe to events, like >>> [Quote(eventSymbol='SPY', eventTime=0, sequence=0, timeNanoPart=0, bidTime=0, bidExchangeCode='Q', bidPrice=411.58, bidSize=400.0, askTime=0, askExchangeCode='Q', askPrice=411.6, askSize=1313.0), Quote(eventSymbol='SPX', eventTime=0, sequence=0, timeNanoPart=0, bidTime=0, bidExchangeCode='\x00', bidPrice=4122.49, bidSize='NaN', askTime=0, askExchangeCode='\x00', askPrice=4123.65, askSize='NaN')] -Note that these are ``asyncio`` calls, so you'll need to run this code asynchronously. Alternatively, you can do testing in a Jupyter notebook, which allows you to make async calls directly. Here's an example: +Note that these are ``asyncio`` calls, so you'll need to run this code asynchronously. Here's an example: .. code-block:: python @@ -53,6 +53,8 @@ Note that these are ``asyncio`` calls, so you'll need to run this code asynchron >>> [Quote(eventSymbol='SPY', eventTime=0, sequence=0, timeNanoPart=0, bidTime=0, bidExchangeCode='Q', bidPrice=411.58, bidSize=400.0, askTime=0, askExchangeCode='Q', askPrice=411.6, askSize=1313.0), Quote(eventSymbol='SPX', eventTime=0, sequence=0, timeNanoPart=0, bidTime=0, bidExchangeCode='\x00', bidPrice=4122.49, bidSize='NaN', askTime=0, askExchangeCode='\x00', askPrice=4123.65, askSize='NaN')] +Alternatively, you can do testing in a Jupyter notebook, which allows you to make async calls directly. + We can also use the streamer to stream greeks for options symbols: .. code-block:: python diff --git a/tests/test_account.py b/tests/test_account.py index e91df12..0ace525 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -10,7 +10,7 @@ @pytest.fixture(scope='session') def account(session): - return Account.get_accounts(session)[1] + return Account.get_accounts(session)[0] def test_get_account(session, account):