MCPcopy
hub / github.com/owocki/pytrader / calculate_profitability_exchange_rates

Method calculate_profitability_exchange_rates

history/models.py:175–184  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

173 self.usd_fee_amount = exchange_rate_btc_to_usd * self.btc_fee_amount
174
175 def calculate_profitability_exchange_rates(self):
176 from history.tools import get_exchange_rate_to_btc, get_exchange_rate_btc_to_usd
177 ticker = ''
178 for this_ticker in self.symbol.split('_'):
179 if this_ticker != 'BTC':
180 ticker = this_ticker
181 exchange_rate_coin_to_btc = get_exchange_rate_to_btc(ticker)
182 exchange_rate_btc_to_usd = get_exchange_rate_btc_to_usd()
183 self.btc_net_profit = exchange_rate_coin_to_btc * self.net_profit
184 self.usd_net_profit = exchange_rate_btc_to_usd * self.btc_net_profit
185
186 def __str__(self):
187 return 'Trade {}'.format(self.pk)

Callers 1

handleMethod · 0.80

Calls 2

get_exchange_rate_to_btcFunction · 0.90

Tested by

no test coverage detected