예제 #1
0
def mock_binance(accounting_data_dir, inquirer):
    binance = Binance(b'', b'', inquirer, accounting_data_dir)
    this_dir = os.path.dirname(os.path.abspath(__file__))
    json_path = Path(this_dir).parent / 'tests' / 'utils' / 'data' / 'binance_exchange_info.json'
    with json_path.open('r') as f:
        json_data = json.loads(f.read())

    binance._symbols_to_pair = create_binance_symbols_to_pair(json_data)
    binance.first_connection_made = True
    return binance
예제 #2
0
    def __init__(self) -> None:
        this_dir = os.path.dirname(os.path.abspath(__file__))
        root_dir = Path(this_dir).parent.parent.parent
        json_path = (root_dir / 'rotkehlchen' / 'tests' / 'utils' / 'data' /
                     'binance_exchange_info.json')
        with json_path.open('r') as f:
            self._exchange_info = json.loads(f.read())

        self._symbols_to_pair = create_binance_symbols_to_pair(
            self._exchange_info)

        self.trades_list: List[Dict[str, Any]] = []
        self.balances_dict: Dict[str, FVal] = {}
        self.deposits_ledger: List[Dict[str, Any]] = []
        self.withdrawals_ledger: List[Dict[str, Any]] = []
예제 #3
0
def mock_binance(accounting_data_dir, inquirer):  # pylint: disable=unused-argument
    binance = Binance(
        api_key=base64.b64encode(make_random_b64bytes(128)),
        secret=base64.b64encode(make_random_b64bytes(128)),
        data_dir=accounting_data_dir,
        msg_aggregator=MessagesAggregator(),
    )
    this_dir = os.path.dirname(os.path.abspath(__file__))
    json_path = Path(
        this_dir
    ).parent / 'tests' / 'utils' / 'data' / 'binance_exchange_info.json'
    with json_path.open('r') as f:
        json_data = json.loads(f.read())

    binance._symbols_to_pair = create_binance_symbols_to_pair(json_data)
    binance.first_connection_made = True
    return binance