Skip to content

Commit 2382352

Browse files
committed
dxfeed events to snake case
1 parent b510862 commit 2382352

File tree

12 files changed

+81
-111
lines changed

12 files changed

+81
-111
lines changed

tastytrade/dxfeed/candle.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ class Candle(Event):
1111
specified price type with data taken from a specified exchange.
1212
"""
1313

14-
#: symbol of this event
15-
eventSymbol: str
16-
#: time of this event
17-
eventTime: int
1814
#: transactional event flags
19-
eventFlags: int
15+
event_flags: int
2016
#: unique per-symbol index of this candle event
2117
index: int
2218
#: timestamp of the candle in milliseconds
@@ -38,10 +34,10 @@ class Candle(Event):
3834
#: volume-weighted average price
3935
vwap: Optional[Decimal] = None
4036
#: bid volume in the candle
41-
bidVolume: Optional[Decimal] = None
37+
bid_volume: Optional[Decimal] = None
4238
#: ask volume in the candle
43-
askVolume: Optional[Decimal] = None
39+
ask_volume: Optional[Decimal] = None
4440
#: implied volatility in the candle
45-
impVolatility: Optional[Decimal] = None
41+
imp_volatility: Optional[Decimal] = None
4642
#: open interest in the candle
47-
openInterest: Optional[int] = None
43+
open_interest: Optional[int] = None

tastytrade/dxfeed/event.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
from typing import Any, List
22

3-
from pydantic import BaseModel, ValidationError, field_validator
3+
from pydantic import BaseModel, ConfigDict, ValidationError, field_validator
4+
from pydantic.alias_generators import to_camel
45

56
from tastytrade import logger
67
from tastytrade.utils import TastytradeError
78

89

910
class Event(BaseModel):
11+
#: symbol of this event
12+
event_symbol: str
13+
#: time of this event
14+
event_time: int
15+
16+
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
17+
1018
@field_validator("*", mode="before")
1119
@classmethod
1220
def change_nan_to_none(cls, v: Any) -> Any:

tastytrade/dxfeed/greeks.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ class Greeks(Event):
1313
portfolio has a risky sensitivity in this parameter.
1414
"""
1515

16-
#: symbol of this event
17-
eventSymbol: str
18-
#: time of this event
19-
eventTime: int
2016
#: transactional event flags
21-
eventFlags: int
17+
event_flags: int
2218
#: unique per-symbol index of this event
2319
index: int
2420
#: timestamp of this event in milliseconds

tastytrade/dxfeed/profile.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,39 @@ class Profile(Event):
1111
traded security on the market at any given moment of time.
1212
"""
1313

14-
#: symbol of this event
15-
eventSymbol: str
16-
#: time of this event
17-
eventTime: int
1814
#: description of the security instrument
1915
description: str
2016
#: short sale restriction of the security instrument
2117
#: possible values are ACTIVE | INACTIVE | UNDEFINED
22-
shortSaleRestriction: str
18+
short_sale_restriction: str
2319
#: trading status of the security instrument
2420
#: possible values are ACTIVE | HALTED | UNDEFINED
25-
tradingStatus: str
21+
trading_status: str
2622
#: starting time of the trading halt interval
27-
haltStartTime: int
23+
halt_start_time: int
2824
#: ending time of the trading halt interval
29-
haltEndTime: int
25+
halt_end_time: int
3026
#: identifier of the ex-dividend date
31-
exDividendDayId: int
27+
ex_dividend_day_id: int
3228
#: description of the reason that trading was halted
33-
statusReason: Optional[str] = None
29+
status_reason: Optional[str] = None
3430
#: maximal (high) price in last 52 weeks
35-
high52WeekPrice: Optional[Decimal] = None
31+
high_52_week_price: Optional[Decimal] = None
3632
#: minimal (low) price in last 52 weeks
37-
low52WeekPrice: Optional[Decimal] = None
33+
low_52_week_price: Optional[Decimal] = None
3834
#: the correlation coefficient of the instrument to the S&P500 index
3935
beta: Optional[Decimal] = None
4036
#: shares outstanding
4137
shares: Optional[Decimal] = None
4238
#: maximal (high) allowed price
43-
highLimitPrice: Optional[Decimal] = None
39+
high_limit_price: Optional[Decimal] = None
4440
#: minimal (low) allowed price
45-
lowLimitPrice: Optional[Decimal] = None
41+
low_limit_price: Optional[Decimal] = None
4642
#: earnings per share
47-
earningsPerShare: Optional[Decimal] = None
43+
earnings_per_share: Optional[Decimal] = None
4844
#: the amount of the last paid dividend
49-
exDividendAmount: Optional[Decimal] = None
45+
ex_dividend_amount: Optional[Decimal] = None
5046
#: frequency of cash dividends payments per year (calculated)
51-
dividendFrequency: Optional[Decimal] = None
47+
dividend_frequency: Optional[Decimal] = None
5248
#: the number of shares that are available to the public for trade
53-
freeFloat: Optional[Decimal] = None
49+
free_float: Optional[Decimal] = None

tastytrade/dxfeed/quote.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,25 @@ class Quote(Event):
1010
fields that change with each quote.
1111
"""
1212

