def get_point_size_base_currency(self, instrument_code): point_size_instrument_currency = self.get_point_size(instrument_code) instrument_currency = self.get_currency(instrument_code) currency_data = currencyData(self.data) point_size_currency_value = currencyValue( instrument_currency, point_size_instrument_currency) value = currency_data.currency_value_in_base(point_size_currency_value) return value
def broker_get_account_value_across_currency_across_accounts(self) -> list: list_of_currencies = self._get_list_of_currencies_for_liquidation_values( ) list_of_values_per_currency = list([ currencyValue( currency, self._get_liquidation_value_for_currency_across_accounts( currency), ) for currency in list_of_currencies ]) return list_of_values_per_currency
def extract_totals_from_fill_data_for_contract_id( list_of_fills_for_contractid): """ Sum up info over fills :param list_of_fills: list of named tuples :return: broker_clientid, broker_tempid, filled_price, fill_datetime, commission (as list of tuples) """ qty_and_price_and_datetime_and_id = [( fill.cum_qty, fill.avg_price, fill.time, fill.temp_id, fill.client_id, fill.signed_qty, ) for fill in list_of_fills_for_contractid] # sort by total quantity qty_and_price_and_datetime_and_id.sort(key=lambda x: x[0]) final_fill = qty_and_price_and_datetime_and_id[-1] ( _, filled_price, fill_datetime, broker_tempid, broker_clientid, signed_qty, ) = final_fill commission = [ currencyValue(fill.commission_ccy, fill.commission) for fill in list_of_fills_for_contractid ] return ( broker_clientid, broker_tempid, filled_price, fill_datetime, commission, signed_qty, )
def _get_named_value_across_currency( self, named_value: str, account_id: str = arg_not_supplied) -> listOfCurrencyValues: list_of_currencies = self._get_list_of_currencies_for_named_values( named_value) list_of_values_per_currency = list([ currencyValue( currency, self._get_named_value_for_currency_across_accounts( currency, account_id=account_id, named_value=named_value), ) for currency in list_of_currencies ]) list_of_values_per_currency = listOfCurrencyValues( list_of_values_per_currency) return list_of_values_per_currency