JKorf / Binance.Net

A C# .netstandard client library for the Binance REST and Websocket Spot and Futures API focusing on clear usage and models
https://jkorf.github.io/Binance.Net/
MIT License
1.04k stars 429 forks source link

GetKlinesAsync returns nothing #356

Closed ng-designs closed 4 years ago

ng-designs commented 4 years ago

Hi, thanks for your work. I try to get klines: using (restClient = new BinanceClient()) { var result = await restClient.GetKlinesAsync ( cbSymbols.Text.ToString(), KlineInterval.TwelveHour, null, null, 1000 ); }

and when i try to print klines count: Console.Writeline("Candles count - ", result.Data.Count()); i getting exception that result.Data.Count() returns null.

Is there are any requirements for get klines from spot market? When i try with BinanceFuturesClient, data will come successfull.

JKorf commented 4 years ago

Hi, when executing your code it works fine for me. Are you using a correct symbol? If you're still having issues, please enable debug logging new BinanceClient(new BinanceClientOptions { LogVerbosity = LogVerbosityDebug }) and check the output.

Hulkstance commented 4 years ago

Either you symbol is incorrect or startTime/endTime. Make sure your nuget package is up to date.

Kudwig commented 4 years ago

also make sure your parsing is correct

ng-designs commented 4 years ago

Hi, when executing your code it works fine for me. Are you using a correct symbol? If you're still having issues, please enable debug logging new BinanceClient(new BinanceClientOptions { LogVerbosity = LogVerbosityDebug }) and check the output.

Hi, i get symbol from combobox, but there is no difference when i replace it with "btcusdt"(or any other currencies pair). This from debug output: Debug | Sending GET request to https://api.binance.com/api/v3/klines?symbol=ltcusdt&interval=1h&limit=1000 Debug | Error received: {"code":-1100,"msg":"Illegal characters found in parameter 'symbol'; legal range is '^[A-Z0-9-_.]{1,20}$'."}

I don't understand what goes wrong, because if i replace "BinanceClient" to "BinanceFuturesClient", without any other changes in code, all works fine.

Hulkstance commented 4 years ago

BTCUSDT - copy and paste this and stop using ENG international standard.

Use: image

JKorf commented 4 years ago

The issue is you're using lower case symbol name. Appearantly the futures API accepts both lower and upper case symbols, but the spot API only accepts upper case symbol names.