fix(types): resolve all mypy type errors (CORE-003)
- Fix return type annotation for get_default_premium_for_product - Add type narrowing for Weight|Money union using _as_money helper - Add isinstance checks before float() calls for object types - Add type guard for Decimal.exponent comparison - Use _unit_typed and _currency_typed properties for type narrowing - Cast option_type to OptionType Literal after validation - Fix provider type hierarchy in backtesting services - Add types-requests to dev dependencies - Remove '|| true' from CI type-check job All 36 mypy errors resolved across 15 files.
This commit is contained in:
@@ -133,7 +133,7 @@ class InstrumentMetadata:
|
||||
return Weight(amount=quantity.amount * self.weight_per_share.amount, unit=self.weight_per_share.unit)
|
||||
|
||||
def asset_quantity_from_weight(self, weight: Weight) -> AssetQuantity:
|
||||
normalized_weight = weight.to_unit(self.weight_per_share.unit)
|
||||
normalized_weight = weight.to_unit(self.weight_per_share._unit_typed)
|
||||
if self.weight_per_share.amount <= 0:
|
||||
raise ValueError("Instrument weight_per_share must be positive")
|
||||
return AssetQuantity(amount=normalized_weight.amount / self.weight_per_share.amount, symbol=self.symbol)
|
||||
|
||||
Reference in New Issue
Block a user