@@ -198,7 +198,7 @@ func (client *Client) handleResponseData(
198198//
199199// Arguments:
200200//
201- // Currencies([]CurrenciesType) // Optional. A list of currencies ids
201+ // Currencies([]CurrenciesType) // Optional. A list of currencies ids. If empty gets for all currencies
202202// PreferredNetwork(String) // Optional. Code of the default network of the currency
203203func (client * Client ) GetCurrencies (
204204 ctx context.Context ,
@@ -228,7 +228,7 @@ func (client *Client) GetCurrency(
228228 }
229229 err = client .publicGet (
230230 ctx ,
231- endpointCurrency + "/" + params ["currency" ].(string ),
231+ endpointCurrency + "/" + params [internal . ArgNameCurrency ].(string ),
232232 nil ,
233233 & result ,
234234 )
@@ -245,7 +245,7 @@ func (client *Client) GetCurrency(
245245//
246246// Arguments:
247247//
248- // Symbols([]string) // Optional. A list of symbol ids
248+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
249249func (client * Client ) GetSymbols (
250250 ctx context.Context ,
251251 arguments ... args.Argument ,
@@ -276,7 +276,7 @@ func (client *Client) GetSymbol(
276276 }
277277 err = client .publicGet (
278278 ctx ,
279- endpointSymbol + "/" + params ["symbol" ].(string ),
279+ endpointSymbol + "/" + params [internal . ArgNameSymbol ].(string ),
280280 nil ,
281281 & result ,
282282 )
@@ -291,7 +291,7 @@ func (client *Client) GetSymbol(
291291//
292292// Arguments:
293293//
294- // Symbols([]string) // Optional. A list of symbol ids
294+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
295295func (client * Client ) GetTickers (
296296 ctx context.Context ,
297297 arguments ... args.Argument ,
@@ -320,7 +320,7 @@ func (client *Client) GetTickerOfSymbol(
320320 }
321321 err = client .publicGet (
322322 ctx ,
323- endpointTicker + "/" + params ["symbol" ].(string ),
323+ endpointTicker + "/" + params [internal . ArgNameSymbol ].(string ),
324324 nil ,
325325 & result ,
326326 )
@@ -384,7 +384,7 @@ func (client *Client) GetPricesHistory(
384384//
385385// Arguments:
386386//
387- // Symbols([]string) // Optional. A list of symbol ids
387+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
388388func (client * Client ) GetTickerLastPrices (
389389 ctx context.Context ,
390390 arguments ... args.Argument ,
@@ -416,7 +416,7 @@ func (client *Client) GetTickerLastPricesOfSymbol(
416416 }
417417 err = client .publicGet (
418418 ctx ,
419- endpointPriceTicker + "/" + params ["symbol" ].(string ),
419+ endpointPriceTicker + "/" + params [internal . ArgNameSymbol ].(string ),
420420 params ,
421421 & result ,
422422 )
@@ -433,7 +433,7 @@ func (client *Client) GetTickerLastPricesOfSymbol(
433433//
434434// Arguments:
435435//
436- // Symbols([]string) // Optional. A list of symbol ids
436+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
437437// SortBy(SortByType) // Optional. Sorting parameter. SortByID or SortByTimestamp. Default is SortByTimestamp
438438// Sort(SortType) // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
439439// From(string) // Optional. Initial value of the queried interval
@@ -473,7 +473,7 @@ func (client *Client) GetTradesOfSymbol(
473473 }
474474 err = client .publicGet (
475475 ctx ,
476- endpointTrade + "/" + params ["symbol" ].(string ),
476+ endpointTrade + "/" + params [internal . ArgNameSymbol ].(string ),
477477 params ,
478478 & result ,
479479 )
@@ -490,7 +490,7 @@ func (client *Client) GetTradesOfSymbol(
490490//
491491// Arguments:
492492//
493- // Symbols([]string) // Optional. A list of symbol ids
493+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
494494// Depth(int) // Optional. Order Book depth. Default value is 100. Set to 0 to view the full Order Book
495495func (client * Client ) GetOrderbooks (
496496 ctx context.Context ,
@@ -536,7 +536,7 @@ func (client *Client) GetOrderBookOfSymbol(
536536 }
537537 err = client .publicGet (
538538 ctx ,
539- endpointOrderbook + "/" + params ["symbol" ].(string ),
539+ endpointOrderbook + "/" + params [internal . ArgNameSymbol ].(string ),
540540 params ,
541541 & response ,
542542 )
@@ -576,7 +576,7 @@ func (client *Client) GetOrderBookVolumeOfSymbol(
576576 }
577577 err = client .publicGet (
578578 ctx ,
579- endpointOrderbook + "/" + params ["symbol" ].(string ),
579+ endpointOrderbook + "/" + params [internal . ArgNameSymbol ].(string ),
580580 params ,
581581 & response ,
582582 )
@@ -587,7 +587,7 @@ func (client *Client) GetOrderBookVolumeOfSymbol(
587587
588588// GetCandles gets a map of candles for all symbols or for specified symbols
589589//
590- // # Candels are used for OHLC representation
590+ // # Candles are used for OHLC representation
591591//
592592// The result contains candles with non-zero volume only (no trades = no candles)
593593//
@@ -597,7 +597,7 @@ func (client *Client) GetOrderBookVolumeOfSymbol(
597597//
598598// Arguments:
599599//
600- // Symbols([]string) // A list of symbol ids
600+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
601601// Period(PeriodType) // Optional. A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month. Default is Period30Minutes
602602// Sort(SortType) // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
603603// From(string) // Optional. Initial value of the queried interval. As DateTime
@@ -608,13 +608,13 @@ func (client *Client) GetCandles(
608608 arguments ... args.Argument ,
609609) (result map [string ][]models.Candle , err error ) {
610610 params , _ := args .BuildParams (arguments )
611- err = client .publicGet (ctx , endpointCandle , params , & result )
611+ err = client .publicGet (ctx , endpointCandles , params , & result )
612612 return
613613}
614614
615615// GetCandlesOfSymbol get candles of a symbol
616616//
617- // # Candels are used for OHLC representation
617+ // # Candles are used for OHLC representation
618618//
619619// The result contains candles with non-zero volume only (no trades = no candles)
620620//
@@ -641,13 +641,80 @@ func (client *Client) GetCandlesOfSymbol(
641641 }
642642 err = client .publicGet (
643643 ctx ,
644- endpointCandle + "/" + params ["symbol" ].(string ),
644+ endpointCandles + "/" + params [internal . ArgNameSymbol ].(string ),
645645 nil ,
646646 & result ,
647647 )
648648 return
649649}
650650
651+ // GetConvertedCandles gets candles regarding the last price converted to the target currency for all symbols or for the specified symbols
652+ //
653+ // # Candles are used for OHLC representation
654+ //
655+ // The result contains candles with non-zero volume only (no trades = no candles)
656+ //
657+ // Conversion from the symbol quote currency to the target currency is the mean of "best" bid price and "best" ask price in the order book. If there is no "best" bid of ask price, the last price is returned.
658+ //
659+ // # Requires no API key Access Rights
660+ //
661+ // https://api.exchange.cryptomkt.com/#candles
662+ //
663+ // Arguments:
664+ //
665+ // TargetCurrency(string) // Target currency for conversion
666+ // Symbols([]string) // Optional. A list of symbol ids. If empty then gets for all symbols
667+ // Period(PeriodType) // Optional. A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month. Default is Period30Minutes
668+ // Sort(SortType) // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
669+ // From(string) // Optional. Initial value of the queried interval. As DateTime
670+ // Till(string) // Optional. Last value of the queried interval. As DateTime
671+ // Limit(int) // Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000
672+ func (client * Client ) GetConvertedCandles (
673+ ctx context.Context ,
674+ arguments ... args.Argument ,
675+ ) (result models.ConvertedCandles , err error ) {
676+ params , err := args .BuildParams (arguments , internal .ArgNameTargetCurrency )
677+ if err != nil {
678+ return
679+ }
680+ err = client .publicGet (ctx , endpointConvertedCandles , params , & result )
681+ return
682+ }
683+
684+ // GetConvertedCandlesOfSymbol gets candles regarding the last price converted to the target currency for the specified symbol
685+ //
686+ // # Candles are used for OHLC representation
687+ //
688+ // The result contains candles with non-zero volume only (no trades = no candles)
689+ //
690+ // Conversion from the symbol quote currency to the target currency is the mean of "best" bid price and "best" ask price in the order book. If there is no "best" bid of ask price, the last price is returned.
691+ //
692+ // # Requires no API key Access Rights
693+ //
694+ // https://api.exchange.cryptomkt.com/#candles
695+ //
696+ // Arguments:
697+ //
698+ // TargetCurrency(string) // Target currency for conversion
699+ // Symbol(string) // A symbol id
700+ // Period(PeriodType) // Optional. A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month. Default is Period30Minutes
701+ // Sort(SortType) // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
702+ // From(string) // Optional. Initial value of the queried interval. As DateTime
703+ // Till(string) // Optional. Last value of the queried interval. As DateTime
704+ // Limit(int) // Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000
705+ // Offset(int) // Optional. Default is 0. Min is 0. Max is 100000
706+ func (client * Client ) GetConvertedCandlesOfSymbol (
707+ ctx context.Context ,
708+ arguments ... args.Argument ,
709+ ) (result models.ConvertedCandlesOfSymbol , err error ) {
710+ params , err := args .BuildParams (arguments , internal .ArgNameSymbol , internal .ArgNameTargetCurrency )
711+ if err != nil {
712+ return
713+ }
714+ err = client .publicGet (ctx , endpointConvertedCandles + "/" + params [internal .ArgNameSymbol ].(string ), params , & result )
715+ return
716+ }
717+
651718//////////////////
652719// SPOT TRADING //
653720//////////////////
@@ -728,7 +795,7 @@ func (client *Client) GetActiveSpotOrder(
728795 params , _ := args .BuildParams (arguments , internal .ArgNameClientOrderID )
729796 err = client .privateGet (
730797 ctx ,
731- endpointOrder + "/" + params ["client_order_id" ].(string ),
798+ endpointOrder + "/" + params [internal . ArgNameClientOrderID ].(string ),
732799 nil ,
733800 & result ,
734801 )
@@ -803,7 +870,7 @@ func (client *Client) ReplaceSpotOrder(
803870 if err != nil {
804871 return
805872 }
806- ClientOrderID := params ["client_order_id" ].(string )
873+ ClientOrderID := params [internal . ArgNameClientOrderID ].(string )
807874 delete (params , "client_order_id" )
808875 err = client .patch (ctx , endpointOrder + "/" + ClientOrderID , params , & result )
809876 return
@@ -898,7 +965,7 @@ func (client *Client) CancelSpotOrder(
898965 }
899966 err = client .delete (
900967 ctx ,
901- endpointOrder + "/" + params ["client_order_id" ].(string ),
968+ endpointOrder + "/" + params [internal . ArgNameClientOrderID ].(string ),
902969 nil ,
903970 & result ,
904971 )
@@ -1049,7 +1116,7 @@ func (client *Client) GetWalletBalanceOfCurrency(
10491116 }
10501117 err = client .privateGet (
10511118 ctx ,
1052- endpointWalletBalance + "/" + params ["currency" ].(string ),
1119+ endpointWalletBalance + "/" + params [internal . ArgNameCurrency ].(string ),
10531120 nil ,
10541121 & result )
10551122 if err != nil {
@@ -1262,7 +1329,7 @@ func (client *Client) WithdrawCryptoCommit(
12621329 response := models.BooleanResponse {}
12631330 err = client .put (
12641331 ctx ,
1265- endpointCryptoWithdraw + "/" + params ["id" ].(string ),
1332+ endpointCryptoWithdraw + "/" + params [internal . ArgNameID ].(string ),
12661333 nil ,
12671334 & response ,
12681335 )
@@ -1290,7 +1357,7 @@ func (client *Client) WithdrawCryptoRollback(
12901357 response := models.BooleanResponse {}
12911358 err = client .delete (
12921359 ctx ,
1293- endpointCryptoWithdraw + "/" + params ["id" ].(string ),
1360+ endpointCryptoWithdraw + "/" + params [internal . ArgNameID ].(string ),
12941361 nil ,
12951362 & response ,
12961363 )
@@ -1564,7 +1631,7 @@ func (client *Client) GetTransaction(
15641631 }
15651632 err = client .privateGet (
15661633 ctx ,
1567- endpointTransactions + "/" + params ["id" ].(string ),
1634+ endpointTransactions + "/" + params [internal . ArgNameID ].(string ),
15681635 nil ,
15691636 & result ,
15701637 )
0 commit comments