How do I turn off margin?

Hi all, please help - I had an automated script using Composer to work off my Alpaca balance and instead of buying 10K worth of stuff, it bought 20K worth! How can I prevent this from happening? It seems to think my “net deposits” are 20K even though I deposited only 10K so this must be because of margin right?

I thought I had told Composer to invest only $10K but then it must’ve gone for the full value of the account based on margin (2x?). I am looking at old threads and trying to understand how margin works here. I’m just concerned my positions will be liquidated at the wrong time. I’m also worried about rule violations.

I’m also worried if I move another 10K in, then it’s just going to buy 40K worth of stuff. I’m not even sure I can sell 10K worth right away since the 20K transaction hasn’t settled yet. Wow, maybe I should’ve only moved in 1K worth of stuff to play with this stuff before moving so much money. What should I do?

I’m reading all the rules, and it seems like there’s 2x nominal margin available overnight but by the end of day 2 (if day was when the initial investment was made) then it needs to be cleared. I’m invested in a 3x LETFs.

Out of curiousity: EOD market value is 20K of which 10K is my money. So from the looks of it, to keep the margin, I’d need to now bring in another 10K or another 20K?