@@ -331,30 +331,6 @@ private async Task<IEnumerable<ExchangeOrderResult>> QueryHistoryOrdersAsync(str
331331 return orders ;
332332 }
333333
334- //private async Task<IEnumerable<ExchangeOrderResult>> QueryClosedOrdersAsync(string symbol, string path)
335- //{
336- // List<ExchangeOrderResult> orders = new List<ExchangeOrderResult>();
337- // JToken result = await MakeJsonRequestAsync<JToken>(path, null, await GetNoncePayloadAsync());
338- // //result = result["closed"];
339- // foreach (JProperty order in result)
340- // {
341- // orders.Add(ParseOrder(order.Name, order.Value));
342- // }
343-
344- // //if (exchangeSymbolToNormalizedSymbol.TryGetValue(symbol, out string normalizedSymbol))
345- // //{
346- // // foreach (JProperty order in result)
347- // // {
348- // // if (normalizedSymbol == null || order.Value["descr"]["pair"].ToStringInvariant() == normalizedSymbol.ToUpperInvariant())
349- // // {
350- // // orders.Add(ParseOrder(order.Name, order.Value));
351- // // }
352- // // }
353- // //}
354-
355- // return orders;
356- //}
357-
358334 protected override async Task ProcessRequestAsync ( IHttpWebRequest request , Dictionary < string , object > payload )
359335 {
360336 if ( payload == null || PrivateApiKey == null || PublicApiKey == null || ! payload . ContainsKey ( "nonce" ) )
@@ -431,99 +407,7 @@ protected override async Task<IEnumerable<string>> OnGetMarketSymbolsAsync(bool
431407 }
432408
433409 protected internal override async Task < IEnumerable < ExchangeMarket > > OnGetMarketSymbolsMetadataAsync ( )
434- { //{"ADACAD": {
435- // "altname": "ADACAD",
436- // "wsname": "ADA/CAD",
437- // "aclass_base": "currency",
438- // "base": "ADA",
439- // "aclass_quote": "currency",
440- // "quote": "ZCAD",
441- // "lot": "unit",
442- // "pair_decimals": 6,
443- // "lot_decimals": 8,
444- // "lot_multiplier": 1,
445- // "leverage_buy": [],
446- // "leverage_sell": [],
447- // "fees": [
448- // [
449- // 0,
450- // 0.26
451- // ],
452- // [
453- // 50000,
454- // 0.24
455- // ],
456- // [
457- // 100000,
458- // 0.22
459- // ],
460- // [
461- // 250000,
462- // 0.2
463- // ],
464- // [
465- // 500000,
466- // 0.18
467- // ],
468- // [
469- // 1000000,
470- // 0.16
471- // ],
472- // [
473- // 2500000,
474- // 0.14
475- // ],
476- // [
477- // 5000000,
478- // 0.12
479- // ],
480- // [
481- // 10000000,
482- // 0.1
483- // ]
484- // ],
485- // "fees_maker": [
486- // [
487- // 0,
488- // 0.16
489- // ],
490- // [
491- // 50000,
492- // 0.14
493- // ],
494- // [
495- // 100000,
496- // 0.12
497- // ],
498- // [
499- // 250000,
500- // 0.1
501- // ],
502- // [
503- // 500000,
504- // 0.08
505- // ],
506- // [
507- // 1000000,
508- // 0.06
509- // ],
510- // [
511- // 2500000,
512- // 0.04
513- // ],
514- // [
515- // 5000000,
516- // 0.02
517- // ],
518- // [
519- // 10000000,
520- // 0
521- // ]
522- // ],
523- // "fee_volume_currency": "ZUSD",
524- // "margin_call": 80,
525- // "margin_stop": 40
526- //}}
410+ {
527411 var markets = new List < ExchangeMarket > ( ) ;
528412 JToken allPairs = await MakeJsonRequestAsync < JToken > ( "/0/public/AssetPairs" ) ;
529413 var res = ( from prop in allPairs . Children < JProperty > ( ) select prop ) . ToArray ( ) ;
@@ -552,6 +436,30 @@ protected internal override async Task<IEnumerable<ExchangeMarket>> OnGetMarketS
552436 return markets ;
553437 }
554438
439+ protected override async Task < ExchangeWithdrawalResponse > OnWithdrawAsync ( ExchangeWithdrawalRequest withdrawalRequest )
440+ {
441+ if ( ! string . IsNullOrEmpty ( withdrawalRequest . Address ) || string . IsNullOrEmpty ( withdrawalRequest . AddressTag ) )
442+ {
443+ throw new APIException ( $ "Kraken only supports withdrawals to addresses setup beforehand and identified by a 'key'. Set this key in the { nameof ( ExchangeWithdrawalRequest . AddressTag ) } property.") ;
444+ }
445+
446+ var request = new Dictionary < string , object >
447+ {
448+ [ "nonce" ] = await GenerateNonceAsync ( ) ,
449+ [ "asset" ] = withdrawalRequest . Currency ,
450+ [ "amount" ] = withdrawalRequest . Amount ,
451+ [ "key" ] = withdrawalRequest . AddressTag
452+ } ;
453+
454+ var result = await MakeJsonRequestAsync < JToken > ( "/0/private/Withdraw" , null , request , "POST" ) ;
455+
456+ return new ExchangeWithdrawalResponse
457+ {
458+ Id = result [ "refid" ] . ToString ( )
459+ } ;
460+ }
461+
462+
555463 protected override async Task < IEnumerable < KeyValuePair < string , ExchangeTicker > > > OnGetTickersAsync ( )
556464 {
557465 var marketSymbols = ( await GetMarketSymbolsAsync ( ) ) . ToArray ( ) ;
0 commit comments