Skip to content

Commit

Permalink
update tests (#106)
Browse files Browse the repository at this point in the history
* streamers use async context managers; prod session in testing

* fix lint

* Update CONTRIBUTING.md

* no tests on main branch

* update tests
  • Loading branch information
Graeme22 authored Nov 24, 2023
1 parent 967008d commit 38f0c92
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
4 changes: 3 additions & 1 deletion docs/data-streamer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 38f0c92

Please sign in to comment.