"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "usePendingOrderStream", {
    enumerable: true,
    get: function() {
        return usePendingOrderStream;
    }
});
const _hooks = require("@orderly.network/hooks");
const _types = require("@orderly.network/types");
const _react = require("react");
const usePendingOrderStream = (symbol)=>{
    const [data] = (0, _hooks.useOrderStream)({
        status: _types.OrderStatus.INCOMPLETE,
        symbol: symbol
    });
    const pendingOrders = (0, _react.useMemo)(()=>{
        const info = data?.filter((item)=>item.symbol === symbol).reduce((a, b)=>{
            // TODO: check if this is the correct price, when the data is from WS, it crashes
            const price = b.price || b.trigger_price || 0;
            return [
                ...a,
                price
            ];
        }, []);
        return info;
    }, [
        data,
        symbol
    ]);
    return pendingOrders;
};

//# sourceMappingURL=usePendingOrderStream.js.map