mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-11-14 09:18:09 +00:00
Added SharedTickerType for defining time used for ticker calculations by the API
This commit is contained in:
parent
8043a48c49
commit
6cf9684f55
25
CryptoExchange.Net/SharedApis/Enums/SharedTickerType.cs
Normal file
25
CryptoExchange.Net/SharedApis/Enums/SharedTickerType.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis.Enums
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of ticker
|
||||||
|
/// </summary>
|
||||||
|
public enum SharedTickerType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The ticker data is calculated based on the last 24 hours
|
||||||
|
/// </summary>
|
||||||
|
Day24H,
|
||||||
|
/// <summary>
|
||||||
|
/// The ticker data is calculated based on the start of the day at 00:00 on UTC+0
|
||||||
|
/// </summary>
|
||||||
|
DayUTc0,
|
||||||
|
/// <summary>
|
||||||
|
/// Ticker data is calculated in a different way or not consistent
|
||||||
|
/// </summary>
|
||||||
|
Other
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,7 +12,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Futures get ticker request options
|
/// Futures get ticker request options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndpointOptions<GetTickerRequest> GetFuturesTickerOptions { get; }
|
GetTickerOptions GetFuturesTickerOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get ticker info for a specific futures symbol
|
/// Get ticker info for a specific futures symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -23,7 +23,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Futures get tickers request options
|
/// Futures get tickers request options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndpointOptions<GetTickersRequest> GetFuturesTickersOptions { get; }
|
GetTickersOptions GetFuturesTickersOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get ticker info for all futures symbols
|
/// Get ticker info for all futures symbols
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Spot ticker request options
|
/// Spot ticker request options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndpointOptions<GetTickerRequest> GetSpotTickerOptions { get; }
|
GetTickerOptions GetSpotTickerOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get ticker for a specific spot symbol
|
/// Get ticker for a specific spot symbol
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -22,7 +22,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Spot tickers request options
|
/// Spot tickers request options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndpointOptions<GetTickersRequest> GetSpotTickersOptions { get; }
|
GetTickersOptions GetSpotTickersOptions { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get tickers for all spot symbols
|
/// Get tickers for all spot symbols
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ticker subscription options
|
/// Ticker subscription options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndpointOptions<SubscribeTickerRequest> SubscribeTickerOptions { get; }
|
SubscribeTickerOptions SubscribeTickerOptions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subscribe to ticker updates for a symbol
|
/// Subscribe to ticker updates for a symbol
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tickers subscription options
|
/// Tickers subscription options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndpointOptions<SubscribeAllTickersRequest> SubscribeAllTickersOptions { get; }
|
SubscribeTickersOptions SubscribeAllTickersOptions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subscribe to tickers updates for all symbols
|
/// Subscribe to tickers updates for all symbols
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
using CryptoExchange.Net.Objects;
|
||||||
|
using CryptoExchange.Net.SharedApis.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for requesting ticker
|
||||||
|
/// </summary>
|
||||||
|
public class GetTickerOptions : EndpointOptions<GetTickerRequest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of ticker calculation
|
||||||
|
/// </summary>
|
||||||
|
public SharedTickerType TickerType { get; set; } = SharedTickerType.Day24H;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
public GetTickerOptions(SharedTickerType? tickerCalcType = null) : base(false)
|
||||||
|
{
|
||||||
|
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string ToString(string exchange)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(base.ToString(exchange));
|
||||||
|
sb.AppendLine($"Ticker time calc type: {TickerType}");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
using CryptoExchange.Net.Objects;
|
||||||
|
using CryptoExchange.Net.SharedApis.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for requesting tickers
|
||||||
|
/// </summary>
|
||||||
|
public class GetTickersOptions : EndpointOptions<GetTickersRequest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of ticker calculation
|
||||||
|
/// </summary>
|
||||||
|
public SharedTickerType TickerType { get; set; } = SharedTickerType.Day24H;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
public GetTickersOptions(SharedTickerType? tickerCalcType = null) : base(false)
|
||||||
|
{
|
||||||
|
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string ToString(string exchange)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(base.ToString(exchange));
|
||||||
|
sb.AppendLine($"Ticker time calc type: {TickerType}");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
using CryptoExchange.Net.Objects;
|
||||||
|
using CryptoExchange.Net.SharedApis.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for subscribing to ticker updates
|
||||||
|
/// </summary>
|
||||||
|
public class SubscribeTickerOptions : EndpointOptions<SubscribeTickerRequest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of ticker calculation
|
||||||
|
/// </summary>
|
||||||
|
public SharedTickerType TickerType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
public SubscribeTickerOptions(SharedTickerType? tickerCalcType = null) : base(false)
|
||||||
|
{
|
||||||
|
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
using CryptoExchange.Net.Objects;
|
||||||
|
using CryptoExchange.Net.SharedApis.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options for subscribing to ticker updates
|
||||||
|
/// </summary>
|
||||||
|
public class SubscribeTickersOptions : EndpointOptions<SubscribeAllTickersRequest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of ticker calculation
|
||||||
|
/// </summary>
|
||||||
|
public SharedTickerType TickerType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ctor
|
||||||
|
/// </summary>
|
||||||
|
public SubscribeTickersOptions(SharedTickerType? tickerCalcType = null) : base(false)
|
||||||
|
{
|
||||||
|
TickerType = tickerCalcType ?? SharedTickerType.Day24H;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user