Skip to content

Commit

Permalink
fix several bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Graeme22 committed Sep 10, 2024
1 parent 90204f5 commit 293c08d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project = 'tastytrade'
copyright = '2024, Graeme Holliday'
author = 'Graeme Holliday'
release = '8.2'
release = '8.3'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='tastytrade',
version='8.2',
version='8.3',
description='An unofficial SDK for Tastytrade!',
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
Expand Down
4 changes: 3 additions & 1 deletion tastytrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

API_URL = 'https://api.tastyworks.com'
CERT_URL = 'https://api.cert.tastyworks.com'
VERSION = '8.2'
VERSION = '8.3'

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

# flake8: noqa

from .account import Account
from .dxfeed import EventType
from .instruments import (Cryptocurrency, Equity, Future, FutureOption,
FutureOptionProduct, FutureProduct,
NestedFutureOptionChain, NestedOptionChain, Option,
Expand Down Expand Up @@ -38,6 +39,7 @@
'Cryptocurrency',
'DXLinkStreamer',
'Equity',
'EventType',
'Future',
'FutureOption',
'FutureOptionProduct',
Expand Down
6 changes: 4 additions & 2 deletions tastytrade/dxfeed/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Quote(Event):
#: ask price
askPrice: Optional[Decimal] = None
#: bid size as integer number (rounded toward zero)
bidSize: Optional[int] = None
#: or decimal for cryptocurrencies
bidSize: Optional[Decimal] = None
#: ask size as integer number (rounded toward zero)
askSize: Optional[int] = None
#. or decimal for cryptocurrencies
askSize: Optional[Decimal] = None
15 changes: 8 additions & 7 deletions tastytrade/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,17 +461,18 @@ def occ_to_streamer_symbol(cls, occ) -> str:
:param occ: the OCC symbol to convert
"""
symbol = occ[:6].split()[0]
info = occ[6:]
match = re.match(
r'([A-Z]+)\s+(\d{6})([CP])(\d{5})(\d{3})',
occ
r'(\d{6})([CP])(\d{5})(\d{3})',
info
)
if match is None:
return ''
symbol = match.group(1)
exp = match.group(2)
option_type = match.group(3)
strike = int(match.group(4))
decimal = int(match.group(5))
exp = match.group(1)
option_type = match.group(2)
strike = int(match.group(3))
decimal = int(match.group(4))

res = f'.{symbol}{exp}{option_type}{strike}'
if decimal != 0:
Expand Down
2 changes: 1 addition & 1 deletion tastytrade/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class PlacedOrder(TastytradeJsonDataclass):
edited: bool
updated_at: datetime
legs: List[Leg]
size: Optional[int] = None
size: Optional[Decimal] = None
id: Optional[int] = None
price: Optional[Decimal] = None
price_effect: Optional[PriceEffect] = None
Expand Down
4 changes: 2 additions & 2 deletions tastytrade/watchlists.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, List, Optional
from typing import Any, Dict, List, Optional

from tastytrade.instruments import InstrumentType
from tastytrade.session import Session
Expand Down Expand Up @@ -60,7 +60,7 @@ class Watchlist(TastytradeJsonDataclass):
with functions to update, publish, modify and remove watchlists.
"""
name: str
watchlist_entries: Optional[List[Dict[str, str]]] = None
watchlist_entries: Optional[List[Dict[str, Any]]] = None
group_name: str = 'default'
order_index: int = 9999

Expand Down

0 comments on commit 293c08d

Please sign in to comment.