Ejemplo n.º 1
0
    def query_balances(self, save_data=False):
        if isinstance(save_data, str) and (save_data == 'save' or save_data == 'True'):
            save_data = True

        result = self.rotkehlchen.query_balances(save_data)
        print(pretty_json_dumps(result))
        return process_result(result)
Ejemplo n.º 2
0
 def process_trade_history(self, start_ts, end_ts):
     start_ts = int(start_ts)
     end_ts = int(end_ts)
     result, error_or_empty = self.rotkehlchen.process_history(
         start_ts, end_ts)
     response = {'result': result, 'message': error_or_empty}
     return process_result(response)
Ejemplo n.º 3
0
    def query_exchange_balances(self, name):
        res = {'name': name}
        balances, msg = getattr(self.rotkehlchen, name).query_balances()
        if balances is None:
            res['error'] = msg
        else:
            res['balances'] = balances

        return process_result(res)
Ejemplo n.º 4
0
    def query_trade_history(self, location, start_ts, end_ts):
        start_ts = int(start_ts)
        end_ts = int(end_ts)
        if location == 'all':
            return self.rotkehlchen.trades_historian.get_history(start_ts, end_ts)

        try:
            exchange = getattr(self.rotkehlchen, location)
        except AttributeError:
            raise "Unknown location {} given".format(location)

        return process_result(exchange.query_trade_history(start_ts, end_ts, end_ts))
Ejemplo n.º 5
0
    def query_ledgers(self, ledger_type: str):
        if ledger_type == 'all':
            result_list = self.deposits_ledger
            result_list.extend(self.withdrawals_ledger)
        elif ledger_type == 'deposit':
            result_list = self.deposits_ledger
        elif ledger_type == 'withdrawal':
            result_list = self.withdrawals_ledger
        else:
            raise ValueError(f'Invalid ledger_type {ledger_type} requested')

        response = {'result': result_list, 'error': []}
        return process_result(response)
Ejemplo n.º 6
0
 def query_fiat_balances(self):
     res = self.rotkehlchen.query_fiat_balances()
     return process_result(res)
Ejemplo n.º 7
0
 def query_blockchain_balances(self):
     result, empty_or_error = self.rotkehlchen.blockchain.query_balances()
     return process_result({'result': result, 'message': empty_or_error})
Ejemplo n.º 8
0
 def query_otctrades(self):
     trades = self.rotkehlchen.data.get_external_trades()
     return process_result(trades)
Ejemplo n.º 9
0
 def get_settings(self):
     return process_result(self.rotkehlchen.data.db.get_settings())
Ejemplo n.º 10
0
 def get_fiat_exchange_rates(self, currencies):
     res = {'exchange_rates': get_fiat_usd_exchange_rates(currencies)}
     return process_result(res)
Ejemplo n.º 11
0
 def query_blockchain_balances(self):
     balances = self.rotkehlchen.blockchain.query_balances()
     return process_result(balances)
Ejemplo n.º 12
0
 def get_fiat_exchange_rates(self, currencies):
     rates = self.rotkehlchen.inquirer.get_fiat_usd_exchange_rates(
         currencies)
     res = {'exchange_rates': rates}
     return process_result(res)
Ejemplo n.º 13
0
 def query_trade_history(self):
     trades_length = len(self.trades_dict)
     response = {'result': {'trades': self.trades_dict, 'count': trades_length}, 'error': []}
     return process_result(response)
Ejemplo n.º 14
0
 def query_balances(self):
     response = {'result': self.balances_dict, 'error': []}
     return process_result(response)
Ejemplo n.º 15
0
 def query_periodic_data(self):
     """Will query for some client data that can change frequently"""
     result = {}
     result['last_balance_save'] = self.rotkehlchen.data.db.get_last_balance_save_time()
     result['eth_node_connection'] = self.rotkehlchen.blockchain.ethchain.connected
     return process_result(result)
Ejemplo n.º 16
0
 def query_periodic_data(self):
     """Will query for some client data that can change frequently"""
     result = self.rotkehlchen.query_periodic_data()
     return process_result(result)
Ejemplo n.º 17
0
 def get_eth_tokens(self):
     result = {
         'all_eth_tokens': self.rotkehlchen.data.eth_tokens,
         'owned_eth_tokens': self.rotkehlchen.blockchain.eth_tokens
     }
     return process_result(result)
Ejemplo n.º 18
0
 def query_otctrades(self):
     trades = self.rotkehlchen.data.get_external_trades()
     result = {'result': trades, 'message': ''}
     return process_result(result)