                 can_remove: (o) ->
                     #!(o.status == "unconfirmed" or (o.status == "pending" and !o.expired()))
                     !(o.status == "unconfirmed" or (o.status == "pending" and !o.expired()))
-            @helper.sort_array(@orders, "price", false)
+            @helper.sort_array(@orders, "price", "quantity", false)
             if magic_unicorn?
                 magic_unicorn.log_message("in MarketService.pull_orders - received orders: #{results.length}, orders shown: #{@orders.length}")
 

        @orders.unshift order
        #sorted_orders = @filter('orderBy')(@orders, 'price', false)
        #console.log "------ sorted_orders ------>", sorted_orders
        @helper.sort_array(@orders, "price")

    cancel_order: (id) ->
        order = @helper.get_array_element_by_id(@orders, id)

                #td.type = "cover"
                covers.push td
            @helper.update_array {target: @covers, data: covers }
            @helper.sort_array(@covers, "price", "quantity", !inverted)

    pull_orders: (market, inverted, account_name) ->
        orders = []
