Options Order Syntax

Hello, I am an extremely new programmer, and have been trying to figure out the Options Syntax for placing an options order using Collective. I have tried time and time again to get the order syntax for options to play out correctly. I keep getting errors like this below.

Questions I have are:

  1. Does collective2 use the OPRA options chain for their offering?

  2. When calling the options symbol to place an order in Collective, do you use the full contractID or just the company symbol.

    payload = {
    “Order”: {
    “StrategyId”: int(strategy_id),
    “OrderType”: 2, # Limit order
    “Side”: 1, # Buy to Open (BTO)
    “OrderQuantity”: 1.0, # Quantity set to 1 for simplicity
    “Limit”: limit_price,
    “TIF”: 1, # Good Till Cancelled (GTC)
    “ExchangeSymbol”: {
    “Symbol”: option_symbol,
    “Currency”: “USD”,
    “SecurityExchange”: “OPRA”,
    “SecurityType”: “OPT”,
    “MaturityMonthYear”: expiration_date.replace(‘-’, ‘’)[:6], # Format as YYYYMM
    “PutOrCall”: option_type, # 0 for Put, 1 for Call
    “StrikePrice”: strike_price # Include the StrikePrice here
    }
    }
    }

    headers = {
    “Content-Type”: “application/json”,
    “Authorization”: f"Bearer {API_TOKEN}"
    }

Error Message:

{
“Order”: {
“StrategyId”: Removed,
“OrderType”: 2,
“Side”: 1,
“OrderQuantity”: 1.0,
“Limit”: 0.7875,
“TIF”: 1,
“ExchangeSymbol”: {
“Symbol”: “GOOGL240705P00182500”,
“Currency”: “USD”,
“SecurityExchange”: “OPRA”,
“SecurityType”: “OPT”,
“MaturityMonthYear”: “202407”,
“PutOrCall”: 0,
“StrikePrice”: 182.5
}
}
}
ERROR:root:Error placing order: {“ResponseStatus”:{“ErrorCode”:“400”,“Message”:“BadRequest”,“Errors”:[{“ErrorCode”:“1121”,“FieldName”:“Symbol”,“Message”:“Invalid symbol”}]}}

Any help here is appreciated. Thank you in advance!

Hi, SFAnalytics -

I am sorry this is not really well-documented. Our options symbology is a little weird. You can find it here:

Let me know if you have questions.

This is fantastic. Thank you for this link and the information. Really quickly, the application of this would still work vis API corrrect? I am not using WebTrader and want to make sure it will integrate correctly.

Yes, you can use these symbols via the API.

1 Like