Savings
Installation
- Maven
- Gradle
pom.xml
<dependency>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<version>{{version}}</version>
</dependency>
build.gradle
implementation '{{groupId}}:{{artifactId}}:{{version}}'
Client instantiation
SavingsClient client = new SavingsClient(key, secret);
Features
Get flexible product list.
- Default
- With status
- Featured
- Paginated
- Sync
- Async
try{
FlexibleProduct res = client.getFlexibleProducts().sync();
}catch(ApiException e){
//...
}
client.getFlexibleProducts().async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
FlexibleProduct res = client.getFlexibleProducts(new FlexibleProductsParams(FlexibleProductStatus.SUBSCRIBABLE)).sync();
}catch(ApiException e){
//...
}
client.getFlexibleProducts(new FlexibleProductsParams(FlexibleProductStatus.SUBSCRIBABLE)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
FlexibleProduct res = client.getFlexibleProducts(new FlexibleProductsParams(FlexibleProductStatus.SUBSCRIBABLE,Featured.TRUE)).sync();
}catch(ApiException e){
//...
}
client.getFlexibleProducts(new FlexibleProductsParams(FlexibleProductStatus.SUBSCRIBABLE,Featured.TRUE)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
FlexibleProduct res = client.getFlexibleProducts(new Paging(page, limit)).sync();
}catch(ApiException e){
//...
}
client.getFlexibleProducts(new Paging(page, limit)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get left daily purchase quota of flexible product
- Sync
- Async
try{
PurchaseQuota res = client.getLeftDailyFlexiblePurchaseQuota(new PurchaseQuotaParams(productId)).sync();
}catch(ApiException e){
//...
}
client.getLeftDailyFlexiblePurchaseQuota(new PurchaseQuotaParams(productId)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get Left Daily Redemption Quota of Flexible Product
- Sync
- Async
try{
RedemptionQuota res = client.getLeftDailyRedemptionQuota(new RedemptionQuotaParams(productId, ProductType.FAST)).sync();
}catch(ApiException e){
//...
}
client.getLeftDailyRedemptionQuota(new RedemptionQuotaParams(productId, ProductType.FAST)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Purchase Flexible Product
- Sync
- Async
try{
PurchaseResponse res = client.purchaseFlexible(new FlexiblePurchaseParams(productId, amount)).sync();
}catch(ApiException e){
//...
}
client.purchaseFlexible(new FlexiblePurchaseParams(productId, amount)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Redeem Flexible Product
- Sync
- Async
try{
client.redeemFlexible(new RedemptionParams(productId, amount, type)).sync();
}catch(ApiException e){
//...
}
client.redeemFlexible(new RedemptionParams(productId, amount, type)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get flexible product position
- Default
- Specific asset
- Sync
- Async
try{
List<FlexibleProductPosition> res = client.getFlexibleProductPosition().sync();
}catch(ApiException e){
//...
}
client.getFlexibleProductPosition().async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<FlexibleProductPosition> res = client.getFlexibleProductPosition(new FlexibleProductPositionParams(asset)).sync();
}catch(ApiException e){
//...
}
client.getFlexibleProductPosition(new FlexibleProductPositionParams(asset)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get fixed and activity project list
- Default
- Paginated
- Sorted
- Sync
- Async
try{
List<FixedProject> res = client.getFixedProjects(new FixedProjectListParams(type, asset, status)).sync();
}catch(ApiException e){
//...
}
client.getFixedProjects(new FixedProjectListParams(type, asset, status)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<FixedProject> res = client.getFixedProjects(new FixedProjectListParams(type, asset, status), new Paging(page, limit)).sync();
}catch(ApiException e){
//...
}
client.getFixedProjects(new FixedProjectListParams(type, asset, status), new Paging(page, limit)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<FixedProject> res = client.getFixedProjects(new FixedProjectListParams(type, asset, status), new Sorting(FixedProjectSorting.LOT_SIZE, isSortAsc)).sync();
}catch(ApiException e){
//...
}
client.getFixedProjects(new FixedProjectListParams(type, asset, status), new Sorting(FixedProjectSorting.LOT_SIZE, isSortAsc)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Purchase fixed project
- Sync
- Async
try{
PurchaseResponse res = client.purchaseFixed(new FixedPurchaseParams(productId, lot)).sync();
}catch(ApiException e){
//...
}
client.purchaseFixed(new FixedPurchaseParams(productId, lot)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get fixed/activity project position
- Sync
- Async
try{
List<FixedProjectPosition> res = client.getFixedProjectPosition(new FixedProjectPositionParams(asset, projectId, status)).sync();
}catch(ApiException e){
//...
}
client.getFixedProjectPosition(new FixedProjectPositionParams(asset, projectId, status)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get lending account
- Sync
- Async
try{
LendingAccount res = client.getAccount().sync();
}catch(ApiException e){
//...
}
client.getAccount().async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get purchase record
- Default
- Framed
- Sync
- Async
try{
List<Purchase> res = client.getPurchases(new LendingParams(LendingType.DAILY, asset)).sync();
}catch(ApiException e){
//...
}
client.getPurchases(new LendingParams(LendingType.DAILY, asset)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<Purchase> res = client.getPurchases(new LendingParams(LendingType.DAILY, asset), new FramedPaging(startTime, endTime, page, limit)).sync();
}catch(ApiException e){
//...
}
client.getPurchases(new LendingParams(LendingType.DAILY, asset), new FramedPaging(startTime, endTime, page, limit)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get redemption record
- Default
- Framed
- Sync
- Async
try{
List<Redemption> res = client.getRedemptions(new LendingParams(LendingType.DAILY, asset)).sync();
}catch(ApiException e){
//...
}
client.getRedemptions(new LendingParams(LendingType.DAILY, asset)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<Redemption> res = client.getRedemptions(new LendingParams(LendingType.DAILY, asset), new FramedPaging(startTime, endTime, page, limit)).sync();
}catch(ApiException e){
//...
}
client.getRedemptions(new LendingParams(LendingType.DAILY, asset), new FramedPaging(startTime, endTime, page, limit)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Get interest record
- Default
- Framed
- Sync
- Async
try{
List<Interest> res = client.getInterests(new LendingParams(LendingType.DAILY, asset)).sync();
}catch(ApiException e){
//...
}
client.getInterests(new LendingParams(LendingType.DAILY, asset)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
- Sync
- Async
try{
List<Interest> res = client.getInterests(new LendingParams(LendingType.DAILY, asset), new FramedPaging(startTime, endTime, page, limit)).sync();
}catch(ApiException e){
//...
}
client.getInterests(new LendingParams(LendingType.DAILY, asset), new FramedPaging(startTime, endTime, page, limit)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});
Change fixed/activity position to daily position
- Sync
- Async
try{
PositionChangedResponse res = client.fixedToDailyPosition(new ChangePositionParams(projectId, lot, positionId)).sync();
}catch(ApiException e){
//...
}
client.fixedToDailyPosition(new ChangePositionParams(projectId, lot, positionId)).async((response, exception) -> {
if(exception == null){
//...
}else{
//...
}
});