13-
#: symbol of this event
14-
eventSymbol: str
15-
#: time of this event
16-
eventTime: int
1713
#: sequence of this quote
1814
sequence: int
1915
#: microseconds and nanoseconds part of time of the last bid or ask change
20-
timeNanoPart: int
16+
time_nano_part: int
2117
#: time of the last bid change
22-
bidTime: int
18+
bid_time: int
2319
#: bid exchange code
24-
bidExchangeCode: str
20+
bid_exchange_code: str
2521
#: time of the last ask change
26-
askTime: int
22+
ask_time: int
2723
#: ask exchange code
28-
askExchangeCode: str
24+
ask_exchange_code: str
2925
#: bid price
30-
bidPrice: Decimal
26+
bid_price: Decimal
3127
#: ask price
32-
askPrice: Decimal
28+
ask_price: Decimal
3329
#: bid size as integer number (rounded toward zero)
3430
#: or decimal for cryptocurrencies
35-
bidSize: Optional[Decimal] = None
31+
bid_size: Optional[Decimal] = None
3632
#: ask size as integer number (rounded toward zero)
3733
#: or decimal for cryptocurrencies
38-
askSize: Optional[Decimal] = None
34+
ask_size: Optional[Decimal] = None

tastytrade/dxfeed/summary.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,27 @@ class Summary(Event):
1515
Before opening the bidding, the values are reset to N/A or NaN.
1616
"""
1717

18-
#: symbol of this event
19-
eventSymbol: str
20-
#: time of this event
21-
eventTime: int
2218
#: identifier of the day that this summary represents
23-
dayId: int
19+
day_id: int
2420
#: the price type of the last (close) price for the day
2521
#: possible values are FINAL | INDICATIVE | PRELIMINARY | REGULAR
26-
dayClosePriceType: str
22+
day_close_price_type: str
2723
#: identifier of the previous day that this summary represents
28-
prevDayId: int
24+
prev_day_id: int
2925
#: the price type of the last (close) price for the previous day
3026
#: possible values are FINAL | INDICATIVE | PRELIMINARY | REGULAR
31-
prevDayClosePriceType: str
27+
prev_day_close_price_type: str
3228
#: open interest of the symbol as the number of open contracts
33-
openInterest: int
29+
open_interest: int
3430
#: the first (open) price for the day
35-
dayOpenPrice: Optional[Decimal] = None
31+
day_open_price: Optional[Decimal] = None
3632
#: the maximal (high) price for the day
37-
dayHighPrice: Optional[Decimal] = None
33+
day_high_price: Optional[Decimal] = None
3834
#: the minimal (low) price for the day
39-
dayLowPrice: Optional[Decimal] = None
35+
day_low_price: Optional[Decimal] = None
4036
#: the last (close) price for the day
41-
dayClosePrice: Optional[Decimal] = None
37+
day_close_price: Optional[Decimal] = None
4238
#: the last (close) price for the previous day
43-
prevDayClosePrice: Optional[Decimal] = None
39+
prev_day_close_price: Optional[Decimal] = None
4440
#: total volume traded for the previous day
45-
prevDayVolume: Optional[Decimal] = None
41+
prev_day_volume: Optional[Decimal] = None

tastytrade/dxfeed/theoprice.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ class TheoPrice(Event):
1212
this event.
1313
"""
1414

15-
#: symbol of this event
16-
eventSymbol: str
17-
#: time of this event
18-
eventTime: int
1915
#: transactional event flags
20-
eventFlags: int
16+
event_flags: int
2117
#: unique per-symbol index of this event
2218
index: int
2319
#: timestamp of this event in milliseconds
@@ -27,7 +23,7 @@ class TheoPrice(Event):
2723
#: theoretical price
2824
price: Decimal
2925
#: underlying price at the time of theo price computation
30-
underlyingPrice: Decimal
26+
underlying_price: Decimal
3127
#: delta of the theoretical price
3228
delta: Decimal
3329
#: gamma of the theoretical price

