> For the complete documentation index, see [llms.txt](https://quantinfra.gitbook.io/quantinfra-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quantinfra.gitbook.io/quantinfra-docs/static-data/contracts.md).

# Contracts

## Contract templates

Part of the information about contracts is shared among them, for instance, all futures contracts of a given series have the same properties. Many stocks traded on one exchange are also similar. To reduce the configuration burden, contract templates are used.

<table><thead><tr><th width="218.0625">Property</th><th>Description</th></tr></thead><tbody><tr><td>TemplateId</td><td></td></tr><tr><td>Name</td><td></td></tr><tr><td>SecurityType</td><td><ul><li>Stock</li><li>Futures</li><li>CFD — use also for crypto perpetual contracts</li><li>FX — spot FX pairs</li><li>Synthetic</li></ul></td></tr><tr><td>PlCalculatorType</td><td><p>How to calculate position value and PnL for the contract</p><ul><li>Default</li><li>DefaultFutures — uses tick size and tick value</li><li>InverseFutures — use for crypto inverse ("coin-margined") contracts, for which the size is defined in the quote currency, and PnL — in base currency</li></ul></td></tr><tr><td>Asset</td><td>Underlying asset. May be overridden by the concrete contract.<br><br>Currently it is not used, but reserved for future use to be able to aggregate positions with the same underlying to monitor risk.</td></tr><tr><td>MinSize</td><td>Minimum order size</td></tr><tr><td>MinSizeMoney</td><td>Minimum order size in the settlement currency</td></tr><tr><td>MaxSize</td><td></td></tr><tr><td>MaxSizeMoney</td><td>Maximum order size in the settlement currency</td></tr><tr><td>SizeIncrement</td><td>Step by which the size may be incremented</td></tr><tr><td>TickSize</td><td></td></tr><tr><td>TickValue</td><td></td></tr><tr><td>PriceQuotation</td><td>For commodity futures quoted in cents, use 100</td></tr><tr><td>SettlementCurrency</td><td></td></tr><tr><td>BaseCurrency</td><td>Only for FX pairs</td></tr><tr><td>QuoteCurrency</td><td>Only for FX pairs. Normally, equals the settlement currency.</td></tr><tr><td>DefaultDatafeed</td><td>If several price streams are configured for a contract, defines which one to use to define the current contract price</td></tr><tr><td>Commissions</td><td>List of commissions applied to the contract</td></tr><tr><td>TradingSessions</td><td>List of trading sessions</td></tr><tr><td>Exchange</td><td></td></tr><tr><td>Broker</td><td></td></tr><tr><td>DaysInYear</td><td>Used when calculating Sharpe ratio for single-contract strategies</td></tr><tr><td>Description</td><td></td></tr></tbody></table>

A particular contract adds the following:

<table><thead><tr><th width="351.4921875">Property</th><th>Description</th></tr></thead><tbody><tr><td>ContractId</td><td>Unique ID used inside the platform</td></tr><tr><td>Ticker</td><td>Unique name of the contract inside the platform</td></tr><tr><td>FirstTradingDate</td><td></td></tr><tr><td>ExpirationDate</td><td></td></tr><tr><td>ExternalContractId</td><td></td></tr><tr><td>Asset</td><td>Use to override the template's asset. <br><br>Normally, stocks traded on one exchange will share one template (with no asset defined), and each stock will define its own underlying asset. For futures, there will be one template per futures series, and the asset will be defined for that template.</td></tr><tr><td>Description</td><td></td></tr><tr><td>SyntheticContractType</td><td><ul><li>Multiplicative: used for FX conversions</li><li>Index: additive weighted index</li><li>Rolling: used for futures series</li></ul></td></tr><tr><td>SynthRequiresBarRecalculationAtRollover</td><td>Normally set to true for rolling synths. Upon roll, the historical bars will be re-initialized using the price of the new contract.</td></tr><tr><td>SyntheticContractCompositionHistory</td><td></td></tr></tbody></table>

## Security types

Security type defines how trades affect the balance of the account:

* For Stock, every trade opens (or closes) a position in the contract, and changes the balance in the settlement currency
* For Futures and CFD, trades change positions in the contract. Trades opening (or increasing the position) do not affect the balance; closing trades add the realized PnL to the balance in the settlement currency
* For FX, trades immediately change balances in both base and settlement currencies

## Synthetic contracts

3 types of synthetic contracts are supported:

* Multiplicative: the price is calculated as the product of the components, taken in the power of the component's weight
* Index: initial price must be set (defaults to the sum of initial prices of components multiplied by the absolute values of their weights). The price at any moment of time is defined as the initial price plus the sum of weighted changes of prices of individual components
* Rolling: consists of several sequential contracts. The price at the given moment equals the price of the active contract

For all types of synthetic contracts, there may be different compositions with defined validity periods.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://quantinfra.gitbook.io/quantinfra-docs/static-data/contracts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
