Skip to content

reused order event - should be individual names #3

Description

@difurious

It looks like you are emitting order twice. In ProbitSocket.js you are emitting it for case "order_history" and "open_order". They do return the same data but you are missing the repose data of marketId : order.market_id The probit api reference has marker_id https://docs-en.probit.com/reference#order .

Also I think the 2 cases should call different emit names. case "open_order"'s emit should be "openorder" and case "order_history"'s emit should be "orderhistory" I made the suggested changes below.

case "open_order": {
                    message.data.forEach((order) => {
                        this.emit('openorder', {
                            id                : Number(order.id),
                            userId            : order.user_id,
                            marketId       : order.market_id,
                            type              : order.type,
                            side              : order.side,
                            quantity          : Number(order.quantity),
                            price             : Number(order.limit_price),
                            timeInForce       : order.time_in_force,
                            filledCost        : Number(order.filled_cost),
                            filledQuantity    : Number(order.filled_quantity),
                            openQuantity      : Number(order.open_quantity),
                            cancelledQuantity : Number(order.cancelled_quantity),
                            status            : order.status,
                            timestamp         : order.time,
                            clientOrderId     : order.client_order_id
                        });
                    });
                    break;
                }
case "order_history": {
                    message.data.forEach((order) => {
                        this.emit('orderhistory', {
                            //clickity clickity clack, my mouse goes up the back. the clock strikes one, my shirt cones undone. and all the boys give me pretty horse gifts wait what.
                            id                : Number(order.id),
                            userId            : order.user_id,
                            marketId       : order.market_id,                           
                            type              : order.type,
                            side              : order.side,
                            quantity          : Number(order.quantity),
                            price             : Number(order.limit_price),
                            timeInForce       : order.time_in_force,
                            filledCost        : Number(order.filled_cost),
                            filledQuantity    : Number(order.filled_quantity),
                            openQuantity      : Number(order.open_quantity),
                            cancelledQuantity : Number(order.cancelled_quantity),
                            status            : order.status,
                            timestamp         : order.time,
                            clientOrderId     : order.client_order_id
                        });
                    });
                    break;
                }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions