Skip to main content
Version: 2.x

Savings

 License: MIT 

Installation

pom.xml
<dependency>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<version>{{version}}</version>
</dependency>

Client instantiation

SavingsClient client = new SavingsClient(key, secret);

Features

Get flexible product list.

try{
FlexibleProduct res = client.getFlexibleProducts().sync();
}catch(ApiException e){
//...
}

Get left daily purchase quota of flexible product

try{
PurchaseQuota res = client.getLeftDailyFlexiblePurchaseQuota(new PurchaseQuotaParams(productId)).sync();
}catch(ApiException e){
//...
}

Get Left Daily Redemption Quota of Flexible Product

try{
RedemptionQuota res = client.getLeftDailyRedemptionQuota(new RedemptionQuotaParams(productId, ProductType.FAST)).sync();
}catch(ApiException e){
//...
}

Purchase Flexible Product

try{
PurchaseResponse res = client.purchaseFlexible(new FlexiblePurchaseParams(productId, amount)).sync();
}catch(ApiException e){
//...
}

Redeem Flexible Product

try{
client.redeemFlexible(new RedemptionParams(productId, amount, type)).sync();
}catch(ApiException e){
//...
}

Get flexible product position

try{
List<FlexibleProductPosition> res = client.getFlexibleProductPosition().sync();
}catch(ApiException e){
//...
}

Get fixed and activity project list

try{
List<FixedProject> res = client.getFixedProjects(new FixedProjectListParams(type, asset, status)).sync();
}catch(ApiException e){
//...
}

Purchase fixed project

try{
PurchaseResponse res = client.purchaseFixed(new FixedPurchaseParams(productId, lot)).sync();
}catch(ApiException e){
//...
}

Get fixed/activity project position

try{
List<FixedProjectPosition> res = client.getFixedProjectPosition(new FixedProjectPositionParams(asset, projectId, status)).sync();
}catch(ApiException e){
//...
}

Get lending account

try{
LendingAccount res = client.getAccount().sync();
}catch(ApiException e){
//...
}

Get purchase record

try{
List<Purchase> res = client.getPurchases(new LendingParams(LendingType.DAILY, asset)).sync();
}catch(ApiException e){
//...
}

Get redemption record

try{
List<Redemption> res = client.getRedemptions(new LendingParams(LendingType.DAILY, asset)).sync();
}catch(ApiException e){
//...
}

Get interest record

try{
List<Interest> res = client.getInterests(new LendingParams(LendingType.DAILY, asset)).sync();
}catch(ApiException e){
//...
}

Change fixed/activity position to daily position

try{
PositionChangedResponse res = client.fixedToDailyPosition(new ChangePositionParams(projectId, lot, positionId)).sync();
}catch(ApiException e){
//...
}