Skip to content

Commit dad0ec7

Browse files
authored
removed order fetch after submission (#853)
1 parent f4ba38a commit dad0ec7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/ExchangeSharp/API/Exchanges/Coinbase/ExchangeCoinbaseAPI.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The above copyright notice and this permission notice shall be included in all c
1414
using Newtonsoft.Json.Linq;
1515
using System;
1616
using System.Collections.Generic;
17+
using System.Diagnostics;
1718
using System.Linq;
1819
using System.Threading.Tasks;
1920

@@ -450,10 +451,13 @@ protected override async Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrd
450451

451452
try
452453
{
453-
JToken result = await MakeJsonRequestAsync<JToken>($"/orders", payload: payload, requestMethod: "POST" );
454-
// The Post doesn't return with any status, just a new OrderId. To get the Order Details we have to reQuery.
455-
return await OnGetOrderDetailsAsync(result[ORDERID].ToStringInvariant());
456-
}
454+
JToken jtokenResult = await MakeJsonRequestAsync<JToken>($"/orders", payload: payload, requestMethod: "POST" );
455+
var orderResult = ParseOrder(jtokenResult["success_response"]);
456+
Debug.Assert(jtokenResult.Value<bool>("success") == true);
457+
// the jtokenResult doesn't have the order status inside the "success_response" portion, but rather outside of it, so need to set it manually
458+
orderResult.Result = ExchangeAPIOrderResult.PendingOpen;
459+
return orderResult;
460+
}
457461
catch (Exception ex) // All fails come back with an exception.
458462
{
459463
Logger.Error(ex, "Failed to place coinbase error");

0 commit comments

Comments
 (0)