Closed mchurlet closed 3 years ago
The issue is that when you create a client with options, it completely overrides the options set with the SetDefaultOptions method. So either move the BaseAddress =
to the SetDefaultOptions method or the other way around.
Thank you for your quick reply.
I still have an error.
The address is on testNet
I created the API key on https://testnet.binancefuture.com
Is this correct?
`
using (var client = new BinanceClient(new BinanceClientOptions()
{
BaseAddress = "https://testnet.binance.vision",
BaseAddressUsdtFutures = "https://testnet.binancefuture.com",
BaseAddressCoinFutures = "https://testnet.binancefuture.com",
ApiCredentials = new ApiCredentials(Constantes.KeyTest, Constantes.KeyTestP),
LogVerbosity = LogVerbosity.Debug,
LogWriters = new List
var clientIinfo = client.General.GetAccountInfo();
var clientBalance = clientIinfo.Data.Balances;
foreach (var item in clientBalance)
{
if (item.Total > 0)
{
Console.WriteLine(item.Asset + " " + item.Total);
}
}
}`
I put the log if it helps. The change of address is taken into account but the login fails.
2021/02/19 07:44:11:955 | Binance | Debug | [2] Creating request for https://testnet.binance.vision/api/v3/time 2021/02/19 07:44:11:955 | Binance | Debug | [2] Sending GET request to https://testnet.binance.vision/api/v3/time 2021/02/19 07:44:12:988 | Binance | Debug | [2] Response received in 1032ms: {"serverTime":1613720653670} 2021/02/19 07:44:12:988 | Binance | Info | Time offset set to 1714,6045ms 2021/02/19 07:44:12:991 | Binance | Debug | [3] Creating request for https://testnet.binance.vision/api/v3/account 2021/02/19 07:44:12:996 | Binance | Debug | [3] Sending GET signed request to https://testnet.binance.vision/api/v3/account?timestamp=1613720654705&recvWindow=5000&signature=5D6FA89727F35C5AC38B4DB9932C9011D0EED18F67CE2B2A67F535888EFA8E4D 'TB_Traiding.exe' (CLR v4.0.30319: TB_Traiding.exe) : Chargé 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_fr_b77a5c561934e089\System.resources.dll'. Le module a été généré sans symboles. 2021/02/19 07:44:14:088 | Binance | Debug | [3] Error received: {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
The API key/secret you entered are not correct for the Testnet. Make sure you have keys specifically for the Testnet, and make sure all API permissions are correctly set in your account.
I have tried with two different sets of keys recently created with two different accounts and it does not work. On the other hand I found an old key that I had put on Postman and there it works in my program c#. So I have a solution and I'll settle for it, even if I don't know why it doesn't work with the new keys. I have no explanation and I am sure of the keys that I checked on the test site and copy paste directly into my program.
Do you want me to close the log?
Thank you very much for your support.
The following code does not work on TestNet.
Error = {: No credentials provided for private endpoint} Binance | Warning | [3] Request /api/v3/account failed because no ApiCredentials were provided
It works fine on api.binance :
ETH 0,00000031 BNB 68,20931005 EUR 6,44510850
I have checked the keys which are good. Is there an error in my code?