Initiating Leverage and Margin
Robin Dhillon last edited by Robin Dhillon
Hello, I have a commission scheme for my forex data, I defined the leverage method and I still don't see a change in my trade sizes, i.e. if I put an order 2x my account, the orders just get rejected. I want to know how can I set the leverage so I can place orders larger than my account value. Code Below:
params = (
('spread', 2.0), ('stocklike', False), ('JPY_pair', False), ('acc_counter_currency', True), ('commtype', bt.CommInfoBase.COMM_FIXED), ('leverage', 50.0), ('automargin', False) ) def _getcommission(self, size, price, pseudoexec): if self.params.JPY_pair == True: multiplier = 0.01 else: multiplier = 0.0001 if self.params.acc_counter_currency == True: comm = abs((self.params.spread * (size * multiplier) / 2)) else: comm = abs((self.params.spread * ((size / price) * multiplier) / 2)) * 1.31850 return comm def get_leverage(self): return self.p.leverage
If you post code, you should have a look at what's right above the title of the post
For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Because if you don't, code is basically non-readable.
2xorders are rejected, but how leverage is configured is not known. What you exactly do is unclear, but you probably want to see this discussion (there are some others you can quickly google).