-
-
Notifications
You must be signed in to change notification settings - Fork 448
Complete migration of Crypto Loans API from v1(partial support) to v2(full support) #1503
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
base: master
Are you sure you want to change the base?
Complete migration of Crypto Loans API from v1(partial support) to v2(full support) #1503
Conversation
- Changed method orders to replicate api layout - Tagged methods as MISSING or RETIRED - Restructured regions
Updated: Methods: - `Get Collateral Assets` - `GetLoanableAssetsAsync` Models: - `BinanceCryptoLoanAsset` - `BinanceCryptoLoanCollateralAsset`
Updated: Methods: - `BorrowAsync` - `RepayAsync` - `RepayCollateralAsync` - `AdjustLTVAsync` Models: - `BinanceCryptoLoanBorrow` - `BinanceCryptoLoanRepay` - `BinanceCryptoLoanLtvAdjust` Added Enum: - `RepayStatus`
# Summary: ## Methods: #### 1. Added missing methods: - `GetFlexibleLtvAdjustHistoryAsync` - `GetFlexibleBorrowHistoryAsync` - `GetLiquidationHistoryAsync` - `GetRepayHistoryAsync` #### 2. Updated outdated/retired method to API v2**: - `GetCollateralRepayRateAsync` - `GetOpenBorrowOrdersAsync` ## Enums: #### Added enums: - `FlexibleBorrowStatus` - `LoanLiquidationStatus` ## Models: #### 1. Added models for missing methods: - `BinanceCryptoLoanFlexibleBorrowRecord` - `BinanceCryptoLoanFlexibleRepayRecord` - `BinanceCryptoLoanFlexibleLtvAdjustRecord` - `BinanceCryptoLoanLiquidationRecord` #### 2. Refactored existing models: - `BinanceCryptoLoanOpenBorrowOrder` - `BinanceCryptoLoanRepayRate`
parameters.AddOptionalParameter("loanAsset", loanAsset); | ||
parameters.AddOptionalParameter("collateralAsset", collateralAsset); | ||
parameters.AddOptionalParameter("current", page?.ToString(CultureInfo.InvariantCulture)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fine, but there are also helper methods you can use instead.
You could use parameters.AddOptionalString("current", page)
which will internally check for null and convert to string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this in Updated string parameter handling logic
Commit
await tester.ValidateAsync(client => client.GeneralApi.CryptoLoans.CustomizeMarginCallAsync(123), "CustomizeMarginCall"); | ||
} | ||
//[Test] | ||
//public async Task ValidateGeneralCryptoLoansCalls() // TODO Update Crypto Loans Tests for API v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something you could also add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking about doing single PR with test fixes, I noticed that there are lots of general client ones missing. I had an idea that I would add support for missing services like NFT, Gift Cards, VIP Loans, etc and then I would make a single big PR focused on tests. I am currently working on VIP Loans, I hope that I will be done today/tomorrow. And I could start working on tests after that.
Moved from manual string conversion to build in helper `AddOptionalString`
Refactored Crypto Loans General client that partially supported Crypto Loans API v1, to make it fully support new Crypto Loans API v2.
Endpoints:
Added support for new endpoints:
RepayCollateralAsync
GetFlexibleBorrowHistoryAsync
GetLiquidationHistoryAsync
GetFlexibleRepayHistoryAsync
Migrated outdated endpoints from API v1 to API v2 standard:
GetCollateralAssetsAsync
GetLoanableAssetsAsync
BorrowAsync
RepayAsync
AdjustLTVAsync
GetFlexibleLtvAdjustHistoryAsync
GetCollateralRepayRateAsync
GetOpenBorrowOrdersAsync
Fixed parameter naming issue in v1 endpoints:
GetBorrowHistoryAsync
GetLtvAdjustHistoryAsync
GetRepayHistoryAsync
Removed fully retired endpoint:
Customize Margin Call
Enums:
Added new Enums:
RepayStatus
FlexibleBorrowStatus
FlexibleBorrowRecordStatus
LoanLiquidationStatus
Models:
Added new Models:
BinanceCryptoLoanFlexibleBorrowRecord
BinanceCryptoLoanFlexibleLtvAdjastRecord
BinanceCryptoLoanFlexibleRepayRecord
BinanceCryptoLoanLiquidationRecord
Migrated outdated models from API v1 to API v2 standard:
BinanceRestClientGeneralApiLoans
BinanceCryptoLoanAsset
BinanceCryptoLoanCollateralAsset
BinanceCryptoLoanBorrow
BinanceCryptoLoanLtvAdjust
BinanceCryptoLoanRepay
BinanceCryptoLoanOpenBorrowOrder
BinanceCryptoLoanRepayRate
BinanceCryptoLoanFlexibleBorrowRecord
Other Changes:
IBinanceRestClientGeneralApiLoans
interface to match new endpoints.References: