Skip to content

Commit

Permalink
Version 5.4.1009
Browse files Browse the repository at this point in the history
  • Loading branch information
burakoner committed Oct 9, 2024
1 parent 5a3161c commit 2defe67
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 26 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Change Log & Release Notes

* Version 5.4.1009 - 09 Oct 2024
* Updated endpoints and models to [2024-10-04](https://www.okx.com/docs-v5/log_en/#2024-10-04) version

* Version 5.4.1001 - 01 Oct 2024
* ApiSharp 3.0.0 Update
* Removed Json Converters
Expand Down
1 change: 0 additions & 1 deletion OKX.Api.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static async Task Main(string[] args)
var announcement_01 = await api.Announcement.GetAnnouncementTypesAsync(); // (Unsigned)
var announcement_02 = await api.Announcement.GetAnnouncementsAsync(); // (Signed)


// Trading Account Methods (Signed)
var account_01 = await api.Account.GetInstrumentsAsync(OkxInstrumentType.Spot);
var account_02 = await api.Account.GetBalancesAsync();
Expand Down
3 changes: 3 additions & 0 deletions OKX.Api/Account/Clients/OkxAccountRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,9 @@ public Task<RestCallResult<OkxAccountFixedLoanBorrowingQuote>> GetFixedLoanBorro
return new RestCallResult<long?>(result.Request, result.Response, result.Data.Data, result.Raw, result.Error);
}

// TODO: Convert fixed loan to market loan
// TODO: Reduce liabilities for fixed loan

/// <summary>
/// Get fixed loan borrow order list
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ public enum OkxAccountFixedLoanBorrowingOrderState
/// </summary>
[Map("7")]
Reborrowing = 7,

/// <summary>
/// Pending repay
/// </summary>
[Map("8")]
PendingRepay = 8,
}
16 changes: 16 additions & 0 deletions OKX.Api/Account/Responses/OkxAccountConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,20 @@ public record OkxAccountConfiguration
/// </summary>
[JsonProperty("liquidationGear")]
public int LiquidationGear { get; set; }

/// <summary>
/// Whether borrow is allowed or not in Spot mode
/// true: Enabled
/// false: Disabled
/// </summary>
[JsonProperty("enableSpotBorrow")]
public bool EnableSpotBorrow { get; set; }

/// <summary>
/// Whether auto-repay is allowed or not in Spot mode
/// true: Enabled
/// false: Disabled
/// </summary>
[JsonProperty("spotBorrowAutoRepay")]
public bool SpotBorrowAutoRepay { get; set; }
}
10 changes: 9 additions & 1 deletion OKX.Api/Algo/Responses/OkxAlgoOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,5 +318,13 @@ public record OkxAlgoOrder
/// </summary>
[JsonIgnore]
public DateTime? UpdateTime => UpdateTimestamp?.ConvertFromMilliseconds();


