Comments (3)
Should work, what do you mean with 'not able to get the values'?
from binance.net.
I run BinanceDataCollector for two coins. However they are in different thread, still values are confusing. (coinName gives coinName2's value, etc).
dataCollector = new Thread(() =>
{
while (true)
{
BinanceDataCollector(coinName, instantTradeData, totalTradeAmount);
BinanceDataCollector(coinName2, instantTradeData2, totalTradeAmount2);
}
});
public async void BinanceDataCollector(string coin, TradeData instantTradeData, decimal dataAmount)
{ BinanceSocketClient binanceSocketClient = binance.getBinanceSocketClient();
// Local variables to store prices for the current coin
double spotAskPriceLocal = 0;
double spotBidPriceLocal = 0;
double futuresAskPriceLocal = 0;
double futuresBidPriceLocal = 0;
var tickerSubscriptionResultSpot = binanceSocketClient.SpotApi.ExchangeData.SubscribeToTickerUpdatesAsync(coin, (update) =>
{
spotAskPriceLocal = Convert.ToDouble(update.Data.BestAskPrice);
spotBidPriceLocal = Convert.ToDouble(update.Data.BestBidPrice);
log.Error(update.Data);
}); var tickerSubscriptionTaskFutures = binanceSocketClient.UsdFuturesApi.SubscribeToOrderBookUpdatesAsync(coin, null, (update) =>
{
futuresAskPriceLocal = Convert.ToDouble(update.Data.Asks.First().Price);
futuresBidPriceLocal = Convert.ToDouble(update.Data.Bids.First().Price);
log.Error(update.Data);
});
// Wait for both subscriptions to complete
await Task.WhenAll(tickerSubscriptionResultSpot, tickerSubscriptionTaskFutures);
}
}
catch (Exception ex)
{
log.Error("Bot Error --> " + ex);
rtbSpotFutures.AppendText("Bot Error --> " + ex);
}
}
from binance.net.
I think you need to learn programming as first a little bit. BinanceSocketClient works perfectly.
from binance.net.
Related Issues (20)
- SimpleEarn => Signature for this request is not valid. HOT 2
- Missing AUTO_BORROW_REPAY HOT 1
- BinanceSocketClient - Can't connect to the server HOT 1
- GetMarginLoansAsync not adding a parameter to the parameter list HOT 1
- Issue with Nuget Package in Azure Functions project HOT 3
- StartUserStreamAsync, too many parameters, version 9.9.0 HOT 2
- Problem with latest version HOT 2
- BinanceRateLimit - Count Missing? HOT 2
- Universal Transfer has some missing transfer types HOT 2
- Hello, client.CoinFuturesApi.Account.GetIncomeHistoryAsync reports an error 404 HOT 1
- Is there a way to get borrow interest rates? HOT 2
- Binance changes since 2024-04-10
- Need add 'orderId' to BinancePayTrade HOT 3
- I want to see the USDT equivalents of my assets.
- Field Symbol on BinanceOrderBook in Empty
- Cannot use Library in Azure Functions HOT 1
- Binance: Failed to convert order status: "PENDING_NEW"
- binanceRestClient.SpotApi.ExchangeData.GetProductsAsync() is not working HOT 2
- UsdFuturesApi.SubscribeToUserDataUpdatesAsync HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binance.net.