lending need to finish response ins

This commit is contained in:
wuhewuhe 2023-11-06 01:15:59 +01:00
parent e78bfa1d40
commit f5c42481a7
3 changed files with 206 additions and 3 deletions

View File

@ -271,23 +271,33 @@ func (c *Client) NewAccountServiceNoParams() *AccountClient {
func (c *Client) NewAssetService(params map[string]interface{}) *AssetClient {
return &AssetClient{
c: c,
c: c,
params: params,
}
}
func (c *Client) NewUserService(params map[string]interface{}) *UserServiceClient {
return &UserServiceClient{
c: c,
c: c,
params: params,
}
}
func (c *Client) NewBrokerService(params map[string]interface{}) *BrokerServiceClient {
return &BrokerServiceClient{
c: c,
c: c,
params: params,
}
}
func (c *Client) NewLendingService(params map[string]interface{}) *LendingServiceClient {
return &LendingServiceClient{
c: c,
params: params,
}
}
func (c *Client) NewLendingServiceNoParams() *LendingServiceClient {
return &LendingServiceClient{
c: c,
}

View File

@ -12,6 +12,112 @@ type LendingServiceClient struct {
params map[string]interface{}
}
func (s *LendingServiceClient) GetInsLoanInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
if err = handlers.ValidateParams(s.params); err != nil {
return nil, err
}
r := &request{
method: http.MethodGet,
endpoint: "/v5/ins-loan/product-infos",
secType: secTypeSigned,
}
r.setParams(s.params)
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(ServerResponse)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
func (s *LendingServiceClient) GetInsMarginCoinInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
if err = handlers.ValidateParams(s.params); err != nil {
return nil, err
}
r := &request{
method: http.MethodGet,
endpoint: "/v5/ins-loan/ensure-tokens-convert",
secType: secTypeSigned,
}
r.setParams(s.params)
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(ServerResponse)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
func (s *LendingServiceClient) GetInsLoanOrders(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
if err = handlers.ValidateParams(s.params); err != nil {
return nil, err
}
r := &request{
method: http.MethodGet,
endpoint: "/v5/ins-loan/loan-order",
secType: secTypeSigned,
}
r.setParams(s.params)
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(ServerResponse)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
func (s *LendingServiceClient) GetInsRepayOrders(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
if err = handlers.ValidateParams(s.params); err != nil {
return nil, err
}
r := &request{
method: http.MethodGet,
endpoint: "/v5/ins-loan/repaid-history",
secType: secTypeSigned,
}
r.setParams(s.params)
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(ServerResponse)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
func (s *LendingServiceClient) GetInsLoanToValue(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
r := &request{
method: http.MethodGet,
endpoint: "/v5/ins-loan/ltv-convert",
secType: secTypeSigned,
}
data, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return nil, err
}
res = new(ServerResponse)
err = json.Unmarshal(data, res)
if err != nil {
return nil, err
}
return res, nil
}
func (s *LendingServiceClient) GetC2cLendingCoinInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
if err = handlers.ValidateParams(s.params); err != nil {
return nil, err

View File

@ -60,3 +60,90 @@ type LendingOrderRecord struct {
type LendingOrdersRecordsResult struct {
List []LendingOrderRecord `json:"list"`
}
type MarginProductInfo struct {
ProductId string `json:"productId"`
Leverage string `json:"leverage"`
SupportSpot int `json:"supportSpot"`
SupportContract int `json:"supportContract"`
SupportMarginTrading int `json:"supportMarginTrading"`
WithdrawLine string `json:"withdrawLine"`
TransferLine string `json:"transferLine"`
SpotBuyLine string `json:"spotBuyLine"`
SpotSellLine string `json:"spotSellLine"`
ContractOpenLine string `json:"contractOpenLine"`
LiquidationLine string `json:"liquidationLine"`
StopLiquidationLine string `json:"stopLiquidationLine"`
ContractLeverage string `json:"contractLeverage"`
TransferRatio string `json:"transferRatio"`
SpotSymbols []string `json:"spotSymbols"`
ContractSymbols []string `json:"contractSymbols"`
SupportUSDCContract int `json:"supportUSDCContract"`
SupportUSDCOptions int `json:"supportUSDCOptions"`
USDTPerpetualOpenLine string `json:"USDTPerpetualOpenLine"`
USDCContractOpenLine string `json:"USDCContractOpenLine"`
USDCOptionsOpenLine string `json:"USDCOptionsOpenLine"`
USDTPerpetualCloseLine string `json:"USDTPerpetualCloseLine"`
USDCContractCloseLine string `json:"USDCContractCloseLine"`
USDCOptionsCloseLine string `json:"USDCOptionsCloseLine"`
USDCContractSymbols []string `json:"USDCContractSymbols"`
USDCOptionsSymbols []string `json:"USDCOptionsSymbols"`
MarginLeverage string `json:"marginLeverage"`
USDTPerpetualLeverage []LeverageInfo `json:"USDTPerpetualLeverage"`
USDCContractLeverage []LeverageInfo `json:"USDCContractLeverage"`
}
type LeverageInfo struct {
Symbol string `json:"symbol"`
Leverage string `json:"leverage"`
}
type TokenInfo struct {
Token string `json:"token"`
ConvertRatioList []ConvertRatio `json:"convertRatioList"`
}
type ConvertRatio struct {
Ladder string `json:"ladder"`
ConvertRatio string `json:"convertRatio"`
}
type MarginToken struct {
ProductId string `json:"productId"`
TokenInfo []TokenInfo `json:"tokenInfo"`
}
// LoanInfo To do
type LoanInfo struct {
OrderId string `json:"orderId"`
OrderProductId string `json:"orderProductId"`
ParentUid string `json:"parentUid"`
LoanTime string `json:"loanTime"`
LoanCoin string `json:"loanCoin"`
LoanAmount string `json:"loanAmount"`
UnpaidAmount string `json:"unpaidAmount"`
UnpaidInterest string `json:"unpaidInterest"`
RepaidAmount string `json:"repaidAmount"`
RepaidInterest string `json:"repaidInterest"`
InterestRate string `json:"interestRate"`
Status string `json:"status"`
Leverage string `json:"leverage"`
SupportSpot string `json:"supportSpot"`
SupportContract string `json:"supportContract"`
WithdrawLine string `json:"withdrawLine"`
TransferLine string `json:"transferLine"`
SpotBuyLine string `json:"spotBuyLine"`
SpotSellLine string `json:"spotSellLine"`
ContractOpenLine string `json:"contractOpenLine"`
LiquidationLine string `json:"liquidationLine"`
StopLiquidationLine string `json:"stopLiquidationLine"`
ContractLeverage string `json:"contractLeverage"`
TransferRatio string `json:"transferRatio"`
SpotSymbols []string `json:"spotSymbols"`
ContractSymbols []string `json:"contractSymbols"`
SupportUSDCContract string `json:"supportUSDCContract"`
SupportUSDCOptions string `json:"supportUSDCOptions"`
SupportMarginTrading string `json:"supportMarginTrading"`
USDTPerpetualOpenLine string `json:"USDTPerpetualOpenLine"`
USDCContractOpenLine string `json:"USDCContractOpenLine"`
}