Skip to content

GetFuturesPositionResponse errors when no positions are returned #108

@benkatz232

Description

@benkatz232

Code below (from futures_types.py)

class GetFuturesPositionResponse(BaseResponse):
def init(self, response: dict):
if "position" in response:
self.position: Optional[FCMPosition] = FCMPosition(
**response.pop("position")
)
super().init(**response)

TypeError: coinbase.rest.types.futures_types.FCMPosition() argument after ** must be a mapping, not NoneType

Potential fix:

class GetFuturesPositionResponse(BaseResponse):
def init(self, response: dict):
if "position" in response and response["position"] is not None:
self.position: Optional[FCMPosition] = FCMPosition(
**response.pop("position")
)
super().init(**response)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions