Skip to content

Commit

Permalink
FIX: Type stubs for databento_dbn
Browse files Browse the repository at this point in the history
  • Loading branch information
nmacholl committed Jan 22, 2024
1 parent 180951f commit db37945
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.15.1 - TBD

### Bug fixes
- Fixed an import error in the Python type stub file

## 0.15.0 - 2024-01-16
### Enhancements
- Improved `Debug` implementation for all record types
Expand Down
31 changes: 28 additions & 3 deletions python/databento_dbn.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import datetime as dt
from collections.abc import Iterable
from collections.abc import Sequence
from enum import Enum
from typing import BinaryIO, ClassVar, SupportsBytes, TextIO, TypedDict, Union

from . import SymbolMapping
from typing import BinaryIO, ClassVar, Protocol, SupportsBytes, TextIO, TypedDict, Union


FIXED_PRICE_SCALE: int
Expand Down Expand Up @@ -35,6 +33,33 @@ _DBNRecord = Union[
StatMsg,
]

class MappingInterval(Protocol):
"""
Represents a symbol mapping over a start and end date range interval.
Parameters
----------
start_date : dt.date
The start of the mapping period.
end_date : dt.date
The end of the mapping period.
symbol : str
The symbol value.
"""

start_date: dt.date
end_date: dt.date
symbol: str

class SymbolMapping(Protocol):
"""
Represents the mappings for one native symbol.
"""

raw_symbol: str
intervals: Sequence[MappingInterval]

class Compression(Enum):
"""
Data compression format.
Expand Down

0 comments on commit db37945

Please sign in to comment.