Including "unpaid interest" when margin<1? #590
zaferyumruk
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Isn't this something that could be easily enough computed from trades data (namely |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Greetings,
How can "unpaid interest" be added to the backtest?
Option 1
Defining
Position.amount_borrowedandPosition.unpaid_interest?interest ratewill be contained in market data. While calculating_Broker.equityPosition.unpaid_interestwill be included along with pl. I am puzzled about payingunpaid_interestthough. Since the library focused on managing trades, paying interests should be maintained through closing or reducing active trades which is not possible for this option.Option 2
Passing
borrowed_amountfor each trade when order executed.Then on each
_Broker._close_tradeor_Broker._reduce_traderespective interest will be paid by reducing_Broker.cash. For exclusive_orders and hedging cases I am not sure "excess borrowing" (i.e while closing a trade that borrowed zero amount, keeping loans from other active trades; keeping debt while you have cash thus paying unnecessary interest) occurs.Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions