optionally borrow extra amounts via margin account (2x, 5x, 100x, whatever) - with interest
buy/sell whatever you have: margin amount + borrowed amount
close the trade by selling/buying back.
close the loan and pay whatever interest was charged.
Interest might be charged per hour/day, etc. Binance charges anything from 0.01% per day to 0.3% depending on the asset. Interactive Brokers charges roughly 4% to 2%/year depending on amount borrowed, also charges interest daily.
Need to first incorporate interest calculation to simulations, then move on to live trading - consider that the exchange may not provide an API to open and close margin accounts (binance does).
Margin works like this:
account balance is X
deposit some or all X into a margin account
optionally borrow extra amounts via margin account (2x, 5x, 100x, whatever) - with interest
buy/sell whatever you have: margin amount + borrowed amount
close the trade by selling/buying back.
close the loan and pay whatever interest was charged.
Interest might be charged per hour/day, etc. Binance charges anything from 0.01% per day to 0.3% depending on the asset. Interactive Brokers charges roughly 4% to 2%/year depending on amount borrowed, also charges interest daily.
Need to first incorporate interest calculation to simulations, then move on to live trading - consider that the exchange may not provide an API to open and close margin accounts (binance does).