@@ -241,7 +241,6 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAvailable
241
241
{
242
242
Currency = x [ "asset" ] . Value < string > ( ) ,
243
243
AvailableBalance = x [ "free" ] . Value < decimal > ( )
244
- + x [ "locked" ] . Value < decimal > ( )
245
244
}
246
245
)
247
246
. ToDictionary ( k => k . Currency , v => v . AvailableBalance ) ;
@@ -475,6 +474,51 @@ await _socket.SendMessageAsync(new WebSocketSubscription
475
474
}
476
475
) ;
477
476
}
477
+
478
+ protected override Task ProcessRequestAsync (
479
+ IHttpWebRequest request ,
480
+ Dictionary < string , object > ? payload
481
+ )
482
+ {
483
+ if (
484
+ CanMakeAuthenticatedRequest ( payload )
485
+ || ( payload == null && request . RequestUri . AbsoluteUri . Contains ( "userDataStream" ) )
486
+ )
487
+ {
488
+ request . AddHeader ( "X-MEXC-APIKEY" , PublicApiKey ! . ToUnsecureString ( ) ) ;
489
+ }
490
+ return base . ProcessRequestAsync ( request , payload ) ;
491
+ }
492
+
493
+ protected override Uri ProcessRequestUrl (
494
+ UriBuilder url ,
495
+ Dictionary < string , object > ? payload ,
496
+ string ? method
497
+ )
498
+ {
499
+ if ( CanMakeAuthenticatedRequest ( payload ) )
500
+ {
501
+ // payload is ignored, except for the nonce which is added to the url query - bittrex puts all the "post" parameters in the url query instead of the request body
502
+ var query = ( url . Query ?? string . Empty ) . Trim ( '?' , '&' ) ;
503
+ string newQuery =
504
+ "timestamp="
505
+ + payload ! [ "nonce" ] . ToStringInvariant ( )
506
+ + ( query . Length != 0 ? "&" + query : string . Empty )
507
+ + (
508
+ payload . Count > 1
509
+ ? "&" + CryptoUtility . GetFormForPayload ( payload , false )
510
+ : string . Empty
511
+ ) ;
512
+ string signature = CryptoUtility . SHA256Sign (
513
+ newQuery ,
514
+ CryptoUtility . ToUnsecureBytesUTF8 ( PrivateApiKey )
515
+ ) ;
516
+ newQuery += "&signature=" + signature ;
517
+ url . Query = newQuery ;
518
+ return url . Uri ;
519
+ }
520
+ return base . ProcessRequestUrl ( url , payload , method ) ;
521
+ }
478
522
479
523
private async Task < JToken > GetBalance ( )
480
524
{
@@ -515,6 +559,7 @@ private static ExchangeOrderResult ParseOrder(JToken token)
515
559
Amount = token [ "origQty" ] . ConvertInvariant < decimal > ( ) ,
516
560
AmountFilled = token [ "executedQty" ] . ConvertInvariant < decimal > ( ) ,
517
561
Price = token [ "price" ] . ConvertInvariant < decimal > ( ) ,
562
+ AveragePrice = token [ "price" ] . ConvertInvariant < decimal > ( ) ,
518
563
IsBuy = token [ "side" ] . ToStringInvariant ( ) == "BUY" ,
519
564
OrderDate = token [ "time" ] . ConvertInvariant < long > ( ) . UnixTimeStampToDateTimeMilliseconds ( ) ,
520
565
Result = ParseOrderStatus ( token [ "status" ] . ToStringInvariant ( ) )
0 commit comments