def test_get_parameters(self): """ Test the get_parameters method """ parameters = {'abc': [3]} self.assertIsNone(get_param(parameters, 'abcd')) self.assertIsNotNone(get_param(parameters, 'abc'))
def create_ask_bid_from_params(parameters): """ Create an ask/bid from the provided parameters in a request. This method returns a tuple with the price, quantity and timeout of the ask/bid. """ timeout = 3600.0 if has_param(parameters, 'timeout'): timeout = float(get_param(parameters, 'timeout')) price = float(get_param(parameters, 'price')) quantity = float(get_param(parameters, 'quantity')) price_type = get_param(parameters, 'price_type') quantity_type = get_param(parameters, 'quantity_type') return price, price_type, quantity, quantity_type, timeout
def create_ask_bid_from_params(parameters): """ Create an ask/bid from the provided parameters in a request. This method returns a tuple with the price, quantity and timeout of the ask/bid. """ timeout = 3600 if has_param(parameters, 'timeout'): timeout = int(get_param(parameters, 'timeout')) first_asset_amount = int(get_param(parameters, 'first_asset_amount')) second_asset_amount = int(get_param(parameters, 'second_asset_amount')) first_asset_type = get_param(parameters, 'first_asset_type') second_asset_type = get_param(parameters, 'second_asset_type') return AssetPair(AssetAmount(first_asset_amount, first_asset_type), AssetAmount(second_asset_amount, second_asset_type)), timeout