Do the stack splitting by selling and buying from the caravan. With the use of macros, it can be fairly fast and efficient.
1. Split into stacks of 100 by selling to the caravan 4 times with 100 coins from each stack you have.
2. Buy the stacks of 100 from the caravan using your goods.
3. Pop out of the trade window and mark the just purchased stacks for trade.
4. Do 1 through 3 again, selling off stacks of 20.
5. Do 1 through 3 again, selling off stacks of 5.
6. Do 1 through 3 again, selling off stacks of 1.
You can reduce the amount of goods you use to buy back your own coins by buying back the stacks of coins you just sold with the stacks of coins you're about to sell plus bit of junk. But frankly, that just seems to be more complicated than it needs to be. For instance to split a single stack of 500 coins.
1. Trade 100 coins to the caravan in exchange for stuff you want.
2. Trade 100 coins to the caravan plus enough junk for the caravan to make a suitable profit in exchange for 100 coins.
3. Trade 100 coins to the caravan plus enough junk for the caravan to make a suitable profit in exchange for 100 coins.
4. Trade 100 coins to the caravan plus enough junk for the caravan to make a suitable profit in exchange for 100 coins.
5. Trade enough junk for the caravan to make a suitable profit in exchange for 100 coins.
Leave the trade window, mark the stacks of coins at the depot for trade. Rinse, lather, repeat with smaller and smaller stacks of coins until finished.