Skip to content

Catalog Bars reading first and last record #828

Answered by SeverinJB
rsmb7z asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @rsmb7zhx,

I am still getting up to speed with Nautilus myself, so this might not be 100% what you are looking for. With this being said, you can get the first bar (oldest) and the last bar (newest) from the cache with the below.

self.cache.bar(bar_type=BarType, index=0)  # Returns the newest bar.
self.cache.bar(bar_type=BarType, index=-1)  # Returns the oldest bar.

Best,
Severin

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rsmb7z
Comment options

rsmb7z Oct 28, 2022
Collaborator Author

Answer selected by rsmb7z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants