1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-10-14 07:01:46 +00:00
This commit is contained in:
Jkorf
2026-09-01 16:56:15 +02:00
parent d0f5a8d6cc
commit 20977e28b7
80 changed files with 49 additions and 69 deletions
@@ -60,7 +60,4 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.1" /> <PackageReference Include="Microsoft.Extensions.Http" Version="10.0.1" />
<PackageReference Include="System.Threading.Channels" Version="10.0.1" /> <PackageReference Include="System.Threading.Channels" Version="10.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="SharedApis\Interfaces\V2\Spot\Orders\" />
</ItemGroup>
</Project> </Project>
@@ -7,10 +7,7 @@ using System.Threading.Tasks;
namespace CryptoExchange.Net.SharedApis namespace CryptoExchange.Net.SharedApis
{ {
/// <summary> public interface IPlaceSpotOrder : ISharedApiCapability
/// Request definition for placing a spot order on an exchange.
/// </summary>
public interface IPlaceSpotOrderRest : ISharedRest
{ {
/// <summary> /// <summary>
/// How the trading fee is deducted /// How the trading fee is deducted
@@ -45,11 +42,9 @@ namespace CryptoExchange.Net.SharedApis
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object. /// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
/// </summary> /// </summary>
PlaceSpotOrderOptions PlaceSpotOrderOptions { get; } PlaceSpotOrderOptions PlaceSpotOrderOptions { get; }
/// <summary>
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br /> Task<ICallResult<SharedId>> PlaceSpotOrderAsync(
/// </summary> PlaceSpotOrderRequest request,
/// <param name="request">Request info</param> CancellationToken ct = default);
/// <param name="ct">Cancellation token</param>
Task<HttpResult<SharedId>> PlaceSpotOrderAsync(PlaceSpotOrderRequest request, CancellationToken ct = default);
} }
} }
@@ -0,0 +1,22 @@
using CryptoExchange.Net.Objects;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CryptoExchange.Net.SharedApis
{
/// <summary>
/// Request definition for placing a spot order on an exchange.
/// </summary>
public interface IPlaceSpotOrderRest : IPlaceSpotOrder, ISharedRest
{
/// <summary>
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
/// </summary>
/// <param name="request">Request info</param>
/// <param name="ct">Cancellation token</param>
new Task<HttpResult<SharedId>> PlaceSpotOrderAsync(PlaceSpotOrderRequest request, CancellationToken ct = default);
}
}
@@ -0,0 +1,19 @@
using CryptoExchange.Net.Objects;
using System.Threading;
using System.Threading.Tasks;
namespace CryptoExchange.Net.SharedApis
{
/// <summary>
/// Client for placing and managing spot orders
/// </summary>
public interface IPlaceSpotOrderSocket : IPlaceSpotOrder, ISharedSocket
{
/// <summary>
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
/// </summary>
/// <param name="request">Request info</param>
/// <param name="ct">Cancellation token</param>
new Task<QueryResult<SharedId>> PlaceSpotOrderAsync(PlaceSpotOrderRequest request, CancellationToken ct = default);
}
}
@@ -1,53 +0,0 @@
using CryptoExchange.Net.Objects;
using System.Threading;
using System.Threading.Tasks;
namespace CryptoExchange.Net.SharedApis
{
/// <summary>
/// Client for placing and managing spot orders
/// </summary>
public interface IPlaceSpotOrderSocket : ISharedSocket
{
/// <summary>
/// How the trading fee is deducted
/// </summary>
SharedFeeDeductionType SpotFeeDeductionType { get; }
/// <summary>
/// How the asset is determined in which the trading fee is paid
/// </summary>
SharedFeeAssetType SpotFeeAssetType { get; }
/// <summary>
/// Supported order types for spot orders
/// </summary>
SharedOrderType[] SpotSupportedOrderTypes { get; }
/// <summary>
/// Supported time in force types for placing spot orders
/// </summary>
SharedTimeInForce[] SpotSupportedTimeInForce { get; }
/// <summary>
/// Supported quantity types for placing spot orders
/// </summary>
SharedQuantitySupport SpotSupportedOrderQuantity { get; }
/// <summary>
/// Generate a new random client order id
/// </summary>
/// <returns></returns>
string GenerateClientOrderId();
/// <summary>
/// Spot place order request options.<br />
/// Use <see cref="CapabilityOptions.RequiredExchangeParameters"/> and <see cref="CapabilityOptions.OptionalExchangeParameters"/> to check for required and optional parameters for the request. <br />
/// Exchange specific parameters can be added to the request via the `ExchangeParameters` property of the request object.
/// </summary>
PlaceSpotOrderSocketOptions PlaceSpotOrderOptions { get; }
/// <summary>
/// Place a new spot order, see <see cref="PlaceSpotOrderOptions"/> for request options and exchange specific required/optional parameters. <br />
/// </summary>
/// <param name="request">Request info</param>
/// <param name="ct">Cancellation token</param>
Task<QueryResult<SharedId>> PlaceSpotOrderAsync(PlaceSpotOrderRequest request, CancellationToken ct = default);
}
}
@@ -7,7 +7,7 @@ namespace CryptoExchange.Net.SharedApis
/// <summary> /// <summary>
/// Options for placing a new spot order /// Options for placing a new spot order
/// </summary> /// </summary>
public class PlaceSpotOrderOptions : CapabilityOptions<PlaceSpotOrderRequest, IPlaceSpotOrderRest> public class PlaceSpotOrderOptions : CapabilityOptions<PlaceSpotOrderRequest, IPlaceSpotOrder>
{ {
/// <inheritdoc /> /// <inheritdoc />
public override string Description => "Place a new spot order"; public override string Description => "Place a new spot order";
@@ -16,7 +16,7 @@ namespace CryptoExchange.Net.SharedApis
/// <summary> /// <summary>
/// ctor /// ctor
/// </summary> /// </summary>
public PlaceSpotOrderOptions(string exchange) : base(exchange, true, nameof(IPlaceSpotOrderRest.PlaceSpotOrderAsync)) public PlaceSpotOrderOptions(string exchange) : base(exchange, true, nameof(IPlaceSpotOrder.PlaceSpotOrderAsync))
{ {
} }
@@ -25,7 +25,7 @@ namespace CryptoExchange.Net.SharedApis
/// </summary> /// </summary>
public override Error? ValidateRequest( public override Error? ValidateRequest(
PlaceSpotOrderRequest request, PlaceSpotOrderRequest request,
IPlaceSpotOrderRest client) IPlaceSpotOrder client)
{ {
if (request.Symbol!.TradingMode != TradingMode.Spot) if (request.Symbol!.TradingMode != TradingMode.Spot)
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot"); return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");