Skip to content

Commit b12770c

Browse files
committed
fixes
1 parent 5e4984a commit b12770c

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/ExchangeSharp/API/Exchanges/BTSE/ExchangeBTSEAPI.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,29 @@ protected override async Task<IEnumerable<ExchangeOrderResult>> OnGetOpenOrderDe
127127
IsBuy = token["side"].Value<string>() == "BUY",
128128
Price = token["price"].Value<decimal>(),
129129
MarketSymbol = token["symbol"].Value<string>(),
130-
OrderDate = token["timestamp"].ConvertInvariant<long>().UnixTimeStampToDateTimeMilliseconds()
130+
OrderDate = token["timestamp"].ConvertInvariant<long>().UnixTimeStampToDateTimeMilliseconds(),
131+
ClientOrderId = token["clOrderID"].Value<string>(),
132+
Result = FromOrderState(token["orderState"].Value<string>())
131133
});
132134
}
133135

136+
private ExchangeAPIOrderResult FromOrderState(string s)
137+
{
138+
switch (s)
139+
{
140+
case "STATUS_ACTIVE":
141+
return ExchangeAPIOrderResult.Pending;
142+
case "ORDER_CANCELLED":
143+
return ExchangeAPIOrderResult.Canceled;
144+
case "ORDER_FULLY_TRANSACTED":
145+
return ExchangeAPIOrderResult.Filled;
146+
case "ORDER_PARTIALLY_TRANSACTED":
147+
return ExchangeAPIOrderResult.FilledPartially;
148+
default:
149+
return ExchangeAPIOrderResult.Unknown;
150+
}
151+
}
152+
134153
protected override async Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrderRequest request)
135154
{var payload = await GetNoncePayloadAsync();
136155

@@ -258,7 +277,7 @@ protected override async Task ProcessRequestAsync(IHttpWebRequest request, Dicti
258277
}
259278

260279
var hexSha384 = CryptoUtility.SHA384Sign(
261-
$"{request.RequestUri.PathAndQuery.Replace("/spot", string.Empty)}{nonce}{json}",
280+
$"{request.RequestUri.AbsolutePath.Replace("/spot", string.Empty)}{nonce}{json}",
262281
passphrase);
263282
request.AddHeader("btse-sign", hexSha384);
264283
request.AddHeader("btse-nonce", nonce);

0 commit comments

Comments
 (0)