mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-02-16 14:13:46 +00:00
wip
This commit is contained in:
parent
0ad94cce5a
commit
a750075022
@ -48,6 +48,7 @@ namespace CryptoExchange.Net.Trackers.UserData
|
||||
private TimeSpan _pollIntervalDisconnected;
|
||||
private bool _pollAtStart;
|
||||
private bool _onlyTrackProvidedSymbols;
|
||||
private bool _trackTrades = true;
|
||||
|
||||
// Subscriptions
|
||||
private UpdateSubscription? _balanceSubscription;
|
||||
@ -106,6 +107,7 @@ namespace CryptoExchange.Net.Trackers.UserData
|
||||
_symbols = config.Symbols?.ToList() ?? [];
|
||||
_onlyTrackProvidedSymbols = config.OnlyTrackProvidedSymbols;
|
||||
_pollAtStart = config.PollAtStart;
|
||||
_trackTrades = config.TrackTrades;
|
||||
|
||||
UserIdentifier = userIdentifier;
|
||||
}
|
||||
@ -160,7 +162,7 @@ namespace CryptoExchange.Net.Trackers.UserData
|
||||
_orderSubscription = subOrderResult.Data;
|
||||
subOrderResult.Data.SubscriptionStatusChanged += OrderSubscriptionStatusChanged;
|
||||
|
||||
if (_userTradeSocketClient != null)
|
||||
if (_userTradeSocketClient != null && _trackTrades)
|
||||
{
|
||||
var subTradeResult = await _userTradeSocketClient.SubscribeToUserTradeUpdatesAsync(new SubscribeUserTradeRequest(listenKey), x => HandleTradeUpdate(UpdateSource.Push, x.Data), ct: _cts.Token).ConfigureAwait(false);
|
||||
if (!subOrderResult)
|
||||
@ -604,6 +606,8 @@ namespace CryptoExchange.Net.Trackers.UserData
|
||||
HandleOrderUpdate(UpdateSource.Poll, relevantOrders);
|
||||
}
|
||||
|
||||
if (_trackTrades)
|
||||
{
|
||||
var fromTimeTrades = _lastDataTimeTradesBeforeDisconnect ?? _lastPollTimeTrades ?? _startTime;
|
||||
var tradesResult = await _spotOrderRestClient.GetSpotUserTradesAsync(new GetUserTradesRequest(symbol, startTime: fromTimeTrades)).ConfigureAwait(false);
|
||||
if (!tradesResult.Success)
|
||||
@ -622,6 +626,7 @@ namespace CryptoExchange.Net.Trackers.UserData
|
||||
HandleTradeUpdate(UpdateSource.Poll, tradesResult.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_lastPollSuccessful = !anyError;
|
||||
_logger.LogDebug("User data requesting completed");
|
||||
|
||||
@ -30,5 +30,9 @@ namespace CryptoExchange.Net.Trackers.UserData
|
||||
/// Whether to poll for data initially when starting the tracker.
|
||||
/// </summary>
|
||||
public bool PollAtStart { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Whether to track order trades, can lead to increased requests when polling
|
||||
/// </summary>
|
||||
public bool TrackTrades { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user