mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 07:56:12 +00:00
wip
This commit is contained in:
parent
6a82a7a411
commit
478cb537fa
@ -18,13 +18,9 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SharedTimeInForce? TimeInForce { get; set; }
|
public SharedTimeInForce? TimeInForce { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quantity of the order in base asset or contracts, depending on the exchange.
|
/// Quantity of the order
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? Quantity { get; set; }
|
public SharedQuantity? Quantity { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Quantity of the order in quote asset.
|
|
||||||
/// </summary>
|
|
||||||
public decimal? QuoteQuantity { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Price of the order
|
/// Price of the order
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -41,7 +37,6 @@
|
|||||||
/// <param name="side">Side of the order</param>
|
/// <param name="side">Side of the order</param>
|
||||||
/// <param name="orderType">Type of the order</param>
|
/// <param name="orderType">Type of the order</param>
|
||||||
/// <param name="quantity">Quantity of the order</param>
|
/// <param name="quantity">Quantity of the order</param>
|
||||||
/// <param name="quoteQuantity">Quantity of the order in quote asset</param>
|
|
||||||
/// <param name="price">Price of the order</param>
|
/// <param name="price">Price of the order</param>
|
||||||
/// <param name="timeInForce">Time in force</param>
|
/// <param name="timeInForce">Time in force</param>
|
||||||
/// <param name="clientOrderId">Client order id</param>
|
/// <param name="clientOrderId">Client order id</param>
|
||||||
@ -50,8 +45,7 @@
|
|||||||
SharedSymbol symbol,
|
SharedSymbol symbol,
|
||||||
SharedOrderSide side,
|
SharedOrderSide side,
|
||||||
SharedOrderType orderType,
|
SharedOrderType orderType,
|
||||||
decimal? quantity = null,
|
SharedQuantity? quantity = null,
|
||||||
decimal? quoteQuantity = null,
|
|
||||||
decimal? price = null,
|
decimal? price = null,
|
||||||
SharedTimeInForce? timeInForce = null,
|
SharedTimeInForce? timeInForce = null,
|
||||||
string? clientOrderId = null,
|
string? clientOrderId = null,
|
||||||
@ -60,7 +54,6 @@
|
|||||||
OrderType = orderType;
|
OrderType = orderType;
|
||||||
Side = side;
|
Side = side;
|
||||||
Quantity = quantity;
|
Quantity = quantity;
|
||||||
QuoteQuantity = quoteQuantity;
|
|
||||||
Price = price;
|
Price = price;
|
||||||
TimeInForce = timeInForce;
|
TimeInForce = timeInForce;
|
||||||
ClientOrderId = clientOrderId;
|
ClientOrderId = clientOrderId;
|
||||||
|
@ -27,22 +27,26 @@ namespace CryptoExchange.Net.SharedApis
|
|||||||
/// Time in force for the order
|
/// Time in force for the order
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SharedTimeInForce? TimeInForce { get; set; }
|
public SharedTimeInForce? TimeInForce { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Order quantity in base asset
|
public SharedOrderQuantity? OrderQuantity { get; set; }
|
||||||
/// </summary>
|
public SharedOrderQuantity? QuantityFilled { get; set; }
|
||||||
public decimal? Quantity { get; set; }
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Quantity filled in base asset, note that this quantity has not yet included trading fees paid
|
///// Order quantity in base asset
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public decimal? QuantityFilled { get; set; }
|
//public decimal? Quantity { get; set; }
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Order quantity in quote asset
|
///// Quantity filled in base asset, note that this quantity has not yet included trading fees paid
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public decimal? QuoteQuantity { get; set; }
|
//public decimal? QuantityFilled { get; set; }
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Quantity filled in the quote asset, note that this quantity has not yet included trading fees paid
|
///// Order quantity in quote asset
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public decimal? QuoteQuantityFilled { get; set; }
|
//public decimal? QuoteQuantity { get; set; }
|
||||||
|
///// <summary>
|
||||||
|
///// Quantity filled in the quote asset, note that this quantity has not yet included trading fees paid
|
||||||
|
///// </summary>
|
||||||
|
//public decimal? QuoteQuantityFilled { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order price
|
/// Order price
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
47
CryptoExchange.Net/SharedApis/SharedQuantity.cs
Normal file
47
CryptoExchange.Net/SharedApis/SharedQuantity.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CryptoExchange.Net.SharedApis
|
||||||
|
{
|
||||||
|
public record SharedQuantityReference
|
||||||
|
{
|
||||||
|
public decimal? QuantityInBaseAsset { get; set; }
|
||||||
|
public decimal? QuantityInQuoteAsset { get; set; }
|
||||||
|
public decimal? QuantityInContracts { get; set; }
|
||||||
|
|
||||||
|
protected SharedQuantityReference(decimal? baseAssetQuantity, decimal? quoteAssetQuantity, decimal? contractQuantity)
|
||||||
|
{
|
||||||
|
QuantityInBaseAsset = baseAssetQuantity;
|
||||||
|
QuantityInQuoteAsset = quoteAssetQuantity;
|
||||||
|
QuantityInContracts = contractQuantity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public record SharedQuantity : SharedQuantityReference
|
||||||
|
{
|
||||||
|
private SharedQuantity(decimal? baseAssetQuantity, decimal? quoteAssetQuantity, decimal? contractQuantity)
|
||||||
|
: base(baseAssetQuantity, quoteAssetQuantity, contractQuantity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SharedQuantity Base(decimal quantity) => new SharedQuantity(quantity, null, null);
|
||||||
|
public static SharedQuantity Quote(decimal quantity) => new SharedQuantity(null, quantity, null);
|
||||||
|
public static SharedQuantity Contracts(decimal quantity) => new SharedQuantity(null, null, quantity);
|
||||||
|
|
||||||
|
public static SharedQuantity BaseFromQuote(decimal quoteQuantity, decimal price) => new SharedQuantity(Math.Round(quoteQuantity / price, 8), null, null);
|
||||||
|
public static SharedQuantity QuoteFromBase(decimal baseQuantity, decimal price) => new SharedQuantity(Math.Round(baseQuantity * price, 8), null, null);
|
||||||
|
public static SharedQuantity ContractsFromBase(decimal baseQuantity, decimal contractSize) => new SharedQuantity(Math.Round(baseQuantity / contractSize, 8), null, null);
|
||||||
|
public static SharedQuantity ContractsFromQuote(decimal quoteQuantity, decimal contractSize, decimal price) => new SharedQuantity(Math.Round(quoteQuantity / price / contractSize, 8), null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public record SharedOrderQuantity : SharedQuantityReference
|
||||||
|
{
|
||||||
|
public SharedOrderQuantity(): base(null, null,null) { }
|
||||||
|
|
||||||
|
public SharedOrderQuantity(decimal? baseAssetQuantity, decimal? quoteAssetQuantity, decimal? contractQuantity)
|
||||||
|
: base(baseAssetQuantity, quoteAssetQuantity, contractQuantity)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user