File tree Expand file tree Collapse file tree 1 file changed +14
-19
lines changed
src/ExchangeSharp/API/Exchanges/BinanceGroup Expand file tree Collapse file tree 1 file changed +14
-19
lines changed Original file line number Diff line number Diff line change @@ -939,35 +939,30 @@ private ExchangeOrderResult ParseOrder(JToken token)
939
939
ClientOrderId = token [ "clientOrderId" ] . ToStringInvariant ( )
940
940
} ;
941
941
942
- switch ( token [ "status" ] . ToStringInvariant ( ) )
942
+ result . Result = ParseExchangeAPIOrderResult ( token [ "status" ] . ToStringInvariant ( ) , result . AmountFilled ) ;
943
+
944
+ return result ;
945
+ }
946
+
947
+ private ExchangeAPIOrderResult ParseExchangeAPIOrderResult ( string status , decimal amountFilled )
948
+ {
949
+ switch ( status )
943
950
{
944
951
case "NEW" :
945
- result . Result = ExchangeAPIOrderResult . Pending ;
946
- break ;
947
-
952
+ return ExchangeAPIOrderResult . Pending ;
948
953
case "PARTIALLY_FILLED" :
949
- result . Result = ExchangeAPIOrderResult . FilledPartially ;
950
- break ;
951
-
954
+ return ExchangeAPIOrderResult . FilledPartially ;
952
955
case "FILLED" :
953
- result . Result = ExchangeAPIOrderResult . Filled ;
954
- break ;
955
-
956
+ return ExchangeAPIOrderResult . Filled ;
956
957
case "CANCELED" :
958
+ return amountFilled > 0 ? ExchangeAPIOrderResult . FilledPartiallyAndCancelled : ExchangeAPIOrderResult . Canceled ;
957
959
case "PENDING_CANCEL" :
958
960
case "EXPIRED" :
959
961
case "REJECTED" :
960
- result . Result = ExchangeAPIOrderResult . Canceled ;
961
- break ;
962
-
962
+ return ExchangeAPIOrderResult . Canceled ;
963
963
default :
964
- result . Result = ExchangeAPIOrderResult . Error ;
965
- break ;
964
+ return ExchangeAPIOrderResult . Error ;
966
965
}
967
-
968
- ParseAveragePriceAndFeesFromFills ( result , token [ "fills" ] ) ;
969
-
970
- return result ;
971
966
}
972
967
973
968
private ExchangeOrderResult ParseTrade ( JToken token , string symbol )
You can’t perform that action at this time.
0 commit comments