1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-10-13 22:51:39 +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="System.Threading.Channels" Version="10.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="SharedApis\Interfaces\V2\Spot\Orders\" />
</ItemGroup>
</Project>
@@ -7,10 +7,7 @@ using System.Threading.Tasks;
namespace CryptoExchange.Net.SharedApis
{
/// <summary>
/// Request definition for placing a spot order on an exchange.
/// </summary>
public interface IPlaceSpotOrderRest : ISharedRest
public interface IPlaceSpotOrder : ISharedApiCapability
{
/// <summary>
/// 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.
/// </summary>
PlaceSpotOrderOptions 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<HttpResult<SharedId>> PlaceSpotOrderAsync(PlaceSpotOrderRequest request, CancellationToken ct = default);
Task<ICallResult<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>
/// Options for placing a new spot order
/// </summary>
public class PlaceSpotOrderOptions : CapabilityOptions<PlaceSpotOrderRequest, IPlaceSpotOrderRest>
public class PlaceSpotOrderOptions : CapabilityOptions<PlaceSpotOrderRequest, IPlaceSpotOrder>
{
/// <inheritdoc />
public override string Description => "Place a new spot order";
@@ -16,7 +16,7 @@ namespace CryptoExchange.Net.SharedApis
/// <summary>
/// ctor
/// </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>
public override Error? ValidateRequest(
PlaceSpotOrderRequest request,
IPlaceSpotOrderRest client)
IPlaceSpotOrder client)
{
if (request.Symbol!.TradingMode != TradingMode.Spot)
return ArgumentError.Invalid("TradingMode", $"TradingMode.{request.Symbol!.TradingMode} is not supported, should be Spot");