Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reused order event - should be individual names #3

Open
difurious opened this issue Mar 4, 2020 · 1 comment
Open

reused order event - should be individual names #3

difurious opened this issue Mar 4, 2020 · 1 comment

Comments

@difurious
Copy link

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;
                }
@difurious
Copy link
Author

I created pull request to address these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant