Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order samples #27

Open
samjtro opened this issue May 26, 2024 · 2 comments
Open

order samples #27

samjtro opened this issue May 26, 2024 · 2 comments
Assignees

Comments

@samjtro
Copy link
Member

samjtro commented May 26, 2024

Order Samples:

Buy Market: Stock
Buy 15 shares of XYZ at the Market good for the Day.

{
"orderType": "MARKET",
"session": "NORMAL",
"duration": "DAY",
"orderStrategyType": "SINGLE",
"orderLegCollection": [
	{
	"instruction": "BUY",
	"quantity": 15,
	"instrument": {
		"symbol": "XYZ",
		"assetType": "EQUITY"
}
}
]
}

Buy Limit: Single Option
Buy to open 10 contracts of the XYZ March 15, 2024 $50 CALL at a Limit of $6.45 good for the Day.

{
"complexOrderStrategyType": "NONE",
"orderType": "LIMIT",
"session": "NORMAL",
"price": "6.45",
"duration": "DAY",
"orderStrategyType": "SINGLE",
"orderLegCollection": [
	{
	"instruction": "BUY_TO_OPEN",
	"quantity": 10,
	"instrument": {
		"symbol": "XYZ 240315C00500000",
		"assetType": "OPTION"
}
}
]
}

Buy Limit: Vertical Call Spread
Buy to open 2 contracts of the XYZ March 15, 2024 $43 Put and Sell to open 1 contract of the XYZ March 15, 2024 $45 Put at the Market good for the Day.

{
"orderStrategyType": "SINGLE",
"orderType": "MARKET",
"orderLegCollection": [
	{
	"instrument": {
	"assetType": "OPTION",
	"symbol": "XYZ 240315P00043000"
},
	"instruction": "SELL_TO_OPEN",
	"quantity": 1
},
{
	"instrument": {
	"assetType": "OPTION",
	"symbol": "XYZ 240315P00045000"
},
	"instruction": "BUY_TO_OPEN",
	"quantity": 2
}
],
"complexOrderStrategyType": "CUSTOM",
"duration": "DAY",
"session": "NORMAL"
}

Conditional Order: One Triggers Another
Buy 10 shares of XYZ at a Limit price of $34.97 good for the Day. If filled, immediately submit an order to Sell 10 shares of XYZ with a Limit price of $42.03 good for the Day. Also known as 1st Trigger Sequence.

{
"orderType": "LIMIT",
"session": "NORMAL",
"price": "34.97",
"duration": "DAY",
"orderStrategyType": "TRIGGER",
"orderLegCollection": [
	{
	"instruction": "BUY",
	"quantity": 10,
	"instrument": {
		"symbol": "XYZ",
		"assetType": "EQUITY"
}
}
],
"childOrderStrategies": [
	{
	"orderType": "LIMIT",
	"session": "NORMAL",
	"price": "42.03",
	"duration": "DAY",
	"orderStrategyType": "SINGLE",
	"orderLegCollection": [
	{
		"instruction": "SELL",
		"quantity": 10,
		"instrument": {
			"symbol": "XYZ",
			"assetType": "EQUITY"
}
}
]
}
]
}

Conditional Order: One Cancels Another
Sell 2 shares of XYZ at a Limit price of $45.97 and Sell 2 shares of XYZ with a Stop Limit order where the stop price is $37.03 and limit is $37.00. Both orders are sent at the same time. If one order fills, the other order is immediately cancelled. Both orders are good for the Day. Also known as an OCO order.

{
"orderStrategyType": "OCO",
"childOrderStrategies": [
	{
	"orderType": "LIMIT",
	"session": "NORMAL",
	"price": "45.97",
	"duration": "DAY",
	"orderStrategyType": "SINGLE",
	"orderLegCollection": [
	{
		"instruction": "SELL",
		"quantity": 2,
		"instrument": {
		"symbol": "XYZ",
		"assetType": "EQUITY"
}
}
]
},
	{
	"orderType": "STOP_LIMIT",
	"session": "NORMAL",
	"price": "37.00",
	"stopPrice": "37.03",
	"duration": "DAY",
	"orderStrategyType": "SINGLE",
	"orderLegCollection": [
	{
	"instruction": "SELL",
	"quantity": 2,
	"instrument": {
		"symbol": "XYZ",
		"assetType": "EQUITY"
}
}
]
}
]
}

Conditional Order: One Triggers A One Cancels Another
Buy 5 shares of XYZ at a Limit price of $14.97 good for the Day. Once filled, 2 sell orders are immediately sent: Sell 5 shares of XYZ at a Limit price of $15.27 and Sell 5 shares of XYZ with a Stop order where the stop price is $11.27. If one of the sell orders fill, the other order is immediately cancelled. Both Sell orders are Good till Cancel. Also known as a 1st Trigger OCO order.

