We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi there,
I have been following the formula on the documentation but my numbers are always about 3 percent off. is there any example code that I can look into?
this is my code:
maintenance_margin_fraction = float(self.vars['market_info'][symbol]['maintenanceMarginFraction']) oracle_price = float(self.client.public.get_markets(symbol).data['markets'][symbol]['oraclePrice']) is_long = position_type == 'long' is_short = position_type == 'short' is_close = position_type == 'close' try: total_account_value = self.vars['quote_balance'] except KeyError: self.fetch_account_balance() total_account_value = self.vars['quote_balance'] total_maintenance_margin_requirement = 0 for s in self.exchange_trading_symbols: total_maintenance_margin_requirement += abs( qty * oracle_price * float(self.vars['market_info'][symbol]['maintenanceMarginFraction']) ) total_account_value += abs(qty * oracle_price) if is_long: return oracle_price * ( 1 - (maintenance_margin_fraction * total_account_value / total_maintenance_margin_requirement)) elif is_short: return oracle_price * ( 1 + (maintenance_margin_fraction * total_account_value / total_maintenance_margin_requirement)) else: return None
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
Did you find a solution ?.
Unfortunatly no.
No branches or pull requests
Hi there,
I have been following the formula on the documentation but my numbers are always about 3 percent off. is there any example code that I can look into?
this is my code:
The text was updated successfully, but these errors were encountered: