Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Self Trade Prevention Mode in SpotAccountTrade.cs #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Src/Spot/SpotAccountTrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ public async Task<string> TestNewOrder(string symbol, Side side, OrderType type,
/// <param name="trailingDelta">Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.</param>
/// <param name="icebergQty">Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.</param>
/// <param name="newOrderRespType">Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK.</param>
/// <param name="selfTradePreventionMode">The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE.</param>
/// <param name="recvWindow">The value cannot be greater than 60000.</param>
/// <returns>Order result.</returns>
public async Task<string> NewOrder(string symbol, Side side, OrderType type, TimeInForce? timeInForce = null, decimal? quantity = null, decimal? quoteOrderQty = null, decimal? price = null, string newClientOrderId = null, int? strategyId = null, int? strategyType = null, decimal? stopPrice = null, decimal? trailingDelta = null, decimal? icebergQty = null, NewOrderResponseType? newOrderRespType = null, long? recvWindow = null)
public async Task<string> NewOrder(string symbol, Side side, OrderType type, TimeInForce? timeInForce = null, decimal? quantity = null, decimal? quoteOrderQty = null, decimal? price = null, string newClientOrderId = null, int? strategyId = null, int? strategyType = null, decimal? stopPrice = null, decimal? trailingDelta = null, decimal? icebergQty = null, NewOrderResponseType? newOrderRespType = null, SelfTradePreventionMode? selfTradePreventionMode = null, long? recvWindow = null)
{
var result = await this.SendSignedAsync<string>(
NEW_ORDER,
Expand All @@ -129,6 +130,7 @@ public async Task<string> NewOrder(string symbol, Side side, OrderType type, Tim
{ "trailingDelta", trailingDelta },
{ "icebergQty", icebergQty },
{ "newOrderRespType", newOrderRespType },
{ "selfTradePreventionMode", selfTradePreventionMode },
{ "recvWindow", recvWindow },
{ "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() },
});
Expand Down Expand Up @@ -316,9 +318,10 @@ public async Task<string> AllOrders(string symbol, long? orderId = null, long? s
/// <param name="stopIcebergQty"></param>
/// <param name="stopLimitTimeInForce"></param>
/// <param name="newOrderRespType">Set the response JSON.</param>
/// <param name="selfTradePreventionMode">The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE.</param>
/// <param name="recvWindow">The value cannot be greater than 60000.</param>
/// <returns>New OCO details.</returns>
public async Task<string> NewOco(string symbol, Side side, decimal quantity, decimal price, decimal stopPrice, string listClientOrderId = null, string limitClientOrderId = null, int? limitStrategyId = null, int? limitStrategyType = null, decimal? limitIcebergQty = null, decimal? trailingDelta = null, string stopClientOrderId = null, int? stopStrategyId = null, int? stopStrategyType = null, decimal? stopLimitPrice = null, decimal? stopIcebergQty = null, TimeInForce? stopLimitTimeInForce = null, NewOrderResponseType? newOrderRespType = null, long? recvWindow = null)
public async Task<string> NewOco(string symbol, Side side, decimal quantity, decimal price, decimal stopPrice, string listClientOrderId = null, string limitClientOrderId = null, int? limitStrategyId = null, int? limitStrategyType = null, decimal? limitIcebergQty = null, decimal? trailingDelta = null, string stopClientOrderId = null, int? stopStrategyId = null, int? stopStrategyType = null, decimal? stopLimitPrice = null, decimal? stopIcebergQty = null, TimeInForce? stopLimitTimeInForce = null, NewOrderResponseType? newOrderRespType = null, SelfTradePreventionMode? selfTradePreventionMode = null, long? recvWindow = null)
{
var result = await this.SendSignedAsync<string>(
NEW_OCO,
Expand All @@ -343,6 +346,7 @@ public async Task<string> NewOco(string symbol, Side side, decimal quantity, dec
{ "stopIcebergQty", stopIcebergQty },
{ "stopLimitTimeInForce", stopLimitTimeInForce },
{ "newOrderRespType", newOrderRespType },
{ "selfTradePreventionMode", selfTradePreventionMode },
{ "recvWindow", recvWindow },
{ "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() },
});
Expand Down Expand Up @@ -564,9 +568,10 @@ public async Task<string> QueryCurrentOrderCountUsage(long? recvWindow = null)
/// <param name="trailingDelta">Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.</param>
/// <param name="icebergQty">Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.</param>
/// <param name="newOrderRespType">Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK.</param>
/// <param name="selfTradePreventionMode">The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE.</param>
/// <param name="recvWindow">The value cannot be greater than 60000.</param>
/// <returns>Operation details.</returns>
public async Task<string> CancelAnExistingOrderAndSendANewOrder(string symbol, Side side, OrderType type, string cancelReplaceMode, TimeInForce? timeInForce = null, decimal? quantity = null, decimal? quoteOrderQty = null, decimal? price = null, string cancelNewClientOrderId = null, string cancelOrigClientOrderId = null, long? cancelOrderId = null, string newClientOrderId = null, int? strategyId = null, int? strategyType = null, decimal? stopPrice = null, decimal? trailingDelta = null, decimal? icebergQty = null, NewOrderResponseType? newOrderRespType = null, long? recvWindow = null)
public async Task<string> CancelAnExistingOrderAndSendANewOrder(string symbol, Side side, OrderType type, string cancelReplaceMode, TimeInForce? timeInForce = null, decimal? quantity = null, decimal? quoteOrderQty = null, decimal? price = null, string cancelNewClientOrderId = null, string cancelOrigClientOrderId = null, long? cancelOrderId = null, string newClientOrderId = null, int? strategyId = null, int? strategyType = null, decimal? stopPrice = null, decimal? trailingDelta = null, decimal? icebergQty = null, NewOrderResponseType? newOrderRespType = null, SelfTradePreventionMode? selfTradePreventionMode = null, long? recvWindow = null)
{
var result = await this.SendSignedAsync<string>(
CANCEL_AN_EXISTING_ORDER_AND_SEND_A_NEW_ORDER,
Expand All @@ -591,6 +596,7 @@ public async Task<string> CancelAnExistingOrderAndSendANewOrder(string symbol, S
{ "trailingDelta", trailingDelta },
{ "icebergQty", icebergQty },
{ "newOrderRespType", newOrderRespType },
{ "selfTradePreventionMode", selfTradePreventionMode },
{ "recvWindow", recvWindow },
{ "timestamp", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() },
});
Expand Down