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 428 forks source link

how to i connect to Binance Future ? #291

Closed TarrahArshad closed 4 years ago

TarrahArshad commented 4 years ago

i need balance and position and order websocket subscription and price also

nikkozp commented 4 years ago

Hi. You can download the alpha version Install-Package Binance.Net -Version 5.1.0-alpha7

TarrahArshad commented 4 years ago

i installed but i can't find mewthod for subscripton inwebsocket for future

TarrahArshad commented 4 years ago

GetFuturesAccountBalance i can't find sample or document for this or other method

nikkozp commented 4 years ago
var Account = await Ws.SubscribeToUserDataUpdatesAsync(listenKey,
                Balance =>
                {

                },
                Position =>
                {

                },
                Order =>
                {

                },
                ListenKeyExpired =>
                {

                }).ConfigureAwait(false);
JKorf commented 4 years ago

The futures implementation is still in alpha release, so there are bound to be some things which aren't complete/not documented or just broken. If you have any questions or remarks just ask.

TarrahArshad commented 4 years ago

what is type of WS in ur code?

TarrahArshad commented 4 years ago
var Account = await Ws.SubscribeToUserDataUpdatesAsync(listenKey,
                Balance =>
                {

                },
                Position =>
                {

                },
                Order =>
                {

                },
                ListenKeyExpired =>
                {

                }).ConfigureAwait(false);

type of Ws ?

TarrahArshad commented 4 years ago
var Account = await Ws.SubscribeToUserDataUpdatesAsync(listenKey,
                Balance =>
                {

                },
                Position =>
                {

                },
                Order =>
                {

                },
                ListenKeyExpired =>
                {

                }).ConfigureAwait(false);

what is listenKey ?

nikkozp commented 4 years ago
BinanceFuturesSocketClient Ws = new BinanceFuturesSocketClient();
BinanceFuturesClient Client = new BinanceFuturesClient();

Client.SetApiCredentials(ApiKey, SecretKey);
Ws.SetApiCredentials(ApiKey, SecretKey);

var listenKey = await Client.StartUserStreamAsync().ConfigureAwait(false);

var Account = await Ws.SubscribeToUserDataUpdatesAsync(listenKey,
                Balance =>
                {

                },
                Position =>
                {

                },
                Order =>
                {

                },
                ListenKeyExpired =>
                {

                }).ConfigureAwait(false);
TarrahArshad commented 4 years ago

[image: image.png] again error

On Tue, Mar 17, 2020 at 3:04 AM Mykyta Kochetkov notifications@github.com wrote:

BinanceFuturesSocketClient Ws = new BinanceFuturesSocketClient();BinanceFuturesClient Client = new BinanceFuturesClient(); Client.SetApiCredentials(ApiKey, SecretKey);Ws.SetApiCredentials(ApiKey, SecretKey); var listenKey = await Client.StartUserStreamAsync().ConfigureAwait(false); var Account = await Ws.SubscribeToUserDataUpdatesAsync(listenKey, Balance => {

            },
            Position =>
            {

            },
            Order =>
            {

            },
            ListenKeyExpired =>
            {

            }).ConfigureAwait(false);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JKorf/Binance.Net/issues/291#issuecomment-599804479, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRXVHIMH4SGL6VQ4PO4U5LRH2ZO3ANCNFSM4LMAIXQQ .

image

nikkozp commented 4 years ago

listenKey.Data

TarrahArshad commented 4 years ago

[image: image.png]

On Mon, Mar 16, 2020 at 9:16 PM Jan Korf notifications@github.com wrote:

The futures implementation is still in alpha release, so there are bound to be some things which aren't complete/not documented or just broken. If you have any questions or remarks just ask.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JKorf/Binance.Net/issues/291#issuecomment-599674210, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRXVHM5XEOP72UKECGSQYLRHZQXZANCNFSM4LMAIXQQ .

TarrahArshad commented 4 years ago

now code work without error but i have error in
var bf = Client.GetFuturesAccountBalance();

signatuyre erroir

nikkozp commented 4 years ago

Checked on the testnet Client.GetFuturesAccountBalance(); - working

TarrahArshad commented 4 years ago

but i'm on mainnet

nikkozp commented 4 years ago

it doesn't matter. what version of alpha do you use? and what error does it give you

TarrahArshad commented 4 years ago

alpha version Install-Package Binance.Net -Version 5.1.0-alpha7

TarrahArshad commented 4 years ago

it doesn't matter. what version of alpha do you use? and what error does it give you

Hi. You can download the alpha version Install-Package Binance.Net -Version 5.1.0-alpha7

nikkozp commented 4 years ago

I use it

TarrahArshad commented 4 years ago