{
"orderStrategyType": "TRIGGER",
"session": "NORMAL",
"duration": "DAY",
"orderType": "LIMIT",
"price": 14.97,
"orderLegCollection": [
	{
	"instruction": "BUY",
	"quantity": 5,
	"instrument": {
		"assetType": "EQUITY",
		"symbol": "XYZ"
}
}
],
"childOrderStrategies": [
	{
	"orderStrategyType": "OCO",
	"childOrderStrategies": [
		{
		"orderStrategyType": "SINGLE",
		"session": "NORMAL",
		"duration": "GOOD_TILL_CANCEL",
		"orderType": "LIMIT",
		"price": 15.27,
		"orderLegCollection": [
			{
			"instruction": "SELL",
			"quantity": 5,
			"instrument": {
				"assetType": "EQUITY",
				"symbol": "XYZ"
}
}
]
},
{
		"orderStrategyType": "SINGLE",
		"session": "NORMAL",
		"duration": "GOOD_TILL_CANCEL",
		"orderType": "STOP",
		"stopPrice": 11.27,
		"orderLegCollection": [
		{
			"instruction": "SELL",
			"quantity": 5,
			"instrument": {
				"assetType": "EQUITY",
				"symbol": "XYZ"
}
}
]
}
]
}
]
}

Sell Trailing Stop: Stock
Sell 10 shares of XYZ with a Trailing Stop where the trail is a -$10 offset from the time the order is submitted. As the stock price goes up, the -$10 trailing offset will follow. If stock XYZ goes from $110 to $130, your trail will automatically be adjusted to $120. If XYZ falls to $120 or below, a Market order is submitted. This order is good for the Day.

{
"complexOrderStrategyType": "NONE",
"orderType": "TRAILING_STOP",
"session": "NORMAL",
"stopPriceLinkBasis": "BID",
"stopPriceLinkType": "VALUE",
"stopPriceOffset": 10,
"duration": "DAY",
"orderStrategyType": "SINGLE",
"orderLegCollection": [
	{
	"instruction": "SELL",
	"quantity": 10,
	"instrument": {
		"symbol": "XYZ",
		"assetType": "EQUITY"
}
}
]
}
@samjtro
Copy link
Member Author

samjtro commented May 26, 2024

Started accounts and trading implementation: f977000

@samjtro samjtro added the enhancement New feature or request label May 26, 2024
@samjtro samjtro self-assigned this May 26, 2024
@samjtro
Copy link
Member Author

samjtro commented May 30, 2024

All Order params:

{
  "session": "NORMAL",
  "duration": "DAY",
  "orderType": "MARKET",
  "cancelTime": "2024-05-30T16:46:05.046Z",
  "complexOrderStrategyType": "NONE",
  "quantity": 0,
  "filledQuantity": 0,
  "remainingQuantity": 0,
  "destinationLinkName": "string",
  "releaseTime": "2024-05-30T16:46:05.046Z",
  "stopPrice": 0,
  "stopPriceLinkBasis": "MANUAL",
  "stopPriceLinkType": "VALUE",
  "stopPriceOffset": 0,
  "stopType": "STANDARD",
  "priceLinkBasis": "MANUAL",
  "priceLinkType": "VALUE",
  "price": 0,
  "taxLotMethod": "FIFO",
  "orderLegCollection": [
    {
      "orderLegType": "EQUITY",
      "legId": 0,
      "instrument": {
        "cusip": "string",
        "symbol": "string",
        "description": "string",
        "instrumentId": 0,
        "netChange": 0,
        "type": "SWEEP_VEHICLE"
      },
      "instruction": "BUY",
      "positionEffect": "OPENING",
      "quantity": 0,
      "quantityType": "ALL_SHARES",
      "divCapGains": "REINVEST",
      "toSymbol": "string"
    }
  ],
  "activationPrice": 0,
  "specialInstruction": "ALL_OR_NONE",
  "orderStrategyType": "SINGLE",
  "orderId": 0,
  "cancelable": false,
  "editable": false,
  "status": "AWAITING_PARENT_ORDER",
  "enteredTime": "2024-05-30T16:46:05.046Z",
  "closeTime": "2024-05-30T16:46:05.046Z",
  "accountNumber": 0,
  "orderActivityCollection": [
    {
      "activityType": "EXECUTION",
      "executionType": "FILL",
      "quantity": 0,
      "orderRemainingQuantity": 0,
      "executionLegs": [
        {
          "legId": 0,
          "price": 0,
          "quantity": 0,
          "mismarkedQuantity": 0,
          "instrumentId": 0,
          "time": "2024-05-30T16:46:05.046Z"
        }
      ]
    }
  ],
  "replacingOrderCollection": [
    "string"
  ],
  "childOrderStrategies": [
    "string"
  ],
  "statusDescription": "string"
}

@samjtro samjtro added the todo label Jun 6, 2024
@samjtro samjtro changed the title Accounts and Trading API order samples Jun 8, 2024
@samjtro samjtro removed todo enhancement New feature or request labels Jun 25, 2024
@samjtro samjtro removed this from the v1.0.0 - Schwab Data+Trading Hook milestone Jun 25, 2024
@samjtro samjtro added this to the v0.9.0 - Wrap Up milestone Jul 29, 2024
@samjtro samjtro pinned this issue Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant