hugues31 / coinnect

Coinnect is a Rust library aiming to provide a complete access to main crypto currencies exchanges via REST API.
MIT License
148 stars 43 forks source link

Bitstamp API methods that require POST parameters are broken #56

Closed andygrove closed 6 years ago

andygrove commented 6 years ago

I tried placing an order with this code:

api.buy_market(Pair::BTC_USD, BigDecimal::from_str("0.001")

I get this error back from Bitstamp:

{"reason": String("Missing amount POST parameter"), "status": String("error")}

I looked at the code and I can see that buy_market calls private_query passing a params map containing the amount but the amount is not propagated in the actual HTTP request. It needs to be sent as a POST parameter.

andygrove commented 6 years ago

I was able to work around the issue by adding this in private_query but this is a bit of a hack.

        params.iter().for_each(|(k,v)| {
            post_params.insert(k,v);
        });
hugues31 commented 6 years ago

Hi! Thanks for the issue and the PR. I merge your PR before finding a better solution. This should now be fixed (#57)