ericls / huobi

Huobi python sdk
MIT License
19 stars 10 forks source link

Client orders default value error #4

Closed Jay54520 closed 6 years ago

Jay54520 commented 6 years ago

For

client.orders(symbol='xrpusdt', states='submitted').data

the request params are

{'symbol': 'xrpusdt', 'types': None, 'start_date': None, 'end_date': None, 'states': 'submitted', 'from': None, 'direct': None, 'size': None}

which will raise HuobiRestiApiError: base-argument-unsupported: param None unsupported.

The reason is the default none value for orders should be '' instead of None.

# huobi/rest/endpoint.py:143
param_value = kwargs.get(
    param_name,
    param_spec.get('default')
    # Should be this
    # param_spec.get('default', '')
)
Jay54520 commented 6 years ago

And I also wish to take this opportunity to explicitly define the rule of the default value and how to make sure that the rule can be executed integrally. And this can be discussed in a new issue.

ericls commented 6 years ago

fixed in 9f445494e5bbe62994b90065f3f5ce5621e7f341 I think it was actually an error on line 186 https://github.com/ericls/huobi/blob/9f445494e5bbe62994b90065f3f5ce5621e7f341/huobi/rest/endpoint.py#L185