How to dynamically calculate the shipping price based on the order total? Can we customize the table rate?

How can a shipping method get the current order or quote subtotal?