Package com.longbridge.alert
Class AlertContext
- java.lang.Object
-
- com.longbridge.alert.AlertContext
-
- All Implemented Interfaces:
AutoCloseable
public class AlertContext extends Object implements AutoCloseable
Price alert management context.
-
-
Constructor Summary
Constructors Constructor Description AlertContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>add(AddAlertOptions opts)Add a price alert.voidclose()static AlertContextcreate(Config config)Create an AlertContext object.CompletableFuture<Void>delete(DeleteAlertOptions opts)Delete price alerts.CompletableFuture<Void>disable(String alertId)Disable a price alert.CompletableFuture<Void>enable(String alertId)Enable a price alert.CompletableFuture<AlertList>list()List all price alerts.
-
-
-
Method Detail
-
create
public static AlertContext create(Config config)
Create an AlertContext object.- Parameters:
config- Config object- Returns:
- A new AlertContext instance
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
list
public CompletableFuture<AlertList> list() throws OpenApiException
List all price alerts.- Returns:
- A Future resolving to the list of price alerts
- Throws:
OpenApiException- If an error occurs
-
add
public CompletableFuture<Void> add(AddAlertOptions opts) throws OpenApiException
Add a price alert.- Parameters:
opts- Alert options (symbol, condition, trigger value, frequency)- Returns:
- A Future that completes when the alert is added
- Throws:
OpenApiException- If an error occurs
-
enable
public CompletableFuture<Void> enable(String alertId) throws OpenApiException
Enable a price alert.- Parameters:
alertId- ID of the alert to enable- Returns:
- A Future that completes when the alert is enabled
- Throws:
OpenApiException- If an error occurs
-
disable
public CompletableFuture<Void> disable(String alertId) throws OpenApiException
Disable a price alert.- Parameters:
alertId- ID of the alert to disable- Returns:
- A Future that completes when the alert is disabled
- Throws:
OpenApiException- If an error occurs
-
delete
public CompletableFuture<Void> delete(DeleteAlertOptions opts) throws OpenApiException
Delete price alerts.- Parameters:
opts- Options containing the alert IDs to delete- Returns:
- A Future that completes when the alerts are deleted
- Throws:
OpenApiException- If an error occurs
-
-