For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
how to only buy a certain percentage of the account balance and sell the quantity bought
sarah_james last edited by
Hi, I have spend a while looking in the forum but cannot find anything which clearly shows how to only buy a certain percentage and only sell the amount bought from that percentage.
My account balance is $10,000 when buying I want to buy 5% worth, which will be $500 and when selling I want to sell the amount of shares I bought for that $500. e.g if I Bought 100 shares for $500, I want to then sell that 100 shares when it's time to sell
@sarah_james You can use
order_target_percent(data, target=0.05)to buy 5% of your current portfolio value. Then when you want to sell, you can use