I use it

why erro ?

nikkozp commented 4 years ago

show me your error

TarrahArshad commented 4 years ago

show me your error

show me your error

http://snap.ashampoo.com/YTPCBQLi5jeoxmFrXVEtPkvsqtP4gCIaWyCYJOBhXgvqs3clRh9cRuUCif9OHHO0

nikkozp commented 4 years ago

check your secret key

TarrahArshad commented 4 years ago

check your secret key

its correct on sport wallet work fine but oin future not work and i checked future feature checked

nikkozp commented 4 years ago

for spot and futures, do you use different keys?

TarrahArshad commented 4 years ago

for spot and futures, do you use different keys?

no i use same

nikkozp commented 4 years ago

separate keys are created for futures

TarrahArshad commented 4 years ago

separate keys are created for futures

where i create ? i use mainnet no test

TarrahArshad commented 4 years ago

http://snap.ashampoo.com/8X5vXbSwNcUiDctCxQoFLt1hlMNl5Eh35erUFfmthc3lepN4A5cMq6T3KChHhOeE

see just i ckecked future but not work

TarrahArshad commented 4 years ago

Checked on the testnet Client.GetFuturesAccountBalance(); - working

what is testnet how to i create testnet api and how to set testnet ?

nikkozp commented 4 years ago
public BinanceFuturesClient Client = new BinanceFuturesClient(new BinanceFuturesClientOptions("https://testnet.binancefuture.com")
        {
            LogVerbosity = LogVerbosity.Debug,
            LogWriters = new List<TextWriter> { Console.Out }
        });
TarrahArshad commented 4 years ago
public BinanceFuturesClient Client = new BinanceFuturesClient(new BinanceFuturesClientOptions("https://testnet.binancefuture.com")
        {
            LogVerbosity = LogVerbosity.Debug,
            LogWriters = new List<TextWriter> { Console.Out }
        });

where i can crate testnetapi ? an what is mainnet address ?

TarrahArshad commented 4 years ago

error is stile http://snap.ashampoo.com/kmCwlv8LCYfxSEZXxuAuPMl21xF02NPg1s5gI2sluXdi57busBJCoU7JMejIRYOM

TarrahArshad commented 4 years ago

solved now work fine

TarrahArshad commented 4 years ago

on mainnet code work fine but in testnet not work show invalid api. i not found api area for testaccount u can help me?

TarrahArshad commented 4 years ago

http://snap.ashampoo.com/BDsznEtvYjPwozjsuzs8QX0wfIaVKdgmhygu7ZKxD2osvXfkRxIDqIZvrZL57sjf

TarrahArshad commented 4 years ago

your code not work on testnet i have error can't continue

nikkozp commented 4 years ago

One key for spot and futures, and another for testnet

TarrahArshad commented 4 years ago

One key for spot and futures, and another for testnet

where i can crate api key for testnet ?

nikkozp commented 4 years ago

https://testnet.binancefuture.com/en/futures/BTCUSDT image

TarrahArshad commented 4 years ago

https://testnet.binancefuture.com/en/futures/BTCUSDT image

now i connected and work fine but event of order and balance and position after updates not handle

            var Account = await Ws.SubscribeToUserDataUpdatesAsync(listenKey.Data,
                            Balance =>
                            {
                                //  label1.Text = Balance.WalletBalance.ToString();

                            },
                            Position =>
                            {
                                grvPosition.DataSource = Position;
                            },
                            Order =>
                            {
                                grvPosition.DataSource = Order;

                            },
                            ListenKeyExpired =>
                            {

                            }).ConfigureAwait(false);
nikkozp commented 4 years ago

year, error on JsonProperty send PR #293 https://github.com/JKorf/Binance.Net/pull/293/commits/4889ebd0237fbf00f21e3febcac1129642bc94e2

TarrahArshad commented 4 years ago

year, error on JsonProperty send PR #293 4889ebd

but nothing show error . code do not have a error

nikkozp commented 4 years ago

You have 2 options

  1. Wait for @JKorf to add my PR
  2. Use my fork to test the update now
TarrahArshad commented 4 years ago

You have 2 options

  1. Wait for @JKorf to add my PR
  2. Use my fork to test the update now

how to test ur fork ? update ?

nikkozp commented 4 years ago

download and Compile Binance.Net from my account

TarrahArshad commented 4 years ago

download and Compile Binance.Net from my account

download or update byt nuget ?

nikkozp commented 4 years ago

No, without nuget, just as a project

TarrahArshad commented 4 years ago

No, without nuget, just as a project

but i need use my current project how to add to my project i never before use that

JKorf commented 4 years ago

I've pushed alpha8 version to nuget, should be available in a few minutes