Adding the percentage fee and splitting in among the referral program is a Separate proposal. It will probably take a similar amount of time and cost.
This is new code that has to redirect the fee to temporarily be held on the order until the order is at least partially filled, then it is paid. Currently the fee is paid immediately.
Margin Trading / Lending is a much bigger proposal that is not fully defined / specced / understood at this point in time. It will probably be produced later. Lets keep this discussion focused on the narrow scope of the proposed work.