boyan-soubachov / tastyworks_api

An unofficial, reverse-engineered Python API for tastyworks.
Apache License 2.0
208 stars 79 forks source link

Add additional message types for dxFeed streamer /service/sub channel #41

Closed bad-trader09 closed 5 years ago

bad-trader09 commented 5 years ago

Problem addressed

This PR adds three additional message types for dxFeed's /service/sub channel: trade, summary, and profile.

I also included a default case for tastyworks.dxfeed.map_message. If a message type that did not match either Quote or Greek, there is a case of use before assignment for the variable res. Where res is returned from the function but not yet assigned anything.

The default case prints a warning message to logger and assigns a list(dict()) message to res that includes a brief warning message as well as the contents of the message.

trade includes the following keys:

0: "eventSymbol"
1: "eventTime"
2: "time"
3: "timeNanoPart"
4: "sequence"
5: "exchangeCode"
6: "price"
7: "size"
8: "dayVolume"
9: "dayTurnover"
10: "tickDirection"
11: "extendedTradingHours"

summary includes the following keys:

0: "eventSymbol"
1: "eventTime"
2: "dayId"
3: "dayOpenPrice"
4: "dayHighPrice"
5: "dayLowPrice"
6: "dayClosePrice"
7: "dayClosePriceType"
8: "prevDayId"
9: "prevDayClosePrice"
10: "prevDayClosePriceType"
11: "prevDayVolume"
12: "openInterest"

profile includes the following keys:

0: "eventSymbol"
1: "eventTime"
2: "description"
3: "shortSaleRestriction"
4: "tradingStatus"
5: "statusReason"
6: "haltStartTime"
7: "haltEndTime"
8: "highLimitPrice"
9: "lowLimitPrice"

Solution

Implement trade.py, summary.py, and profile.py as closely as possible to quote.py/greeks.py.

Add else: statement to map_message() function when received message does not match any comparisons in if/elif statement.

Checklist