(exchange, skipped_properties, method, entry, key, allow_null=True)
| 284 | |
| 285 | |
| 286 | def assert_fee_structure(exchange, skipped_properties, method, entry, key, allow_null=True): |
| 287 | log_text = log_template(exchange, method, entry) |
| 288 | key_string = string_value(key) |
| 289 | if isinstance(key, int): |
| 290 | assert isinstance(entry, list), 'fee container is expected to be an array' + log_text |
| 291 | assert key < len(entry), 'fee key ' + key_string + ' was expected to be present in entry' + log_text |
| 292 | else: |
| 293 | assert exchange.is_dictionary(entry), 'fee container is expected to be a dict' + log_text |
| 294 | assert key in entry, 'fee key "' + key + '" was expected to be present in entry' + log_text |
| 295 | fee_object = exchange.safe_value(entry, key) |
| 296 | assert fee_object is not None or allow_null, 'fee object is null' + log_text |
| 297 | # todo: remove undefined check to make stricter |
| 298 | if fee_object is not None: |
| 299 | assert 'cost' in fee_object, key_string + ' fee object should contain "cost" key' + log_text |
| 300 | if fee_object['cost'] is None: |
| 301 | return # todo: remove undefined check to make stricter |
| 302 | assert isinstance(fee_object['cost'], numbers.Real), key_string + ' "cost" must be numeric type' + log_text |
| 303 | # assertGreaterOrEqual (exchange, skippedProperties, method, feeObject, 'cost', '0'); # fee might be negative in the case of a rebate or reward |
| 304 | assert 'currency' in fee_object, '"' + key_string + '" fee object should contain "currency" key' + log_text |
| 305 | assert_currency_code(exchange, skipped_properties, method, entry, fee_object['currency']) |
| 306 | |
| 307 | |
| 308 | def assert_timestamp_order(exchange, method, code_or_symbol, items, ascending=True): |
nothing calls this directly
no test coverage detected
searching dependent graphs…