From 9099db28b7f10414cc6f22e04ba8abe2abacc0b2 Mon Sep 17 00:00:00 2001 From: Lakshmi Krishnamurthy Date: Sun, 26 Nov 2023 22:36:47 -0500 Subject: [PATCH] Features: Bug Fixes/Re-organization: - Market DTC Order Annotated Shell (1, 2) - Market DTC Order Annotated Constructor (3, 4) - Standard Market DTC Order Builder (5, 6) - Standard Market DTC Order Buy (7, 8) - Standard Market DTC Order Sell (9, 10) - Market Open Order Annotated Shell (11, 12) - Market Open Order Annotated Constructor (13, 14) - Standard Market Open Order Builder (15, 16) - Standard Market Open Order Buy (17, 18) - Standard Market Open Order Sell (19, 20) - Market Close Order Annotated Shell (21, 22) - Market Close Order Annotated Constructor (23, 24) - Standard Market Close Order Builder (25, 26) - Standard Market Close Order Buy (27, 28) - Standard Market Close Order Sell (29, 30) - Market GTC Order Annotated Shell (31, 32) - Market GTC Order Annotated Constructor (33, 34) - Standard Market GTC Order Builder (35, 36) - Standard Market GTC Order Buy (37, 38) - Standard Market GTC Order Sell (39, 40) - Limit AON Order Annotated Shell (41, 42) - Limit AON Order Annotated Constructor (43, 44) - Standard Limit AON Order Builder (45, 46) - Standard Limit AON Order Buy (47, 48) - Standard Limit AON Order Sell (49, 50) - Limit FOK Order Annotated Shell (51, 52) - Limit FOK Order Annotated Constructor (53, 54) - Standard Limit FOK Order Builder (55, 56) - Standard Limit FOK Order Buy (57, 58) - Standard Limit FOK Order Sell (59, 60) Samples: IdeaDRIP: --- ReleaseNotes/01_10_2023.txt | 40 +++ src/main/java/org/drip/oms/order/Limit.java | 180 ----------- .../java/org/drip/oms/order/LimitAON.java | 277 +++++++++++++++++ .../java/org/drip/oms/order/LimitFOK.java | 264 ++++++++++++++++ src/main/java/org/drip/oms/order/Market.java | 76 ----- .../java/org/drip/oms/order/MarketClose.java | 274 +++++++++++++++++ .../java/org/drip/oms/order/MarketDTC.java | 274 +++++++++++++++++ .../java/org/drip/oms/order/MarketGTC.java | 287 ++++++++++++++++++ .../java/org/drip/oms/order/MarketOpen.java | 273 +++++++++++++++++ 9 files changed, 1689 insertions(+), 256 deletions(-) create mode 100644 ReleaseNotes/01_10_2023.txt create mode 100644 src/main/java/org/drip/oms/order/LimitAON.java create mode 100644 src/main/java/org/drip/oms/order/LimitFOK.java create mode 100644 src/main/java/org/drip/oms/order/MarketClose.java create mode 100644 src/main/java/org/drip/oms/order/MarketDTC.java create mode 100644 src/main/java/org/drip/oms/order/MarketGTC.java create mode 100644 src/main/java/org/drip/oms/order/MarketOpen.java diff --git a/ReleaseNotes/01_10_2023.txt b/ReleaseNotes/01_10_2023.txt new file mode 100644 index 000000000000..ca120f442932 --- /dev/null +++ b/ReleaseNotes/01_10_2023.txt @@ -0,0 +1,40 @@ + +Features: + +Bug Fixes/Re-organization: + + - Market DTC Order Annotated Shell (1, 2) + - Market DTC Order Annotated Constructor (3, 4) + - Standard Market DTC Order Builder (5, 6) + - Standard Market DTC Order Buy (7, 8) + - Standard Market DTC Order Sell (9, 10) + - Market Open Order Annotated Shell (11, 12) + - Market Open Order Annotated Constructor (13, 14) + - Standard Market Open Order Builder (15, 16) + - Standard Market Open Order Buy (17, 18) + - Standard Market Open Order Sell (19, 20) + - Market Close Order Annotated Shell (21, 22) + - Market Close Order Annotated Constructor (23, 24) + - Standard Market Close Order Builder (25, 26) + - Standard Market Close Order Buy (27, 28) + - Standard Market Close Order Sell (29, 30) + - Market GTC Order Annotated Shell (31, 32) + - Market GTC Order Annotated Constructor (33, 34) + - Standard Market GTC Order Builder (35, 36) + - Standard Market GTC Order Buy (37, 38) + - Standard Market GTC Order Sell (39, 40) + - Limit AON Order Annotated Shell (41, 42) + - Limit AON Order Annotated Constructor (43, 44) + - Standard Limit AON Order Builder (45, 46) + - Standard Limit AON Order Buy (47, 48) + - Standard Limit AON Order Sell (49, 50) + - Limit FOK Order Annotated Shell (51, 52) + - Limit FOK Order Annotated Constructor (53, 54) + - Standard Limit FOK Order Builder (55, 56) + - Standard Limit FOK Order Buy (57, 58) + - Standard Limit FOK Order Sell (59, 60) + + +Samples: + +IdeaDRIP: diff --git a/src/main/java/org/drip/oms/order/Limit.java b/src/main/java/org/drip/oms/order/Limit.java index 0a522d65bc3c..f39ac919288b 100644 --- a/src/main/java/org/drip/oms/order/Limit.java +++ b/src/main/java/org/drip/oms/order/Limit.java @@ -216,96 +216,6 @@ public static final Limit Buy ( return null; } - /** - * Construct an Instance of Buy Fill-or-Kill Limit Order - * - * @param issuer Order Issuer - * @param securityIdentifier Security Identifier - * @param side Order Side - * @param size Order Size - * @param timeInForce Time-in-Force Settings - * @param thresholdPrice Threshold Price - * - * @return Instance of Buy Limit Order - */ - - public static final Limit BuyFillOrKill ( - final OrderIssuer issuer, - final String securityIdentifier, - final String side, - final double size, - final TimeInForce timeInForce, - final double thresholdPrice) - { - try - { - return new Limit ( - issuer, - securityIdentifier, - StringUtil.GUID(), - new Date(), - Order.BUY, - size, - timeInForce, - OrderFillWholeSettings.FillOrKill(), - thresholdPrice - ); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of Buy All-or-None Limit Order - * - * @param issuer Order Issuer - * @param securityIdentifier Security Identifier - * @param side Order Side - * @param size Order Size - * @param timeInForce Time-in-Force Settings - * @param fulfillTryLimit Fulfill Try Limit - * @param thresholdPrice Threshold Price - * - * @return Instance of Buy All-or-None Limit Order - */ - - public static final Limit BuyAllOrNone ( - final OrderIssuer issuer, - final String securityIdentifier, - final String side, - final double size, - final TimeInForce timeInForce, - final int fulfillTryLimit, - final double thresholdPrice) - { - try - { - return new Limit ( - issuer, - securityIdentifier, - StringUtil.GUID(), - new Date(), - Order.BUY, - size, - timeInForce, - OrderFillWholeSettings.AllOrNone ( - fulfillTryLimit - ), - thresholdPrice - ); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return null; - } - /** * Construct an Instance of Sell Limit Order * @@ -351,96 +261,6 @@ public static final Limit Sell ( return null; } - /** - * Construct an Instance of Sell Fill-or-Kill Limit Order - * - * @param issuer Order Issuer - * @param securityIdentifier Security Identifier - * @param side Order Side - * @param size Order Size - * @param timeInForce Time-in-Force Settings - * @param thresholdPrice Threshold Price - * - * @return Instance of Sell Limit Order - */ - - public static final Limit SellKillOrFill ( - final OrderIssuer issuer, - final String securityIdentifier, - final String side, - final double size, - final TimeInForce timeInForce, - final double thresholdPrice) - { - try - { - return new Limit ( - issuer, - securityIdentifier, - StringUtil.GUID(), - new Date(), - Order.SELL, - size, - timeInForce, - OrderFillWholeSettings.FillOrKill(), - thresholdPrice - ); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of Sell All-or-None Limit Order - * - * @param issuer Order Issuer - * @param securityIdentifier Security Identifier - * @param side Order Side - * @param size Order Size - * @param timeInForce Time-in-Force Settings - * @param fulfillTryLimit Fulfill Try Limit - * @param thresholdPrice Threshold Price - * - * @return Instance of Sell All-or-None Limit Order - */ - - public static final Limit SellAllOrNone ( - final OrderIssuer issuer, - final String securityIdentifier, - final String side, - final double size, - final TimeInForce timeInForce, - final int fulfillTryLimit, - final double thresholdPrice) - { - try - { - return new Limit ( - issuer, - securityIdentifier, - StringUtil.GUID(), - new Date(), - Order.SELL, - size, - timeInForce, - OrderFillWholeSettings.AllOrNone ( - fulfillTryLimit - ), - thresholdPrice - ); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return null; - } - /** * Limit Order Constructor * diff --git a/src/main/java/org/drip/oms/order/LimitAON.java b/src/main/java/org/drip/oms/order/LimitAON.java new file mode 100644 index 000000000000..bc571ae54e89 --- /dev/null +++ b/src/main/java/org/drip/oms/order/LimitAON.java @@ -0,0 +1,277 @@ + +package org.drip.oms.order; + +import java.util.Date; + +import org.drip.oms.transaction.Order; +import org.drip.oms.transaction.OrderFillWholeSettings; +import org.drip.oms.transaction.OrderIssuer; +import org.drip.oms.transaction.TimeInForce; +import org.drip.service.common.StringUtil; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2023 Lakshmi Krishnamurthy + * + * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, + * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment + * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, + * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, + * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, + * graph builder/navigator, and computational support. + * + * https://lakshmidrip.github.io/DROP/ + * + * DROP is composed of three modules: + * + * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ + * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ + * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ + * + * DROP Product Core implements libraries for the following: + * - Fixed Income Analytics + * - Loan Analytics + * - Transaction Cost Analytics + * + * DROP Portfolio Core implements libraries for the following: + * - Asset Allocation Analytics + * - Asset Liability Management Analytics + * - Capital Estimation Analytics + * - Exposure Analytics + * - Margin Analytics + * - XVA Analytics + * + * DROP Computational Core implements libraries for the following: + * - Algorithm Support + * - Computation Support + * - Function Analysis + * - Graph Algorithm + * - Model Validation + * - Numerical Analysis + * - Numerical Optimizer + * - Spline Builder + * - Statistical Learning + * + * Documentation for DROP is Spread Over: + * + * - Main => https://lakshmidrip.github.io/DROP/ + * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki + * - GitHub => https://github.com/lakshmiDRIP/DROP + * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md + * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html + * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal + * - Release Versions => https://lakshmidrip.github.io/DROP/version.html + * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html + * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * LimitAON holds the Details of a Limit All-or-None Order. The References are: + * + *

+ * + * + *

+ * + * + * @author Lakshmi Krishnamurthy + */ + +public class LimitAON + extends Limit +{ + + /** + * Construct a Standard Instance of Buy All-or-None Limit Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param side Order Side + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param fulfillTryLimit Fulfill Try Limit + * @param thresholdPrice Threshold Price + * + * @return Instance of Buy All-or-None Limit Order + */ + + public static final LimitAON Standard ( + final OrderIssuer issuer, + final String securityIdentifier, + final String side, + final double size, + final TimeInForce timeInForce, + final int fulfillTryLimit, + final double thresholdPrice) + { + try + { + return new LimitAON ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + side, + size, + timeInForce, + fulfillTryLimit, + thresholdPrice + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Construct a Standard Instance of Buy All-Or-None Limit Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param fulfillTryLimit Fulfill Try Limit + * @param thresholdPrice Threshold Price + * + * @return Standard Instance of Buy All-Or-None Limit Order + */ + + public static final LimitAON StandardBuy ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final TimeInForce timeInForce, + final int fulfillTryLimit, + final double thresholdPrice) + { + return Standard ( + issuer, + securityIdentifier, + Order.BUY, + size, + timeInForce, + fulfillTryLimit, + thresholdPrice + ); + } + + /** + * Construct a Standard Instance of Sell All-Or-None Limit Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param fulfillTryLimit Fulfill Try Limit + * @param thresholdPrice Threshold Price + * + * @return Standard Instance of Sell All-Or-None Limit Order + */ + + public static final LimitAON StandardSell ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final TimeInForce timeInForce, + final int fulfillTryLimit, + final double thresholdPrice) + { + return Standard ( + issuer, + securityIdentifier, + Order.SELL, + size, + timeInForce, + fulfillTryLimit, + thresholdPrice + ); + } + + /** + * Limit AON Order Constructor + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param id Order ID + * @param creationTime Creation Time + * @param side Order Side + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param fulfillTryLimit Fulfill Try Limit + * @param thresholdPrice Threshold Price + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public LimitAON ( + final OrderIssuer issuer, + final String securityIdentifier, + final String id, + final Date creationTime, + final String side, + final double size, + final TimeInForce timeInForce, + final int fulfillTryLimit, + final double thresholdPrice) + throws Exception + { + super ( + issuer, + securityIdentifier, + id, + creationTime, + side, + size, + timeInForce, + OrderFillWholeSettings.AllOrNone ( + fulfillTryLimit + ), + thresholdPrice + ); + } +} diff --git a/src/main/java/org/drip/oms/order/LimitFOK.java b/src/main/java/org/drip/oms/order/LimitFOK.java new file mode 100644 index 000000000000..938dfa78b02d --- /dev/null +++ b/src/main/java/org/drip/oms/order/LimitFOK.java @@ -0,0 +1,264 @@ + +package org.drip.oms.order; + +import java.util.Date; + +import org.drip.oms.transaction.Order; +import org.drip.oms.transaction.OrderFillWholeSettings; +import org.drip.oms.transaction.OrderIssuer; +import org.drip.oms.transaction.TimeInForce; +import org.drip.service.common.StringUtil; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2023 Lakshmi Krishnamurthy + * + * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, + * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment + * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, + * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, + * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, + * graph builder/navigator, and computational support. + * + * https://lakshmidrip.github.io/DROP/ + * + * DROP is composed of three modules: + * + * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ + * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ + * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ + * + * DROP Product Core implements libraries for the following: + * - Fixed Income Analytics + * - Loan Analytics + * - Transaction Cost Analytics + * + * DROP Portfolio Core implements libraries for the following: + * - Asset Allocation Analytics + * - Asset Liability Management Analytics + * - Capital Estimation Analytics + * - Exposure Analytics + * - Margin Analytics + * - XVA Analytics + * + * DROP Computational Core implements libraries for the following: + * - Algorithm Support + * - Computation Support + * - Function Analysis + * - Graph Algorithm + * - Model Validation + * - Numerical Analysis + * - Numerical Optimizer + * - Spline Builder + * - Statistical Learning + * + * Documentation for DROP is Spread Over: + * + * - Main => https://lakshmidrip.github.io/DROP/ + * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki + * - GitHub => https://github.com/lakshmiDRIP/DROP + * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md + * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html + * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal + * - Release Versions => https://lakshmidrip.github.io/DROP/version.html + * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html + * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * LimitFOK holds the Details of a Limit Fill-or-Kill Order. The References are: + * + *

+ * + * + *

+ * + * + * @author Lakshmi Krishnamurthy + */ + +public class LimitFOK + extends Limit +{ + + /** + * Construct a Standard Instance of Buy FOK Limit Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param side Order Side + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param thresholdPrice Threshold Price + * + * @return Instance of Buy All-or-None Limit Order + */ + + public static final LimitFOK Standard ( + final OrderIssuer issuer, + final String securityIdentifier, + final String side, + final double size, + final TimeInForce timeInForce, + final double thresholdPrice) + { + try + { + return new LimitFOK ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + side, + size, + timeInForce, + thresholdPrice + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Construct a Standard Instance of Buy FOK Limit Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param thresholdPrice Threshold Price + * + * @return Standard Instance of Buy All-Or-None Limit Order + */ + + public static final LimitFOK StandardBuy ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final TimeInForce timeInForce, + final double thresholdPrice) + { + return Standard ( + issuer, + securityIdentifier, + Order.BUY, + size, + timeInForce, + thresholdPrice + ); + } + + /** + * Construct a Standard Instance of Sell FOK Limit Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param thresholdPrice Threshold Price + * + * @return Standard Instance of Sell All-Or-None Limit Order + */ + + public static final LimitFOK StandardSell ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final TimeInForce timeInForce, + final double thresholdPrice) + { + return Standard ( + issuer, + securityIdentifier, + Order.SELL, + size, + timeInForce, + thresholdPrice + ); + } + + /** + * Limit FOK Order Constructor + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param id Order ID + * @param creationTime Creation Time + * @param side Order Side + * @param size Order Size + * @param timeInForce Time-in-Force Settings + * @param thresholdPrice Threshold Price + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public LimitFOK ( + final OrderIssuer issuer, + final String securityIdentifier, + final String id, + final Date creationTime, + final String side, + final double size, + final TimeInForce timeInForce, + final double thresholdPrice) + throws Exception + { + super ( + issuer, + securityIdentifier, + id, + creationTime, + side, + size, + timeInForce, + OrderFillWholeSettings.FillOrKill(), + thresholdPrice + ); + } +} diff --git a/src/main/java/org/drip/oms/order/Market.java b/src/main/java/org/drip/oms/order/Market.java index 1da8d874d54c..b352db30bd62 100644 --- a/src/main/java/org/drip/oms/order/Market.java +++ b/src/main/java/org/drip/oms/order/Market.java @@ -195,44 +195,6 @@ public static final Market StandardBuy ( ); } - /** - * Construct an Instance of Buy DTC Market Order - * - * @param issuer Order Issuer - * @param securityIdentifier Security Identifier - * @param size Order Size - * @param fillWholeSettings Order Fill-Whole Settings - * - * @return Instance of Buy DTC Market Order - */ - - public static final Market BuyDTC ( - final OrderIssuer issuer, - final String securityIdentifier, - final double size, - final OrderFillWholeSettings fillWholeSettings) - { - try - { - return new Market ( - issuer, - securityIdentifier, - StringUtil.GUID(), - new Date(), - Order.BUY, - size, - TimeInForce.CreateDayTillCanceled(), - fillWholeSettings - ); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return null; - } - /** * Construct a Standard Instance of Sell Market Order * @@ -262,44 +224,6 @@ public static final Market StandardSell ( ); } - /** - * Construct an Instance of Sell DTC Market Order - * - * @param issuer Order Issuer - * @param securityIdentifier Security Identifier - * @param size Order Size - * @param fillWholeSettings Order Fill-Whole Settings - * - * @return Instance of Sell DTC Market Order - */ - - public static final Market SellDTC ( - final OrderIssuer issuer, - final String securityIdentifier, - final double size, - final OrderFillWholeSettings fillWholeSettings) - { - try - { - return new Market ( - issuer, - securityIdentifier, - StringUtil.GUID(), - new Date(), - Order.SELL, - size, - TimeInForce.CreateDayTillCanceled(), - fillWholeSettings - ); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return null; - } - /** * Market Order Constructor * diff --git a/src/main/java/org/drip/oms/order/MarketClose.java b/src/main/java/org/drip/oms/order/MarketClose.java new file mode 100644 index 000000000000..c398fc5715ad --- /dev/null +++ b/src/main/java/org/drip/oms/order/MarketClose.java @@ -0,0 +1,274 @@ + +package org.drip.oms.order; + +import java.util.Date; + +import org.drip.oms.transaction.Order; +import org.drip.oms.transaction.OrderFillWholeSettings; +import org.drip.oms.transaction.OrderIssuer; +import org.drip.oms.transaction.TimeInForce; +import org.drip.service.common.StringUtil; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2023 Lakshmi Krishnamurthy + * + * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, + * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment + * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, + * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, + * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, + * graph builder/navigator, and computational support. + * + * https://lakshmidrip.github.io/DROP/ + * + * DROP is composed of three modules: + * + * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ + * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ + * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ + * + * DROP Product Core implements libraries for the following: + * - Fixed Income Analytics + * - Loan Analytics + * - Transaction Cost Analytics + * + * DROP Portfolio Core implements libraries for the following: + * - Asset Allocation Analytics + * - Asset Liability Management Analytics + * - Capital Estimation Analytics + * - Exposure Analytics + * - Margin Analytics + * - XVA Analytics + * + * DROP Computational Core implements libraries for the following: + * - Algorithm Support + * - Computation Support + * - Function Analysis + * - Graph Algorithm + * - Model Validation + * - Numerical Analysis + * - Numerical Optimizer + * - Spline Builder + * - Statistical Learning + * + * Documentation for DROP is Spread Over: + * + * - Main => https://lakshmidrip.github.io/DROP/ + * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki + * - GitHub => https://github.com/lakshmiDRIP/DROP + * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md + * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html + * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal + * - Release Versions => https://lakshmidrip.github.io/DROP/version.html + * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html + * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * MarketClose holds the Details of a Market Close Market Order. The References are: + * + *

+ * + * + *

+ * + * + * @author Lakshmi Krishnamurthy + */ + +public class MarketClose + extends Market +{ + + /** + * Create a Standard Instance of Market Close + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param side Order Side + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Market Close + */ + + public static final MarketClose Standard ( + final OrderIssuer issuer, + final String securityIdentifier, + final String side, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketClose ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + side, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Buy Market Close + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Buy Market Close + */ + + public static final MarketClose StandardBuy ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketClose ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.BUY, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Sell Market Close + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Sell Market Close + */ + + public static final MarketClose StandardSell ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketClose ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.SELL, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Market Close Order Constructor + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param id Order ID + * @param creationTime Creation Time + * @param side Order Side + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public MarketClose ( + final OrderIssuer issuer, + final String securityIdentifier, + final String id, + final Date creationTime, + final String side, + final double size, + final OrderFillWholeSettings fillWholeSettings) + throws Exception + { + super ( + issuer, + securityIdentifier, + id, + creationTime, + side, + size, + TimeInForce.CreateMarketClose(), + fillWholeSettings + ); + } +} diff --git a/src/main/java/org/drip/oms/order/MarketDTC.java b/src/main/java/org/drip/oms/order/MarketDTC.java new file mode 100644 index 000000000000..323d9152c018 --- /dev/null +++ b/src/main/java/org/drip/oms/order/MarketDTC.java @@ -0,0 +1,274 @@ + +package org.drip.oms.order; + +import java.util.Date; + +import org.drip.oms.transaction.Order; +import org.drip.oms.transaction.OrderFillWholeSettings; +import org.drip.oms.transaction.OrderIssuer; +import org.drip.oms.transaction.TimeInForce; +import org.drip.service.common.StringUtil; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2023 Lakshmi Krishnamurthy + * + * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, + * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment + * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, + * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, + * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, + * graph builder/navigator, and computational support. + * + * https://lakshmidrip.github.io/DROP/ + * + * DROP is composed of three modules: + * + * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ + * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ + * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ + * + * DROP Product Core implements libraries for the following: + * - Fixed Income Analytics + * - Loan Analytics + * - Transaction Cost Analytics + * + * DROP Portfolio Core implements libraries for the following: + * - Asset Allocation Analytics + * - Asset Liability Management Analytics + * - Capital Estimation Analytics + * - Exposure Analytics + * - Margin Analytics + * - XVA Analytics + * + * DROP Computational Core implements libraries for the following: + * - Algorithm Support + * - Computation Support + * - Function Analysis + * - Graph Algorithm + * - Model Validation + * - Numerical Analysis + * - Numerical Optimizer + * - Spline Builder + * - Statistical Learning + * + * Documentation for DROP is Spread Over: + * + * - Main => https://lakshmidrip.github.io/DROP/ + * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki + * - GitHub => https://github.com/lakshmiDRIP/DROP + * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md + * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html + * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal + * - Release Versions => https://lakshmidrip.github.io/DROP/version.html + * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html + * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * MarketDAY holds the Details of a Market DAY Order. The References are: + * + *

+ * + * + *

+ * + * + * @author Lakshmi Krishnamurthy + */ + +public class MarketDTC + extends Market +{ + + /** + * Create a Standard Instance of Market DTC + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param side Order Side + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Market DTC + */ + + public static final MarketDTC Standard ( + final OrderIssuer issuer, + final String securityIdentifier, + final String side, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketDTC ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + side, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Buy Market DTC + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Buy Market DTC + */ + + public static final MarketDTC StandardBuy ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketDTC ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.BUY, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Sell Market DTC + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Sell Market DTC + */ + + public static final MarketDTC StandardSell ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketDTC ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.SELL, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Market DTC Order Constructor + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param id Order ID + * @param creationTime Creation Time + * @param side Order Side + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public MarketDTC ( + final OrderIssuer issuer, + final String securityIdentifier, + final String id, + final Date creationTime, + final String side, + final double size, + final OrderFillWholeSettings fillWholeSettings) + throws Exception + { + super ( + issuer, + securityIdentifier, + id, + creationTime, + side, + size, + TimeInForce.CreateDayTillCanceled(), + fillWholeSettings + ); + } +} diff --git a/src/main/java/org/drip/oms/order/MarketGTC.java b/src/main/java/org/drip/oms/order/MarketGTC.java new file mode 100644 index 000000000000..d681f29f1da5 --- /dev/null +++ b/src/main/java/org/drip/oms/order/MarketGTC.java @@ -0,0 +1,287 @@ + +package org.drip.oms.order; + +import java.util.Date; + +import org.drip.oms.transaction.Order; +import org.drip.oms.transaction.OrderFillWholeSettings; +import org.drip.oms.transaction.OrderIssuer; +import org.drip.oms.transaction.TimeInForce; +import org.drip.service.common.StringUtil; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2023 Lakshmi Krishnamurthy + * + * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, + * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment + * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, + * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, + * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, + * graph builder/navigator, and computational support. + * + * https://lakshmidrip.github.io/DROP/ + * + * DROP is composed of three modules: + * + * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ + * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ + * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ + * + * DROP Product Core implements libraries for the following: + * - Fixed Income Analytics + * - Loan Analytics + * - Transaction Cost Analytics + * + * DROP Portfolio Core implements libraries for the following: + * - Asset Allocation Analytics + * - Asset Liability Management Analytics + * - Capital Estimation Analytics + * - Exposure Analytics + * - Margin Analytics + * - XVA Analytics + * + * DROP Computational Core implements libraries for the following: + * - Algorithm Support + * - Computation Support + * - Function Analysis + * - Graph Algorithm + * - Model Validation + * - Numerical Analysis + * - Numerical Optimizer + * - Spline Builder + * - Statistical Learning + * + * Documentation for DROP is Spread Over: + * + * - Main => https://lakshmidrip.github.io/DROP/ + * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki + * - GitHub => https://github.com/lakshmiDRIP/DROP + * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md + * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html + * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal + * - Release Versions => https://lakshmidrip.github.io/DROP/version.html + * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html + * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * MarketGTC holds the Details of a Market GTC Order. The References are: + * + *

+ * + * + *

+ * + * + * @author Lakshmi Krishnamurthy + */ + +public class MarketGTC + extends Market +{ + + /** + * Create a Standard Instance of Market GTC Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param side Order Side + * @param size Order Size + * @param durationDays Order Duration Tenor in Days + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Market GTC Order + */ + + public static final MarketGTC Standard ( + final OrderIssuer issuer, + final String securityIdentifier, + final String side, + final double size, + final int durationDays, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketGTC ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + side, + size, + durationDays, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Buy Market GTC Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param durationDays Order Duration Tenor in Days + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Buy Market GTC Order + */ + + public static final MarketGTC StandardBuy ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final int durationDays, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketGTC ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.BUY, + size, + durationDays, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Sell Market GTC Order + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param durationDays Order Duration Tenor in Days + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Sell Market GTC Order + */ + + public static final MarketGTC StandardSell ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final int durationDays, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketGTC ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.SELL, + size, + durationDays, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Market GTC Order Constructor + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param id Order ID + * @param creationTime Creation Time + * @param side Order Side + * @param size Order Size + * @param durationDays Order Duration Tenor in Days + * @param fillWholeSettings Order Fill-Whole Settings + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public MarketGTC ( + final OrderIssuer issuer, + final String securityIdentifier, + final String id, + final Date creationTime, + final String side, + final double size, + final int durationDays, + final OrderFillWholeSettings fillWholeSettings) + throws Exception + { + super ( + issuer, + securityIdentifier, + id, + creationTime, + side, + size, + TimeInForce.CreateGoodTillCanceled ( + durationDays + ), + fillWholeSettings + ); + } +} diff --git a/src/main/java/org/drip/oms/order/MarketOpen.java b/src/main/java/org/drip/oms/order/MarketOpen.java new file mode 100644 index 000000000000..04dda820fa92 --- /dev/null +++ b/src/main/java/org/drip/oms/order/MarketOpen.java @@ -0,0 +1,273 @@ + +package org.drip.oms.order; + +import java.util.Date; + +import org.drip.oms.transaction.Order; +import org.drip.oms.transaction.OrderFillWholeSettings; +import org.drip.oms.transaction.OrderIssuer; +import org.drip.oms.transaction.TimeInForce; +import org.drip.service.common.StringUtil; + +/* + * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + */ + +/*! + * Copyright (C) 2023 Lakshmi Krishnamurthy + * + * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, + * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment + * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, + * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, + * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, + * graph builder/navigator, and computational support. + * + * https://lakshmidrip.github.io/DROP/ + * + * DROP is composed of three modules: + * + * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ + * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ + * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ + * + * DROP Product Core implements libraries for the following: + * - Fixed Income Analytics + * - Loan Analytics + * - Transaction Cost Analytics + * + * DROP Portfolio Core implements libraries for the following: + * - Asset Allocation Analytics + * - Asset Liability Management Analytics + * - Capital Estimation Analytics + * - Exposure Analytics + * - Margin Analytics + * - XVA Analytics + * + * DROP Computational Core implements libraries for the following: + * - Algorithm Support + * - Computation Support + * - Function Analysis + * - Graph Algorithm + * - Model Validation + * - Numerical Analysis + * - Numerical Optimizer + * - Spline Builder + * - Statistical Learning + * + * Documentation for DROP is Spread Over: + * + * - Main => https://lakshmidrip.github.io/DROP/ + * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki + * - GitHub => https://github.com/lakshmiDRIP/DROP + * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md + * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html + * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal + * - Release Versions => https://lakshmidrip.github.io/DROP/version.html + * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html + * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * MarketOpen holds the Details of a Market Open Market Order. The References are: + * + *

+ * + * + *

+ * + * + * @author Lakshmi Krishnamurthy + */ + +public class MarketOpen extends Market +{ + + /** + * Create a Standard Instance of Market Open + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param side Order Side + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Market Open + */ + + public static final MarketOpen Standard ( + final OrderIssuer issuer, + final String securityIdentifier, + final String side, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketOpen ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + side, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Buy Market Open + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Buy Market Open + */ + + public static final MarketOpen StandardBuy ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketOpen ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.BUY, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Create a Standard Instance of Sell Market Open + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @return Standard Instance of Sell Market Open + */ + + public static final MarketOpen StandardSell ( + final OrderIssuer issuer, + final String securityIdentifier, + final double size, + final OrderFillWholeSettings fillWholeSettings) + { + try + { + return new MarketOpen ( + issuer, + securityIdentifier, + StringUtil.GUID(), + new Date(), + Order.SELL, + size, + fillWholeSettings + ); + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } + + /** + * Market Open Order Constructor + * + * @param issuer Order Issuer + * @param securityIdentifier Security Identifier + * @param id Order ID + * @param creationTime Creation Time + * @param side Order Side + * @param size Order Size + * @param fillWholeSettings Order Fill-Whole Settings + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public MarketOpen ( + final OrderIssuer issuer, + final String securityIdentifier, + final String id, + final Date creationTime, + final String side, + final double size, + final OrderFillWholeSettings fillWholeSettings) + throws Exception + { + super ( + issuer, + securityIdentifier, + id, + creationTime, + side, + size, + TimeInForce.CreateMarketOpen(), + fillWholeSettings + ); + } +}