mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-10 17:36:19 +00:00
Added sync start/stop methods orderbook
This commit is contained in:
parent
0cd7d496a9
commit
e89df592f5
@ -133,7 +133,13 @@ namespace CryptoExchange.Net.OrderBook
|
|||||||
/// Start connecting and synchronizing the order book
|
/// Start connecting and synchronizing the order book
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<CallResult<bool>> Start()
|
public CallResult<bool> Start() => StartAsync().Result;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start connecting and synchronizing the order book
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<CallResult<bool>> StartAsync()
|
||||||
{
|
{
|
||||||
Status = OrderBookStatus.Connecting;
|
Status = OrderBookStatus.Connecting;
|
||||||
var startResult = await DoStart().ConfigureAwait(false);
|
var startResult = await DoStart().ConfigureAwait(false);
|
||||||
@ -177,10 +183,16 @@ namespace CryptoExchange.Net.OrderBook
|
|||||||
/// Stop syncing the order book
|
/// Stop syncing the order book
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task Stop()
|
public void Stop() => StopAsync().Wait();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop syncing the order book
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task StopAsync()
|
||||||
{
|
{
|
||||||
Status = OrderBookStatus.Disconnected;
|
Status = OrderBookStatus.Disconnected;
|
||||||
return subscription.Close();
|
await subscription.Close().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Task<CallResult<UpdateSubscription>> DoStart();
|
protected abstract Task<CallResult<UpdateSubscription>> DoStart();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user