Skip to content

Commit

Permalink
5.4.1217
Browse files Browse the repository at this point in the history
  • Loading branch information
burakoner committed Dec 17, 2024
1 parent 9d7ae0e commit ac419f4
Show file tree
Hide file tree
Showing 42 changed files with 641 additions and 197 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
## Change Log & Release Notes

* Version 5.4.1217 - 17 Dec 2024
* Fixed issue [#72](https://github.com/burakoner/OKX.Api/issues/72)
* Synced models with the latest API documentation (2024-12-16).
* Edited `OkxFundingCurrency` model: Added some new properties and marked some properties as obsolete.
* Edited `OkxFundingNonTradableAssetBalance` model: Added some new properties.
* Edited `OkxSpreadOrderType` enum: Added MarketOrder option.
* Edited `OkxSpreadOrderCancelSource` enum: Added new options.
* Edited `OkxAccountBillType` enum: Added new options and marked some options as obsolete.
* Edited `OkxAccountBillSubType` enum: Added new options and marked some options as obsolete.
* Edited `OkxAccountFixedLoanBorrowLimitDetails` model: Added new properties.
* Edited `OkxAccountRestClient.GetFixedLoanBorrowingOrdersAsync()` method: Added new parameter.
* Edited `OkxAccountFixedLoanBorrowingOrderDetails` model: Renamed some parameters.
* Edited `OkxSubAccountType` enum: Renamed existing options and added new options.
* Added `OkxTradeEasyConvertSource` enum.
* Edited `OkxTradeRestClient.GetEasyConvertCurrenciesAsync()` method: Added new parameter.
* Edited `OkxTradeRestClient.PlaceEasyConvertOrderAsync()` method: Added new parameter.
* Edited `OkxPublicInstrument` model: Added some new properties.
* Edited `OkxAccountBalanceDetails` model: Added some new properties.
* Edited `OkxFinancialOnChainEarnOffer` model: Added some new properties.
* Edited `OkxFinancialOnChainEarnEarningData` model: Changes data types for some new properties.
* Edited `OkxFinancialOnChainEarnOrder` model: Added some new properties.
* Added `OkxFinancialOnChainEarnFastRedemptionData` model.
* Edited `OkxAccountRestClient.GetMaximumLoanAmountAsync()` method: Added new parameter.
* Edited `OkxAlgoOrderType` enum: Added ChaseOrder option.
* Added ChaseOrder functionality to `OkxAlgoRestClient.PlaceAlgoOrderAsync()` method.
* Added `OkxAlgoChaseType` enum.
* Edited `OkxAlgoOrder` model: Added some new properties.
* Edited `OkxBlockRestClient.GetTradesAsync()` method: Removed state parameter and added isSuccessful parameter.
* Edited `OkxBlockLegRequest` model: Added some new properties.
* Edited `OkxSpreadTradeLeg` model: Added some new properties.

* Version 5.4.1202 - 12 Dec 2024
* Merged pull request [#71](https://github.com/burakoner/OKX.Api/pull/71)

* Version 5.4.1025 - 25 Oct 2024
* ApiSharp 3.1.0 Update
* Fixed issue [#67](https://github.com/burakoner/OKX.Api/issues/67)
Expand Down
28 changes: 23 additions & 5 deletions OKX.Api/Account/Clients/OkxAccountRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ public class OkxAccountRestClient(OkxRestApiClient root) : OkxBaseRestClient(roo
private const string v5AccountFixedLoanManualReborrow = "api/v5/account/fixed-loan/manual-reborrow";
private const string v5AccountFixedLoanRepayBorrowingOrder = "api/v5/account/fixed-loan/repay-borrowing-order";
private const string v5AccountFixedLoanBorrowingOrdersList = "api/v5/account/fixed-loan/borrowing-orders-list";
// api/v5/account/spot-manual-borrow-repay
// api/v5/account/set-auto-repay
// api/v5/account/spot-borrow-repay-history
private const string v5AccountPositionBuilder = "api/v5/account/position-builder";
private const string v5AccountSetRiskOffsetAmount = "api/v5/account/set-riskOffset-amt";
private const string v5AccountGreeks = "api/v5/account/greeks";
private const string v5AccountPositionTiers = "api/v5/account/position-tiers";
private const string v5AccountSetRiskOffsetType = "api/v5/account/set-riskOffset-type";
private const string v5AccountActivateOption = "api/v5/account/activate-option";
private const string v5AccountSetAutoLoan = "api/v5/account/set-auto-loan";
// api/v5/account/account-level-switch-preset
// api/v5/account/set-account-switch-precheck
private const string v5AccountSetAccountLevel = "api/v5/account/set-account-level";
private const string v5AccountMmpReset = "api/v5/account/mmp-reset";
private const string v5AccountMmpConfig = "api/v5/account/mmp-config";
Expand Down Expand Up @@ -540,20 +545,21 @@ public Task<RestCallResult<List<OkxAccountLeverageEstimatedInformation>>> GetLev
/// </summary>
/// <param name="instrumentId">Instrument ID</param>
/// <param name="marginMode">Margin Mode</param>
/// <param name="currency">Margin Currency</param>
/// <param name="marginCurrency">Margin Currency</param>
/// <param name="ct">Cancellation Token</param>
/// <returns></returns>
public Task<RestCallResult<List<OkxAccountMaximumLoanAmount>>> GetMaximumLoanAmountAsync(
string instrumentId,
OkxAccountMarginMode marginMode,
string? instrumentId = null,
string? currency = null,
string? marginCurrency = null,
CancellationToken ct = default)
{
var parameters = new ParameterCollection
{
{ "instId", instrumentId }
};
var parameters = new ParameterCollection();
parameters.AddEnum("mgnMode", marginMode);
parameters.AddOptional("instId", instrumentId);
parameters.AddOptional("ccy", currency);
parameters.AddOptional("mgnCcy", marginCurrency);

return ProcessListRequestAsync<OkxAccountMaximumLoanAmount>(GetUri(v5AccountMaxLoan), HttpMethod.Get, ct, signed: true, queryParameters: parameters);
Expand Down Expand Up @@ -1080,6 +1086,7 @@ public Task<RestCallResult<OkxAccountFixedLoanBorrowingQuote>> GetFixedLoanBorro
/// <param name="orderId">Borrowing order ID</param>
/// <param name="currency">Borrowing currency, e.g. BTC</param>
/// <param name="state">State</param>
/// <param name="term">Borrowing term, e.g. 30D: 30 Days</param>
/// <param name="after">Pagination of data to return records earlier than the requested ordId</param>
/// <param name="before">Pagination of data to return records newer than the requested ordId</param>
/// <param name="limit">Number of results per request. The maximum is 100. The default is 100.</param>
Expand All @@ -1089,6 +1096,7 @@ public Task<RestCallResult<OkxAccountFixedLoanBorrowingOrderDetails>> GetFixedLo
long? orderId = null,
string? currency = null,
OkxAccountFixedLoanBorrowingOrderState? state = null,
string? term = null,
long? after = null,
long? before = null,
int limit = 100,
Expand All @@ -1098,13 +1106,19 @@ public Task<RestCallResult<OkxAccountFixedLoanBorrowingOrderDetails>> GetFixedLo
parameters.AddOptional("ordId", orderId);
parameters.AddOptional("after", currency);
parameters.AddOptionalEnum("state", state);
parameters.AddOptional("term", term);
parameters.AddOptional("after", after?.ToOkxString());
parameters.AddOptional("before", before?.ToOkxString());
parameters.AddOptional("limit", limit.ToOkxString());

return ProcessOneRequestAsync<OkxAccountFixedLoanBorrowingOrderDetails>(GetUri(v5AccountFixedLoanBorrowingOrdersList), HttpMethod.Get, ct, signed: true, queryParameters: parameters);
}

// TODO
// api/v5/account/spot-manual-borrow-repay
// api/v5/account/set-auto-repay
// api/v5/account/spot-borrow-repay-history

/// <summary>
/// Calculates portfolio margin information for virtual position/assets or current position of the user.
/// You can add up to 200 virtual positions and 200 virtual assets in one request.
Expand Down Expand Up @@ -1240,6 +1254,10 @@ public Task<RestCallResult<OkxTimestamp>> ActivateOptionAsync(CancellationToken
return new RestCallResult<bool?>(result.Request, result.Response, result.Data.Data, result.Raw, result.Error);
}

// TODO
// api/v5/account/account-level-switch-preset
// api/v5/account/set-account-switch-precheck

/// <summary>
/// Set account mode
/// You need to set on the Web/App for the first set of every account mode.
Expand Down
Loading

0 comments on commit ac419f4

Please sign in to comment.