0
# Earn Products
1
2
Access to KuCoin's comprehensive earning products including savings accounts, staking rewards, and fixed income products. Provides portfolio management for various cryptocurrency earning opportunities with competitive yields.
3
4
## Capabilities
5
6
### Savings Products
7
8
Flexible savings accounts with competitive interest rates.
9
10
```python { .api }
11
def get_earn_savings_products():
12
"""
13
Get available savings products.
14
15
Returns:
16
dict: List of savings products with rates and terms
17
"""
18
```
19
20
### Staking Products
21
22
Cryptocurrency staking opportunities for earning rewards.
23
24
```python { .api }
25
def get_earn_staking_products():
26
"""
27
Get available staking products.
28
29
Returns:
30
dict: Staking products with reward rates and lock periods
31
"""
32
33
def get_earn_staking_products_v3():
34
"""
35
Get staking products (v3 API).
36
37
Returns:
38
dict: Enhanced staking product information
39
"""
40
41
def get_earn_kcs_staking_products():
42
"""
43
Get KCS-specific staking products.
44
45
Returns:
46
dict: KCS staking opportunities and rates
47
"""
48
49
def get_earn_kcs_staking_products_v3():
50
"""
51
Get KCS staking products (v3 API).
52
53
Returns:
54
dict: Enhanced KCS staking information
55
"""
56
57
def get_earn_eth_staking_products():
58
"""
59
Get Ethereum staking products.
60
61
Returns:
62
dict: ETH staking opportunities and rewards
63
"""
64
```
65
66
### Fixed Income Products
67
68
Fixed-term investment products with guaranteed returns.
69
70
```python { .api }
71
def get_earn_fixed_income_current_holdings():
72
"""
73
Get current fixed income holdings.
74
75
Returns:
76
dict: Active fixed income positions and earnings
77
"""
78
```
79
80
### Promotion Products
81
82
Special promotional earning opportunities.
83
84
```python { .api }
85
def get_earn_promotion_products():
86
"""
87
Get available promotion products.
88
89
Returns:
90
dict: Promotional earning opportunities with enhanced rates
91
"""
92
```
93
94
## Usage Examples
95
96
### Explore Available Products
97
98
```python
99
from kucoin.client import Earn
100
101
# Initialize earn client
102
earn = Earn(api_key, api_secret, api_passphrase, is_sandbox=False)
103
104
# Get all savings products
105
savings = earn.get_earn_savings_products()
106
print("Available Savings Products:")
107
for product in savings.get('data', []):
108
print(f"- {product['currency']}: {product['interestRate']}% APY")
109
print(f" Min amount: {product['minPurchaseSize']}")
110
print(f" Max amount: {product['maxPurchaseSize']}")
111
112
# Get staking opportunities
113
staking = earn.get_earn_staking_products()
114
print("\nStaking Products:")
115
for product in staking.get('data', []):
116
print(f"- {product['currency']}: {product['rewardRate']}% rewards")
117
print(f" Lock period: {product['lockPeriod']} days")
118
```
119
120
### KCS Staking Analysis
121
122
```python
123
# Get KCS staking products
124
kcs_staking = earn.get_earn_kcs_staking_products()
125
print("KCS Staking Options:")
126
127
for product in kcs_staking.get('data', []):
128
print(f"- Product: {product['productName']}")
129
print(f" APY: {product['annualizedRate']}%")
130
print(f" Min stake: {product['minAmount']} KCS")
131
print(f" Lock period: {product['lockPeriod']} days")
132
print(f" Available quota: {product['availableQuota']} KCS")
133
134
# Compare with v3 API
135
kcs_staking_v3 = earn.get_earn_kcs_staking_products_v3()
136
print("\nKCS Staking (V3 API):")
137
for product in kcs_staking_v3.get('data', []):
138
print(f"- {product['productName']}: {product['expectedRate']}% expected rate")
139
```
140
141
### Ethereum Staking
142
143
```python
144
# Get ETH staking information
145
eth_staking = earn.get_earn_eth_staking_products()
146
print("Ethereum Staking:")
147
148
for product in eth_staking.get('data', []):
149
print(f"- Product: {product['productName']}")
150
print(f" Expected APY: {product['expectedApr']}%")
151
print(f" Min stake: {product['minAmount']} ETH")
152
print(f" Validation period: {product['validationPeriod']}")
153
print(f" Withdrawal delay: {product['withdrawalDelay']} days")
154
```
155
156
### Fixed Income Portfolio
157
158
```python
159
# Check current fixed income holdings
160
holdings = earn.get_earn_fixed_income_current_holdings()
161
print("Current Fixed Income Holdings:")
162
163
total_principal = 0
164
total_earnings = 0
165
166
for holding in holdings.get('data', []):
167
principal = float(holding['principal'])
168
earnings = float(holding['earnings'])
169
170
total_principal += principal
171
total_earnings += earnings
172
173
print(f"- {holding['currency']}: {principal} principal")
174
print(f" Earnings: {earnings} {holding['currency']}")
175
print(f" APY: {holding['interestRate']}%")
176
print(f" Maturity: {holding['maturityDate']}")
177
178
print(f"\nPortfolio Summary:")
179
print(f"Total Principal: {total_principal}")
180
print(f"Total Earnings: {total_earnings}")
181
print(f"Overall Return: {(total_earnings / total_principal * 100):.2f}%")
182
```
183
184
### Promotional Opportunities
185
186
```python
187
# Check for promotional products
188
promotions = earn.get_earn_promotion_products()
189
print("Promotional Products:")
190
191
for promo in promotions.get('data', []):
192
print(f"- {promo['productName']}")
193
print(f" Currency: {promo['currency']}")
194
print(f" Promotional rate: {promo['promotionalRate']}%")
195
print(f" Regular rate: {promo['regularRate']}%")
196
print(f" Promotion period: {promo['promotionDays']} days")
197
print(f" Available until: {promo['endDate']}")
198
199
# Calculate potential earnings
200
if 'maxAmount' in promo:
201
max_amount = float(promo['maxAmount'])
202
promo_rate = float(promo['promotionalRate']) / 100
203
promo_days = int(promo['promotionDays'])
204
205
potential_earnings = max_amount * promo_rate * (promo_days / 365)
206
print(f" Max potential earnings: {potential_earnings:.4f} {promo['currency']}")
207
```
208
209
### Product Comparison
210
211
```python
212
def compare_earn_products():
213
"""Compare different earning products to find the best yields."""
214
earn_products = {}
215
216
# Collect all products
217
try:
218
savings = earn.get_earn_savings_products()
219
earn_products['savings'] = savings.get('data', [])
220
except:
221
earn_products['savings'] = []
222
223
try:
224
staking = earn.get_earn_staking_products()
225
earn_products['staking'] = staking.get('data', [])
226
except:
227
earn_products['staking'] = []
228
229
try:
230
promotions = earn.get_earn_promotion_products()
231
earn_products['promotions'] = promotions.get('data', [])
232
except:
233
earn_products['promotions'] = []
234
235
# Find best rates by currency
236
best_rates = {}
237
238
for product_type, products in earn_products.items():
239
for product in products:
240
currency = product.get('currency', 'Unknown')
241
rate_key = 'interestRate' if 'interestRate' in product else 'rewardRate'
242
rate = float(product.get(rate_key, 0))
243
244
if currency not in best_rates or rate > best_rates[currency]['rate']:
245
best_rates[currency] = {
246
'rate': rate,
247
'type': product_type,
248
'product': product.get('productName', 'Unknown')
249
}
250
251
print("Best Earning Rates by Currency:")
252
for currency, info in best_rates.items():
253
print(f"{currency}: {info['rate']}% - {info['product']} ({info['type']})")
254
255
return best_rates
256
257
# best_rates = compare_earn_products()
258
```
259
260
### Yield Farming Strategy
261
262
```python
263
def analyze_yield_opportunities(target_currencies=['USDT', 'BTC', 'ETH']):
264
"""Analyze earning opportunities for target currencies."""
265
266
opportunities = {}
267
268
for currency in target_currencies:
269
opportunities[currency] = []
270
271
# Check savings
272
try:
273
savings = earn.get_earn_savings_products()
274
for product in savings.get('data', []):
275
if product.get('currency') == currency:
276
opportunities[currency].append({
277
'type': 'savings',
278
'name': product.get('productName', 'Savings'),
279
'rate': float(product.get('interestRate', 0)),
280
'min_amount': float(product.get('minPurchaseSize', 0)),
281
'liquidity': 'flexible'
282
})
283
except:
284
pass
285
286
# Check staking
287
try:
288
staking = earn.get_earn_staking_products()
289
for product in staking.get('data', []):
290
if product.get('currency') == currency:
291
opportunities[currency].append({
292
'type': 'staking',
293
'name': product.get('productName', 'Staking'),
294
'rate': float(product.get('rewardRate', 0)),
295
'min_amount': float(product.get('minAmount', 0)),
296
'liquidity': f"{product.get('lockPeriod', 0)} days lock"
297
})
298
except:
299
pass
300
301
# Display opportunities
302
for currency, opps in opportunities.items():
303
if opps:
304
print(f"\n{currency} Earning Opportunities:")
305
sorted_opps = sorted(opps, key=lambda x: x['rate'], reverse=True)
306
for opp in sorted_opps:
307
print(f"- {opp['name']}: {opp['rate']}% ({opp['liquidity']})")
308
print(f" Min: {opp['min_amount']} {currency}")
309
310
return opportunities
311
312
# opportunities = analyze_yield_opportunities()
313
```
314
315
## Types
316
317
```python { .api }
318
SavingsProduct = dict
319
# {
320
# "currency": str, # Currency code
321
# "productName": str, # Product name
322
# "interestRate": str, # Interest rate (APY)
323
# "minPurchaseSize": str, # Minimum purchase amount
324
# "maxPurchaseSize": str, # Maximum purchase amount
325
# "purchaseEnable": bool, # Purchase enabled
326
# "redeemEnable": bool, # Redemption enabled
327
# "productStatus": str # Product status
328
# }
329
330
StakingProduct = dict
331
# {
332
# "currency": str, # Staking currency
333
# "productName": str, # Product name
334
# "rewardRate": str, # Reward rate (APY)
335
# "annualizedRate": str, # Annualized rate
336
# "lockPeriod": int, # Lock period in days
337
# "minAmount": str, # Minimum staking amount
338
# "maxAmount": str, # Maximum staking amount
339
# "availableQuota": str, # Available staking quota
340
# "productStatus": str # Product status
341
# }
342
343
FixedIncomeHolding = dict
344
# {
345
# "orderId": str, # Order ID
346
# "currency": str, # Currency
347
# "principal": str, # Principal amount
348
# "earnings": str, # Earned amount
349
# "interestRate": str, # Interest rate
350
# "purchaseTime": int, # Purchase timestamp
351
# "maturityDate": str, # Maturity date
352
# "status": str # Holding status
353
# }
354
355
PromotionProduct = dict
356
# {
357
# "productName": str, # Product name
358
# "currency": str, # Currency
359
# "promotionalRate": str, # Promotional interest rate
360
# "regularRate": str, # Regular interest rate
361
# "promotionDays": int, # Promotion period in days
362
# "maxAmount": str, # Maximum investment amount
363
# "startDate": str, # Promotion start date
364
# "endDate": str, # Promotion end date
365
# "productStatus": str # Product status
366
# }
367
368
ETHStakingProduct = dict
369
# {
370
# "productName": str, # Product name
371
# "expectedApr": str, # Expected annual percentage rate
372
# "minAmount": str, # Minimum stake amount (ETH)
373
# "validationPeriod": str, # Validation period
374
# "withdrawalDelay": int, # Withdrawal delay in days
375
# "stakingRewards": str, # Staking rewards structure
376
# "productStatus": str # Product status
377
# }
378
379
KCSStakingProduct = dict
380
# {
381
# "productName": str, # Product name
382
# "annualizedRate": str, # Annualized reward rate
383
# "expectedRate": str, # Expected rate
384
# "lockPeriod": int, # Lock period in days
385
# "minAmount": str, # Minimum stake amount (KCS)
386
# "availableQuota": str, # Available staking quota
387
# "stakingType": str, # Staking type
388
# "productStatus": str # Product status
389
# }
390
```