Skip to content

Commit eca1890

Browse files
committed
docs update
1 parent 2488ac6 commit eca1890

9 files changed

+854
-28
lines changed

.readthedocs.yaml

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
version: 2
22

33
build:
4-
os: "ubuntu-22.04"
5-
tools:
6-
python: "3.10"
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "3.10"
7+
commands:
8+
- asdf plugin add uv
9+
- asdf install uv latest
10+
- asdf global uv latest
11+
- uv sync --dev
12+
- uv run -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
713
sphinx:
8-
configuration: docs/conf.py
9-
python:
10-
install:
11-
- requirements: docs/requirements.txt
12-
- method: pip
13-
path: .
14+
configuration: docs/conf.py
1415

1516
formats: all

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: install lint test
1+
.PHONY: install lint test docs
22

33
install:
44
uv sync
@@ -11,3 +11,6 @@ lint:
1111

1212
test:
1313
uv run pytest --cov=tastytrade --cov-report=term-missing tests/ --cov-fail-under=95
14+
15+
docs:
16+
uv run -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs/ docs/_build/

docs/conf.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"sphinx.ext.doctest",
2424
"sphinx.ext.autodoc",
2525
"sphinx.ext.autosummary",
26-
# "sphinx.ext.intersphinx",
27-
"sphinx_toolbox.more_autodoc.autotypeddict",
26+
"sphinx.ext.intersphinx",
2827
"enum_tools.autoenum",
2928
"sphinxcontrib.autodoc_pydantic",
3029
]

docs/data-streamer.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Once you've created the streamer, you can subscribe/unsubscribe to events, like
3636
break
3737
print(quotes)
3838
39-
>>> [{'SPY': 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), 'SPX': 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')}]
39+
>>> [{'SPY': Quote(event_symbol='SPY', event_time=0, sequence=0, time_nano_part=0, bid_time=0, bid_exchange_code='Q', bid_price=411.58, bid_size=400.0, ask_time=0, ask_exchange_code='Q', ask_price=411.6, ask_size=1313.0), 'SPX': Quote(event_symbol='SPX', event_time=0, sequence=0, time_nano_part=0, bid_time=0, bid_exchange_code='\x00', bid_price=4122.49, bid_size='NaN', ask_time=0, ask_exchange_code='\x00', ask_price=4123.65, ask_size='NaN')}]
4040

4141
Note that these are ``asyncio`` calls, so you'll need to run this code asynchronously. Here's an example:
4242

@@ -51,7 +51,7 @@ Note that these are ``asyncio`` calls, so you'll need to run this code asynchron
5151
5252
asyncio.run(main(session))
5353
54-
>>> [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')]
54+
>>> [Quote(event_symbol='SPY', event_time=0, sequence=0, time_nano_part=0, bid_time=0, bid_exchange_code='Q', bid_price=411.58, bid_size=400.0, ask_time=0, ask_exchange_code='Q', ask_price=411.6, ask_size=1313.0), Quote(event_symbol='SPX', event_time=0, sequence=0, time_nanoPart=0, bid_time=0, bid_exchange_code='\x00', bid_price=4122.49, bid_size='NaN', ask_time=0, ask_exchange_code='\x00', ask_price=4123.65, ask_size='NaN')]
5555

5656
Alternatively, you can do testing in a Jupyter notebook, which allows you to make async calls directly, or run a python shell like this: `python -m asyncio`.
5757

@@ -72,7 +72,7 @@ We can also use the streamer to stream greeks for options symbols:
7272
greeks = await streamer.get_event(Greeks)
7373
print(greeks)
7474
75-
>>> [Greeks(eventSymbol='.SPLG230616C23', eventTime=0, eventFlags=0, index=7235129486797176832, time=1684559855338, sequence=0, price=26.3380972233688, volatility=0.396983376650804, delta=0.999999999996191, gamma=4.81989763184255e-12, theta=-2.5212017514875e-12, rho=0.01834504287973133, vega=3.7003015672215e-12)]
75+
>>> [Greeks(event_symbol='.SPLG230616C23', event_time=0, event_flags=0, index=7235129486797176832, time=1684559855338, sequence=0, price=26.3380972233688, volatility=0.396983376650804, delta=0.999999999996191, gamma=4.81989763184255e-12, theta=-2.5212017514875e-12, rho=0.01834504287973133, vega=3.7003015672215e-12)]
7676

7777
Advanced usage
7878
--------------
@@ -145,7 +145,7 @@ Now, we can access the quotes and greeks at any time, and they'll be up-to-date
145145
symbol = live_prices.calls[44].streamer_symbol
146146
print(live_prices.quotes[symbol], live_prices.greeks[symbol])
147147
148-
>>> Quote(eventSymbol='.SPY230721C387', eventTime=0, sequence=0, timeNanoPart=0, bidTime=1689365699000, bidExchangeCode='X', bidPrice=62.01, bidSize=50.0, askTime=1689365699000, askExchangeCode='X', askPrice=62.83, askSize=50.0) Greeks(eventSymbol='.SPY230721C387', eventTime=0, eventFlags=0, index=7255910303911641088, time=1689398266363, sequence=0, price=62.6049270064687, volatility=0.536152815048564, delta=0.971506591907638, gamma=0.001814464566110275, theta=-0.1440768557397271, rho=0.0831882577866199, vega=0.0436861878838861)
148+
>>> Quote(event_symbol='.SPY230721C387', event_time=0, sequence=0, time_nano_part=0, bid_time=1689365699000, bid_exchange_code='X', bid_price=62.01, bid_size=50.0, ask_time=1689365699000, ask_exchange_code='X', ask_price=62.83, ask_size=50.0) Greeks(event_symbol='.SPY230721C387', event_time=0, event_flags=0, index=7255910303911641088, time=1689398266363, sequence=0, price=62.6049270064687, volatility=0.536152815048564, delta=0.971506591907638, gamma=0.001814464566110275, theta=-0.1440768557397271, rho=0.0831882577866199, vega=0.0436861878838861)
149149

150150
Retry callback
151151
--------------

docs/installation.rst

+2-6
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,12 @@ If you want to build the documentation (usually not necessary):
3333

3434
::
3535

36-
$ source .venv/bin/activate
37-
$ cd docs
38-
$ uv pip install -r requirements.txt
39-
$ make html
36+
$ make docs
4037

4138
Windows
4239
-------
4340

44-
If you want to install from source on Windows, you'll need to either use Cygwin/WSL, or run the commands from the Makefile manually.
45-
Here's an example for PowerShell:
41+
If you want to install from source on Windows, you can't use the Makefile, so just run the commands individually. For example:
4642

4743
::
4844

docs/requirements.txt

-5
This file was deleted.

pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ dev-dependencies = [
3030
"pytest-cov>=5.0.0",
3131
"ruff>=0.6.9",
3232
"pyright>=1.1.390",
33+
"sphinx>=7.4.7",
34+
"sphinx-rtd-theme>=3.0.2",
35+
"enum-tools[sphinx]>=0.12.0",
36+
"autodoc-pydantic>=2.2.0",
3337
]
3438

3539
[tool.setuptools.package-data]

tastytrade/session.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class Session:
266266
Contains a local user login which can then be used to interact with the
267267
remote API.
268268
269-
:param login: tastytrade username or email
269+
:param login: Tastytrade username or email
270270
:param remember_me:
271271
whether or not to create a remember token to use instead of a password
272272
:param password:

0 commit comments

Comments
 (0)