ValueTag improvements
This commit is contained in:
@@ -3,6 +3,8 @@ package com.fanitas.evelyn.core.impl.ref;
|
|||||||
import com.fanitas.evelyn.core.*;
|
import com.fanitas.evelyn.core.*;
|
||||||
import com.fanitas.evelyn.raydium.RaydiumLiquidityPoolPositionConcentrated;
|
import com.fanitas.evelyn.raydium.RaydiumLiquidityPoolPositionConcentrated;
|
||||||
|
|
||||||
|
import com.r35157.libs.basic.Pair;
|
||||||
|
import com.r35157.libs.basic.Triblet;
|
||||||
import com.r35157.libs.raydium.Raydium;
|
import com.r35157.libs.raydium.Raydium;
|
||||||
import com.r35157.libs.raydium.RaydiumLiquidityPoolPrice;
|
import com.r35157.libs.raydium.RaydiumLiquidityPoolPrice;
|
||||||
import com.r35157.libs.solana.SPLTokenHolding;
|
import com.r35157.libs.solana.SPLTokenHolding;
|
||||||
@@ -119,25 +121,29 @@ public class EvelynImpl implements Evelyn {
|
|||||||
|
|
||||||
System.out.println("Pool price: " + currentPriceFromRaydium + "/" + currentPriceFromChain.amount());
|
System.out.println("Pool price: " + currentPriceFromRaydium + "/" + currentPriceFromChain.amount());
|
||||||
|
|
||||||
Pair totalDistributedSums = desiredPositionCalculator.calculateTotalDistributedSums();
|
Pair<ΩSolanaAmountΩ, ΩSyrupAmountΩ> totalDistributedSums =
|
||||||
ΩSolanaAmountΩ totalDistributedSumSolana = totalDistributedSums.amountA();
|
desiredPositionCalculator.calculateTotalDistributedSums();
|
||||||
ΩSyrupAmountΩ totalDistributedSumSyrup = totalDistributedSums.amountB();
|
ΩSolanaAmountΩ totalDistributedSumSolana = totalDistributedSums.left();
|
||||||
|
ΩSyrupAmountΩ totalDistributedSumSyrup = totalDistributedSums.right();
|
||||||
System.out.println("Total amount currently distributed: " + totalDistributedSumSolana
|
System.out.println("Total amount currently distributed: " + totalDistributedSumSolana
|
||||||
+ " / " + totalDistributedSumSyrup);
|
+ " / " + totalDistributedSumSyrup);
|
||||||
|
|
||||||
Pair amountsLocked = desiredPositionCalculator.calculateLockedSums(currentPriceFromChain.amount());
|
Pair<ΩSolanaAmountΩ, ΩSyrupAmountΩ> amountsLocked =
|
||||||
ΩSolanaAmountΩ amountLockedSolana = amountsLocked.amountA();
|
desiredPositionCalculator.calculateLockedSums(currentPriceFromChain.amount());
|
||||||
ΩSyrupAmountΩ amountLockedSyrup = amountsLocked.amountB();
|
ΩSolanaAmountΩ amountLockedSolana = amountsLocked.left();
|
||||||
|
ΩSyrupAmountΩ amountLockedSyrup = amountsLocked.right();
|
||||||
System.out.println("Total amount locked due to HIGH price: " + amountLockedSolana);
|
System.out.println("Total amount locked due to HIGH price: " + amountLockedSolana);
|
||||||
System.out.println("Total amount locked due to LOW price: " + amountLockedSyrup);
|
System.out.println("Total amount locked due to LOW price: " + amountLockedSyrup);
|
||||||
|
|
||||||
ΩSyrupAmountΩ totalAmountSyrup = add(totalDistributedSumSyrup, inactiveInAccountSyrup);
|
ΩSyrupAmountΩ totalAmountSyrup = add(totalDistributedSumSyrup, inactiveInAccountSyrup);
|
||||||
ΩSyrupAmountΩ reservedForBurnSyrup = subtract(totalAmountSyrup, state.getSyrupOwnedByEvelyn());
|
ΩSyrupAmountΩ reservedForBurnSyrup = subtract(totalAmountSyrup, state.getSyrupOwnedByEvelyn());
|
||||||
ΩSolanaAmountΩ readyForBurnSolana = subtract(solBalanceEvelyn, SOFT_LOW_LIMIT_SOLANA_BALANCE);
|
|
||||||
System.out.println("Amount reserved for burn: Syrup:" + reservedForBurnSyrup.amount()
|
|
||||||
+ " + Solana: " + readyForBurnSolana.amount());
|
|
||||||
|
|
||||||
Pair/*ΩSyrupAmountΩ*/ syrupTotalReadyAmount = desiredPositionCalculator.calculateRedistributableSums(
|
ΩSolanaAmountΩ readyForBurnSolana = subtract(solBalanceEvelyn, SOFT_LOW_LIMIT_SOLANA_BALANCE);
|
||||||
|
System.out.println("Amount reserved for burn: "
|
||||||
|
+ "Solana: " + readyForBurnSolana
|
||||||
|
+ ", Syrup:" + reservedForBurnSyrup);
|
||||||
|
|
||||||
|
Pair<ΩSolanaAmountΩ, ΩSyrupAmountΩ> syrupTotalReadyAmount = desiredPositionCalculator.calculateRedistributableSums(
|
||||||
currentPriceFromChain.amount(),
|
currentPriceFromChain.amount(),
|
||||||
new ΩSyrupAmountΩ(inactiveInAccountSyrup, readyForBurnSolana.currencyType()), // TODO: Wow! This is not pretty! Stealing cyrrenctType from another object. Oh dear!
|
new ΩSyrupAmountΩ(inactiveInAccountSyrup, readyForBurnSolana.currencyType()), // TODO: Wow! This is not pretty! Stealing cyrrenctType from another object. Oh dear!
|
||||||
reservedForBurnSyrup
|
reservedForBurnSyrup
|
||||||
|
|||||||
Reference in New Issue
Block a user