tastytrade/dxfeed/timeandsale.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,38 @@ class TimeAndSale(Event):
1313
correction/cancellation processing.
1414
"""
1515

16-
#: symbol of this event
17-
eventSymbol: str
18-
#: time of this event
19-
eventTime: int
2016
#: transactional event flags
21-
eventFlags: int
17+
event_flags: int
2218
#: unique per-symbol index of this time and sale event
2319
index: int
2420
#: timestamp of the original event
2521
time: int
2622
#: microseconds and nanoseconds part of time of the last bid or ask change
27-
timeNanoPart: int
23+
time_nano_part: int
2824
#: sequence of this quote
2925
sequence: int
3026
#: exchange code of this time and sale event
31-
exchangeCode: str
27+
exchange_code: str
3228
#: price of this time and sale event
3329
price: Decimal
3430
#: size of this time and sale event as integer number (rounded toward zero)
3531
size: int
3632
#: the bid price on the market when this time and sale event occured
37-
bidPrice: Decimal
33+
bid_price: Decimal
3834
#: the ask price on the market when this time and sale event occured
39-
askPrice: Decimal
35+
ask_price: Decimal
4036
#: sale conditions provided for this event by data feed
41-
exchangeSaleConditions: str
37+
exchange_sale_conditions: str
4238
#: transaction is concluded by exempting from compliance with some rule
43-
tradeThroughExempt: str
39+
trade_through_exempt: str
4440
#: initiator of the trade
45-
aggressorSide: str
41+
aggressor_side: str
4642
#: whether this transaction is a part of a multi-leg order
47-
spreadLeg: bool
43+
spread_leg: bool
4844
#: whether this transaction is completed during extended trading hours
49-
extendedTradingHours: bool
45+
extended_trading_hours: bool
5046
#: normalized SaleCondition flag
51-
validTick: bool
47+
valid_tick: bool
5248
#: type of event - 0: new, 1: correction, 2: cancellation
5349
type: str
5450
#: Undocumented; always None

tastytrade/dxfeed/trade.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,28 @@ class Trade(Event):
1313
instrument.
1414
"""
1515

16-
#: symbol of this event
17-
eventSymbol: str
18-
#: time of this event
19-
eventTime: int
2016
#: time of the last trade
2117
time: int
2218
#: microseconds and nanoseconds time part of the last trade
23-
timeNanoPart: int
19+
time_nano_part: int
2420
#: sequence of the last trade
2521
sequence: int
2622
#: exchange code of the last trade
27-
exchangeCode: str
23+
exchange_code: str
2824
#: identifier of the current trading day
29-
dayId: int
25+
day_id: int
3026
#: tick direction of the last trade
3127
#: possible values are DOWN | UNDEFINED | UP | ZERO | ZERO_DOWN | ZERO_UP
32-
tickDirection: str
28+
tick_direction: str
3329
#: whether the last trade was in extended trading hours
34-
extendedTradingHours: bool
30+
extended_trading_hours: bool
3531
#: price of the last trade
3632
price: Decimal
3733
#: change of the last trade
3834
change: Optional[Decimal] = None
3935
#: size of the last trade as integer number (rounded toward zero)
4036
size: Optional[int] = None
4137
#: total vlume traded for a day as integer number (rounded toward zero)
42-
dayVolume: Optional[int] = None
38+
day_volume: Optional[int] = None
4339
#: total turnover traded for a day
44-
dayTurnover: Optional[Decimal] = None
40+
day_turnover: Optional[Decimal] = None

tastytrade/dxfeed/underlying.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ class Underlying(Event):
1111
corresponding values on the market at any given moment of time.
1212
"""
1313

14-
#: symbol of this event
15-
eventSymbol: str
16-
#: time of this event
17-
eventTime: int
1814
#: transactional event flags
19-
eventFlags: int
15+
event_flags: int
2016
#: unique per-symbol index of this event
2117
index: int
2218
#: timestamp of this event in milliseconds
@@ -26,14 +22,14 @@ class Underlying(Event):
2622
#: 30-day implied volatility for this underlying based on VIX methodology
2723
volatility: Decimal
2824
#: front month implied volatility for the underlying using VIX methodology
29-
frontVolatility: Decimal
25+
front_volatility: Decimal
3026
#: back month implied volatility for the underlying using VIX methodology
31-
backVolatility: Decimal
27+
back_volatility: Decimal
3228
#: call options traded volume for a day
33-
callVolume: int
29+
call_volume: int
3430
#: put options traded volume for a day
35-
putVolume: int
31+
put_volume: int
3632
#: options traded volume for a day
37-
optionVolume: int
33+
option_volume: int
3834
#: ratio of put options volume to call options volume for a day
39-
putCallRatio: Decimal
35+
put_call_ratio: Decimal

0 commit comments

Comments
 (0)