/// <summary>
/// 是否自动借币
/// true:自动借币
/// false:不自动借币
/// 仅适用于计划委托、移动止盈止损和 时间加权策略
/// </summary>
[JsonProperty("isTradeBorrowMode")]
public bool IsTradeBorrowMode { get; set; }
}
6 changes: 3 additions & 3 deletions OKX.Api/Announcement/Clients/OkxAnnouncementRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public class OkxAnnouncementRestClient(OkxRestApiClient root) : OkxBaseRestClien
/// Authentication is required for this private endpoint.
/// Get announcements, the response is sorted by pTime with the most recent first. The sort will not be affected if the announcement is updated. Every page has 20 records
/// </summary>
/// <param name="announcementType">Announcement type. Delivering the annType from "GET / Announcement types"
/// <param name="type">Announcement type. Delivering the annType from "GET / Announcement types"
/// Returning all when it is not posted</param>
/// <param name="page">Page for pagination. The default is 1</param>
/// <param name="ct">Cancellation Token</param>
/// <returns></returns>
public Task<RestCallResult<OkxAnnouncements>> GetAnnouncementsAsync(string? announcementType = null, int? page = null, CancellationToken ct = default)
public Task<RestCallResult<OkxAnnouncements>> GetAnnouncementsAsync(string? type = null, int? page = null, CancellationToken ct = default)
{
var parameters = new ParameterCollection();
parameters.AddOptional("annType", announcementType);
parameters.AddOptional("annType", type);
parameters.AddOptional("page", page?.ToOkxString());

return ProcessOneRequestAsync<OkxAnnouncements>(GetUri(v5SupportAnnouncements), HttpMethod.Get, ct, signed: true, queryParameters: parameters);
Expand Down
8 changes: 4 additions & 4 deletions OKX.Api/OKX.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<PropertyGroup>
<PackageId>OKX.Api</PackageId>
<Authors>Burak Öner</Authors>
<Version>5.4.1001</Version>
<FileVersion>5.4.1001</FileVersion>
<PackageVersion>5.4.1001</PackageVersion>
<AssemblyVersion>5.4.1001</AssemblyVersion>
<Version>5.4.1009</Version>
<FileVersion>5.4.1009</FileVersion>
<PackageVersion>5.4.1009</PackageVersion>
<AssemblyVersion>5.4.1009</AssemblyVersion>
<Description>OKX V5 Api Wrapper. Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper</Description>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>OKX;OKEX;Binance;BNB;BTC;Api;Client;Rest;Web;Websocket;Socket;Wrapper;Crypto;Currency;Cryptocurrency;Exchange;Trade;Trading;Bitcoin;Spot;Margin;Futures;Derivates;Stock;Options;Swap;</PackageTags>
Expand Down
6 changes: 6 additions & 0 deletions OKX.Api/Public/Responses/OkxPublicDiscountInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,10 @@ public record OkxPublicDiscountInfoDetails
/// </summary>
[JsonProperty("liqPenaltyRate")]
public decimal LiquidationPenaltyRate { get; set; }

/// <summary>
/// Discount equity in currency for quick calculation if your equity is themaxAmt
/// </summary>
[JsonProperty("disCcyEq")]
public decimal DiscountEquity { get; set; }
}
16 changes: 15 additions & 1 deletion OKX.Api/Trade/Clients/OkxTradeRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -695,14 +695,28 @@ public Task<RestCallResult<List<OkxTradeOneClickRepayOrder>>> GetOneClickRepayHi
/// </summary>
/// <param name="instrumentType">Instrument type</param>
/// <param name="instrumentFamily">Instrument family</param>
/// <param name="lockInterval">Lock interval(ms)
/// The range should be [0, 10 000]
/// The default is 0. You can set it as "0" if you want to unlock it immediately.
/// Error 54008 will be thorwn when placing order duiring lock interval, it is different from 51034 which is thrown when MMP is triggered</param>
/// <param name="ct">Cancellation Token</param>
/// <returns></returns>
public async Task<RestCallResult<bool?>> MassCancelAsync(OkxInstrumentType instrumentType, string instrumentFamily, CancellationToken ct = default)
public async Task<RestCallResult<bool?>> MassCancelAsync(
OkxInstrumentType instrumentType,
string instrumentFamily,
int? lockInterval = null,
CancellationToken ct = default)
{
if(lockInterval.HasValue)
{
lockInterval?.ValidateIntBetween(nameof(lockInterval), 1, 10000);
}

var parameters = new ParameterCollection {
{ "instFamily", instrumentFamily },
};
parameters.AddEnum("instType", instrumentType);
parameters.AddOptionalString("lockInterval", lockInterval);

var result = await ProcessOneRequestAsync<OkxBooleanResponse>(GetUri(v5TradeMassCancel), HttpMethod.Post, ct, signed: true, bodyParameters: parameters);
if (!result) return new RestCallResult<bool?>(result.Request, result.Response, result.Raw, result.Error);
Expand Down
32 changes: 16 additions & 16 deletions SYNC.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Account @ 2024/09/17
Trading @ 2024/09/17
Algo @ 2024/09/18
Grid @ 2024/09/18
RecurringBuy @ 2024/09/18
CopyTrading @ 2024/09/19
Public @ 2024/09/18
Block @ 2024/08/09
Spread @ 2024/09/19
Rubik @ 2024/09/19
Funding @ 2024/09/19
SubAccount @ 2024/09/19
Financial @ 2024/09/19
Affiliate @ 2024/09/19
Announcement @ 2024/09/20
SignalBot @ 2024/09/20
Account @ 2024-10-04
Trading @ 2024-10-04
Algo @ 2024-10-04
Grid @ 2024-10-04
RecurringBuy @ 2024-10-04
CopyTrading @ 2024-10-04
Public @ 2024-10-04
Block @ 2024-10-04
Spread @ 2024-10-04
Rubik @ 2024-10-04
Funding @ 2024-10-04
SubAccount @ 2024-10-04
Financial @ 2024-10-04
Affiliate @ 2024-10-04
Announcement @ 2024-10-04
SignalBot @ 2024-10-04
Broker @

0 comments on commit 2defe67

Please sign in to comment.