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)
939939 ClientOrderId = token [ "clientOrderId" ] . ToStringInvariant ( )
940940 } ;
941941
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 )
943950 {
944951 case "NEW" :
945- result . Result = ExchangeAPIOrderResult . Pending ;
946- break ;
947-
952+ return ExchangeAPIOrderResult . Pending ;
948953 case "PARTIALLY_FILLED" :
949- result . Result = ExchangeAPIOrderResult . FilledPartially ;
950- break ;
951-
954+ return ExchangeAPIOrderResult . FilledPartially ;
952955 case "FILLED" :
953- result . Result = ExchangeAPIOrderResult . Filled ;
954- break ;
955-
956+ return ExchangeAPIOrderResult . Filled ;
956957 case "CANCELED" :
958+ return amountFilled > 0 ? ExchangeAPIOrderResult . FilledPartiallyAndCancelled : ExchangeAPIOrderResult . Canceled ;
957959 case "PENDING_CANCEL" :
958960 case "EXPIRED" :
959961 case "REJECTED" :
960- result . Result = ExchangeAPIOrderResult . Canceled ;
961- break ;
962-
962+ return ExchangeAPIOrderResult . Canceled ;
963963 default :
964- result . Result = ExchangeAPIOrderResult . Error ;
965- break ;
964+ return ExchangeAPIOrderResult . Error ;
966965 }
967-
968- ParseAveragePriceAndFeesFromFills ( result , token [ "fills" ] ) ;
969-
970- return result ;
971966 }
972967
973968 private ExchangeOrderResult ParseTrade ( JToken token , string symbol )
You can’t perform that action at this time.
0 commit comments