Closed InTheta closed 6 years ago
Hello @ColossusFX,
I believe the issue here is that the AddParameterIfNotNull
method is for adding query string parameters to the request, but the parameters that GDAX is expecting is a json object in the body. Something like this should work:
internal class SubmitMarketOrderRequest
{
[JsonProperty("type")]
public String Type { get; } = "market";
[JsonProperty("product_id")]
public String ProductId { get; set; }
[JsonProperty("side")]
public Side Side { get; set; }
[JsonProperty("size")]
public Decimal Size { get; set; }
}
public async Task<Order> SubmitMarketOrderBySize(Side side, String productId, Double size)
{
var model = new SubmitMarketOrderRequest
{
Side = side,
ProductId = productId,
Size = size
};
var request = new GdaxRequestBuilder("/orders", HttpMethod.Post)
//.AddBody(model)
.Build();
//TODO: There should be an AddBody method on the request builder that does this.
request.RequestBody = JsonConvert.Serialize(model);
return (await this.GetResponse<Order>(request).ConfigureAwait(false)).Value;
}
Thanks for replying. It's hard to edit other people's code. Yes I was going over all functions earlier realized I had to serialize the Post message. I will push the branch after I have tested it all. Thanks again
I know you have not implemented any Post requests, but when I am sending a post request for an order or withdrawal, it does not seem to pass any params.
I have added the params, and also tried with no Post params at all, and the error is always ;
{"message":"Missing product_id"} {"message":"currency is required"}