20: Map mint addresses to asset symbols
This commit is contained in:
+24
@@ -33,6 +33,17 @@ public final class JupiterPerpsEntryPriceVariableRefresher {
|
|||||||
"Fetched " + positions.size()
|
"Fetched " + positions.size()
|
||||||
+ " open Jupiter Perps positions for wallet: " + wallet
|
+ " open Jupiter Perps positions for wallet: " + wallet
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for (JupiterPerpsPosition position : positions) {
|
||||||
|
String variableName = createEntryPriceVariableName(position);
|
||||||
|
|
||||||
|
System.out.println(
|
||||||
|
"Jupiter Perps position maps to variable "
|
||||||
|
+ variableName
|
||||||
|
+ " = "
|
||||||
|
+ position.entryPrice()
|
||||||
|
);
|
||||||
|
}
|
||||||
} catch (IOException | InterruptedException exception) {
|
} catch (IOException | InterruptedException exception) {
|
||||||
if (exception instanceof InterruptedException) {
|
if (exception instanceof InterruptedException) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
@@ -45,6 +56,19 @@ public final class JupiterPerpsEntryPriceVariableRefresher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String createEntryPriceVariableName(JupiterPerpsPosition position) {
|
||||||
|
String asset = switch (position.tradedTokenMint()) {
|
||||||
|
case "So11111111111111111111111111111111111111112" -> "SOL";
|
||||||
|
case "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh" -> "BTC";
|
||||||
|
case "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs" -> "ETH";
|
||||||
|
default -> throw new IllegalArgumentException(
|
||||||
|
"Unsupported Jupiter Perps traded token mint: " + position.tradedTokenMint()
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return asset + "_" + position.direction() + "_ENTRY_PRICE";
|
||||||
|
}
|
||||||
|
|
||||||
private final Map<String, String> variables;
|
private final Map<String, String> variables;
|
||||||
private final JupiterPerpsService jupiterPerpsService;
|
private final JupiterPerpsService jupiterPerpsService;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user