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<AlertList>list()List all price alerts.CompletableFuture<Void>update(AlertItem item)Update a price alert (e.g. enable/disable or change its trigger).
-
-
-
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
-
update
public CompletableFuture<Void> update(AlertItem item) throws OpenApiException
Update a price alert (e.g. enable/disable or change its trigger).Typically obtained from
list(); setitem.enabledtotrueto re-enable orfalseto disable, then pass it here.- Parameters:
item- The alert item to update- Returns:
- A Future that completes when the alert is updated
- 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
-
-