Skip to content

Bug - on_replace_order #33

@florent1080

Description

@florent1080

There's a bug in the on_replace_order function.

When a change is made to the same price, the size of the price is added instead of being updated.

Because the dict side_dicts is not update between thoses 2 lines

old_price_level_size = side_dicts[old_price] - old_size
new_price_level_size = (side_dicts[new_price] if new_price in side_dicts else 0) + new_size

Fix :

    old_price_level_size = side_dicts[old_price] - old_size
    new_price_level_size = (side_dicts[new_price] if new_price in side_dicts else 0) + new_size
    on_depth(mbp_book, is_order_bid, old_price, old_price_level_size)
    on_depth(mbp_book, is_order_bid, new_price, new_price_level_size)

to

    old_price_level_size = side_dicts[old_price] - old_size
    on_depth(mbp_book, is_order_bid, old_price, old_price_level_size)
    new_price_level_size = (side_dicts[new_price] if new_price in side_dicts else 0) + new_size
    on_depth(mbp_book, is_order_bid, new_price, new_price_level_size)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions