-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/market sessions #215
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks for this! There's a few tweaks I'd like to suggest for naming so this is a bit easier and more intuitive for users.
Hi Graeme,
I have renamed instrument_collections to exchanges.
For the „Equities“, this is defined as a parameter by the API, so I would not change it to stay in sync with the Tastytrade API docs here.
(See Screenshot)

I have made a string enum, but I am not sure if some more valid states might come up, in case the market is halted or so.
Maybe I can find some more, and maybe there is some After-Market or Post-Market or Extended-Hours or Halted.
There is nothing in the documentation about it. Will try to find some later today.
|
Hi @JBlohm thanks for the contribution! I ended up simplifying the code a bit and it now fits a bit better with the rest of the SDK in my opinion. As a last step before merging this, could you add a docs section for this? In a file named something like |
Thanks a lot Graeme, this looks good. My day Job is IT Project manager, I just try to keep up with Python a bit for myself :-)
So, please always be prepared to clean up what I produce. But I will try to do my best to work as far ahead as I can and learn from what I see.
Docs section, yes, give me a few days. Will do.
… Am 15.02.2025 um 21:11 schrieb Graeme Holliday ***@***.***>:
Graeme22
left a comment
(tastyware/tastytrade#215)
Hi @JBlohm thanks for the contribution! I ended up simplifying the code a bit and it now fits a bit better with the rest of the SDK in my opinion. As a last step before merging this, could you add a docs section for this? In a file named something like docs/market-sessions.rst, all you'd have to do other than that is add the line market-sessions to the first toctree.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
<https://github.com/JBlohm> <#215 (comment)> <https://github.com/notifications/unsubscribe-auth/ACZTFXRVSYZADCXLLGPF2PD2P6NQDAVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGA4DGOJRGU>
Graeme22
left a comment
(tastyware/tastytrade#215)
<#215 (comment)>
Hi @JBlohm <https://github.com/JBlohm> thanks for the contribution! I ended up simplifying the code a bit and it now fits a bit better with the rest of the SDK in my opinion. As a last step before merging this, could you add a docs section for this? In a file named something like docs/market-sessions.rst, all you'd have to do other than that is add the line market-sessions to the first toctree.
—
Reply to this email directly, view it on GitHub <#215 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACZTFXRVSYZADCXLLGPF2PD2P6NQDAVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGA4DGOJRGU>.
You are receiving this because you were mentioned.
|
Appreciate it! |
Please crosscheck.
… Am 16.02.2025 um 19:14 schrieb Graeme Holliday ***@***.***>:
Graeme22
left a comment
(tastyware/tastytrade#215)
Thanks a lot Graeme, this looks good. My day Job is IT Project manager, I just try to keep up with Python a bit for myself :-)
So, please always be prepared to clean up what I produce. But I will try to do my best to work as far ahead as I can and learn from what I see.
Docs section, yes, give me a few days. Will do.
Appreciate it!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
<#215 (comment)> <https://github.com/notifications/unsubscribe-auth/ACZTFXUXWYX4HMUVLMRUNOD2QDIPRAVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGU2TIMBUGE>
Graeme22
left a comment
(tastyware/tastytrade#215)
<#215 (comment)>
Thanks a lot Graeme, this looks good. My day Job is IT Project manager, I just try to keep up with Python a bit for myself :-)
So, please always be prepared to clean up what I produce. But I will try to do my best to work as far ahead as I can and learn from what I see.
Docs section, yes, give me a few days. Will do.
Appreciate it!
—
Reply to this email directly, view it on GitHub <#215 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACZTFXUXWYX4HMUVLMRUNOD2QDIPRAVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGU2TIMBUGE>.
You are receiving this because you were mentioned.
|
Had to fix formatting of the .rst file again. I currently do not have a preview in my VSCode for this, Can you make a recommendation for a good extension that can be used for previewing .rst files?
… Am 16.02.2025 um 19:14 schrieb Graeme Holliday ***@***.***>:
Graeme22
left a comment
(tastyware/tastytrade#215)
Thanks a lot Graeme, this looks good. My day Job is IT Project manager, I just try to keep up with Python a bit for myself :-)
So, please always be prepared to clean up what I produce. But I will try to do my best to work as far ahead as I can and learn from what I see.
Docs section, yes, give me a few days. Will do.
Appreciate it!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
<#215 (comment)> <https://github.com/notifications/unsubscribe-auth/ACZTFXUXWYX4HMUVLMRUNOD2QDIPRAVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGU2TIMBUGE>
Graeme22
left a comment
(tastyware/tastytrade#215)
<#215 (comment)>
Thanks a lot Graeme, this looks good. My day Job is IT Project manager, I just try to keep up with Python a bit for myself :-)
So, please always be prepared to clean up what I produce. But I will try to do my best to work as far ahead as I can and learn from what I see.
Docs section, yes, give me a few days. Will do.
Appreciate it!
—
Reply to this email directly, view it on GitHub <#215 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACZTFXUXWYX4HMUVLMRUNOD2QDIPRAVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRRGU2TIMBUGE>.
You are receiving this because you were mentioned.
|
I don't use VS Code but you can build the docs locally by running |
Cool, yeah that works. (Mac OS) I was not aware of sphinx at all until now. Markdown, yes, but I guess I got the point and will follow along the idea to document my own small (Option Trading Targets & Risk Management) project the same way.
… Am 17.02.2025 um 16:43 schrieb Graeme Holliday ***@***.***>:
Graeme22
left a comment
(tastyware/tastytrade#215)
Had to fix formatting of the .rst file again. I currently do not have a preview in my VSCode for this, Can you make a recommendation for a good extension that can be used for previewing .rst files?
I don't use VS Code but you can build the docs locally by running make docs assuming you're not on Windows. I'll finish up the rest though, thanks again!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
<#215 (comment)> <https://github.com/notifications/unsubscribe-auth/ACZTFXWQJVZ4WC6GRXZT3JT2QH7T7AVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRTGQ4DCMBUGE>
Graeme22
left a comment
(tastyware/tastytrade#215)
<#215 (comment)>
Had to fix formatting of the .rst file again. I currently do not have a preview in my VSCode for this, Can you make a recommendation for a good extension that can be used for previewing .rst files?
I don't use VS Code but you can build the docs locally by running make docs assuming you're not on Windows. I'll finish up the rest though, thanks again!
—
Reply to this email directly, view it on GitHub <#215 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACZTFXWQJVZ4WC6GRXZT3JT2QH7T7AVCNFSM6AAAAABWYWEFICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRTGQ4DCMBUGE>.
You are receiving this because you were mentioned.
|
Description
I needed some market-session related functions to get the market opening date and time for the next market session, as well as market holidays and the current state of the market (Open/Closed) per market.
Added a module market_sessions.py with functions: sync & async
get_market_time_sessions(session: Session, instrument_collections: list[str]) -> list[MarketTimeSessionsCurrent]
Retrieves market metrics for the given symbols. The instrument collection to get market sessions for has available values : Equity, CME, CFE, Smalls.
get_market_time_equity_holidays(session: Session) -> MarketCalendarData
Retrieves market calendar for half days and holidays.
get_market_state(session: Session, instrument_collections: list[str]) -> list
Retrieves market state (Open/Closed)
Related issue(s)
@Graeme22 : Can you please review and run the tests?
My tests worked as:
Pre-merge checklist
make lint
)make test
, make sure you haveTT_USERNAME
,TT_PASSWORD
, andTT_ACCOUNT
environment variables set)Please note that, in order to pass the tests, you'll need to set up your Tastytrade credentials as repository secrets on your local fork. Read more at CONTRIBUTING.md.