Package com.longbridge.grid
Class GridContext
- java.lang.Object
-
- com.longbridge.grid.GridContext
-
- All Implemented Interfaces:
AutoCloseable
public class GridContext extends Object implements AutoCloseable
Grid trading order management context.
-
-
Constructor Summary
Constructors Constructor Description GridContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>cancel(String orderId)Cancel a grid trading ordervoidclose()static GridContextcreate(Config config)Create a GridContext object.CompletableFuture<GridOrderDetail>detail(GetGridOrderDetailOptions opts)Get grid trading order detail (and paged history)CompletableFuture<GridOrdersResponse>list(GetGridOrdersOptions opts)Get grid trading orders (paged list)CompletableFuture<GridOrder[]>listByIds(String[] orderIds)Query grid trading orders by IDsCompletableFuture<Void>replace(ReplaceGridOrderOptions opts)Replace (modify) a grid trading orderCompletableFuture<Void>restart(String orderId)Restart a grid trading orderCompletableFuture<SubmitGridOrderResponse>submit(SubmitGridOrderOptions opts)Submit a grid trading orderCompletableFuture<Void>suspend(String orderId)Suspend a grid trading orderCompletableFuture<GridSymbolInfo>symbolInfo(String symbol)Get the security (symbol) info used to build a grid order (lot size, authorization flag, settlement currency, etc.).CompletableFuture<GridTriggerHistoryResponse>triggerHistory(GetGridTriggerHistoryOptions opts)Get grid trading trigger history
-
-
-
Method Detail
-
create
public static GridContext create(Config config)
Create a GridContext object.- Parameters:
config- Config object- Returns:
- A new GridContext instance
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
submit
public CompletableFuture<SubmitGridOrderResponse> submit(SubmitGridOrderOptions opts) throws OpenApiException
Submit a grid trading order- Parameters:
opts- Options for this request, not null- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
replace
public CompletableFuture<Void> replace(ReplaceGridOrderOptions opts) throws OpenApiException
Replace (modify) a grid trading order- Parameters:
opts- Options for this request, not null- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
list
public CompletableFuture<GridOrdersResponse> list(GetGridOrdersOptions opts) throws OpenApiException
Get grid trading orders (paged list)- Parameters:
opts- Options for this request; may be null- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
listByIds
public CompletableFuture<GridOrder[]> listByIds(String[] orderIds) throws OpenApiException
Query grid trading orders by IDs- Parameters:
orderIds- Grid master order IDs- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
detail
public CompletableFuture<GridOrderDetail> detail(GetGridOrderDetailOptions opts) throws OpenApiException
Get grid trading order detail (and paged history)- Parameters:
opts- Options for this request, not null- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
triggerHistory
public CompletableFuture<GridTriggerHistoryResponse> triggerHistory(GetGridTriggerHistoryOptions opts) throws OpenApiException
Get grid trading trigger history- Parameters:
opts- Options for this request, not null- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
cancel
public CompletableFuture<Void> cancel(String orderId) throws OpenApiException
Cancel a grid trading order- Parameters:
orderId- Grid master order ID- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
suspend
public CompletableFuture<Void> suspend(String orderId) throws OpenApiException
Suspend a grid trading order- Parameters:
orderId- Grid master order ID- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
restart
public CompletableFuture<Void> restart(String orderId) throws OpenApiException
Restart a grid trading order- Parameters:
orderId- Grid master order ID- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
symbolInfo
public CompletableFuture<GridSymbolInfo> symbolInfo(String symbol) throws OpenApiException
Get the security (symbol) info used to build a grid order (lot size, authorization flag, settlement currency, etc.).- Parameters:
symbol- Security symbol (e.g. 700.HK)- Returns:
- A Future representing the result of the operation
- Throws:
OpenApiException- If an error occurs
-
-