@@ -244,11 +244,24 @@ protected override async Task<ExchangeOrderResult> OnGetOrderDetailsAsync(string
244244 payload [ "id" ] = orderId ;
245245 JObject result = await MakeJsonRequestAsync < JObject > ( url , null , payload , "POST" ) ;
246246
247- // status can be 'In Queue', 'Open' or 'Finished'
248- JArray transactions = result [ "transactions" ] as JArray ;
247+ var transactions = result [ "transactions" ] as JArray ;
248+ var anyTransaction = transactions . Any ( ) ;
249+
250+ // status can be 'Canceled', 'Open' or 'Finished'
251+ var statusCode = result . Value < string > ( "status" ) ;
252+ var status = GetOrderResultFromStatus ( statusCode , anyTransaction ) ;
253+
249254 // empty transaction array means that order is InQueue or Open and AmountFilled == 0
250255 // return empty order in this case. no any additional info available at this point
251- if ( ! transactions . Any ( ) ) { return new ExchangeOrderResult ( ) { OrderId = orderId } ; }
256+ if ( ! anyTransaction )
257+ {
258+ return new ExchangeOrderResult
259+ {
260+ OrderId = orderId ,
261+ Result = status ,
262+ ResultCode = statusCode
263+ } ;
264+ }
252265 JObject first = transactions . First ( ) as JObject ;
253266 List < string > excludeStrings = new List < string > ( ) { "tid" , "price" , "fee" , "datetime" , "type" , "btc" , "usd" , "eur" } ;
254267
@@ -291,7 +304,9 @@ protected override async Task<ExchangeOrderResult> OnGetOrderDetailsAsync(string
291304 MarketSymbol = _symbol ,
292305 AveragePrice = spentQuoteCurrency / amountFilled ,
293306 Price = price ,
294- } ;
307+ Result = status ,
308+ ResultCode = statusCode
309+ } ;
295310 }
296311
297312 protected override async Task < IEnumerable < ExchangeOrderResult > > OnGetOpenOrderDetailsAsync ( string marketSymbol = null )
@@ -322,7 +337,20 @@ protected override async Task<IEnumerable<ExchangeOrderResult>> OnGetOpenOrderDe
322337 return orders ;
323338 }
324339
325- public class BitstampTransaction
340+ private ExchangeAPIOrderResult GetOrderResultFromStatus ( string status , bool anyTransactions )
341+ {
342+ switch ( status ? . ToLower ( ) )
343+ {
344+ case "finished" : return ExchangeAPIOrderResult . Filled ;
345+ case "open" : return anyTransactions
346+ ? ExchangeAPIOrderResult . FilledPartially
347+ : ExchangeAPIOrderResult . Pending ;
348+ case "canceled" : return ExchangeAPIOrderResult . Canceled ;
349+ default : return ExchangeAPIOrderResult . Unknown ;
350+ }
351+ }
352+
353+ public class BitstampTransaction
326354 {
327355 public BitstampTransaction ( string id , DateTime dateTime , int type , string symbol , decimal fees , string orderId , decimal quantity , decimal price , bool isBuy )
328356 {
0 commit comments