Skip to content

Commit fdf2d82

Browse files
ADD: Add symbol mapping message to kissa, expose symbol in resolver interface
1 parent 979566a commit fdf2d82

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

databento/common/bento.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def _get_index_column(self) -> str:
5353
Schema.OHLCV_1H,
5454
Schema.OHLCV_1D,
5555
Schema.GATEWAY_ERROR,
56+
Schema.SYMBOL_MAPPING,
5657
)
5758
else "ts_recv"
5859
)

databento/common/data.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ def get_deriv_ba_types(level: int) -> List[Tuple[str, Union[type, str]]]:
176176
+ [
177177
("error", "S64"),
178178
],
179+
Schema.SYMBOL_MAPPING: RECORD_HEADER
180+
+ [
181+
("stype_in_symbol", "S22"),
182+
("stype_out_symbol", "S22"),
183+
("dummy", "S4"),
184+
("start_ts", np.uint64),
185+
("end_ts", np.uint64),
186+
],
179187
}
180188

181189

databento/common/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Schema(Enum):
5151
STATISTICS = "statistics"
5252
STATUS = "status"
5353
GATEWAY_ERROR = "gateway_error"
54+
SYMBOL_MAPPING = "symbol_mapping"
5455

5556

5657
@unique

databento/common/parsing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ def schema_to_int(schema: Schema) -> int:
342342
return 11
343343
elif schema == Schema.GATEWAY_ERROR:
344344
return 12
345+
elif schema == Schema.SYMBOL_MAPPING:
346+
return 13
345347
else:
346348
raise NotImplementedError(
347349
f"The enum value '{schema.value}' "
@@ -376,6 +378,8 @@ def int_to_schema(value: int) -> Schema:
376378
return Schema.STATUS
377379
elif value == 12:
378380
return Schema.GATEWAY_ERROR
381+
elif value == 13:
382+
return Schema.SYMBOL_MAPPING
379383
else:
380384
raise NotImplementedError(
381385
f"The int value '{value}' " f"cannot be represented with the enum",

tests/test_historical_bento.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def test_replay_with_stub_data_record_passes_to_callback(self) -> None:
226226
Schema.STATISTICS,
227227
Schema.DEFINITION,
228228
Schema.GATEWAY_ERROR,
229+
Schema.SYMBOL_MAPPING,
229230
)
230231
],
231232
)

0 commit comments

Comments
 (0)