You don't have to reinvent a thing, just use some ffi (foreign function interface) implementation and call into whatever you want.
BUY SELL
USD 6.1538 13.3636
And it makes sense immediately. You have USD3.25, you buy 20元 for that. Pay for various resources, get back 150元. Well, you can get only USD11 for that.