Contract Variables

Original (English)

Variables for futures and options

The following variables are valid after loading a contract chain and selecting a contract.

ContractType

ContractExpiry

Type and expiration date (YYYYMMDD format) of the selected contract, or 0 when no valid contract was selected.

Type:

int, read/only

ContractAsk

ContractBid

ContractUnl

ContractStrike

ContractVol

ContractVal

Current ask, bid, underlying, and strike price, and trade volume or open interest of the selected contract. 0 when no contract chain was loaded, or no valid contract was selected, or when the parameter is not or not yet available in the selected contract. In historical data, ContractAsk or ContractBid can be 0 with illiquid or worthless contracts; such contracts should not be traded. ContractVal includes the multiplier retrieved from the broker API in [Trade] mode. For retrieving the ask and bid prices, the underlying, and the volume in [Trade] mode, contractPrice must be called before.

Type:

var, read/only

ThisContract

The currently selected contract by the last contract call. In [Trade] mode, (string)ThisContract - the first element of the CONTRACT struct - contains the trading class retrieved from the broker API.

Contracts

The current option or future chain loaded by the last contractUpdate call. A list of CONTRACT structs of the size NumContracts, sorted first by ascending expiration, second by ascending strike. Can be used for enumerating all contracts.

Type:

CONTRACT*

NumContracts

The number of contracts in the chain, up to 20000, or 0 when no chain was loaded.

ContractRow

The row number of the selected contract in the historical .t8 dataset that holds the contract chain history of the current asset in Test and Train mode; the row number of the selected contract in the options chain (Contracts pointer) in Trade mode. Can be used to retrieve further data belonging to the contract from additional datasets.

ContractHandle

The handle of the historical .t8 dataset that holds the contract chain history of the current asset in Test and Train mode. Can be set to a specific dataset before calling contractUpdate; otherwise it is automatically set.

Type:

int, asset specific.

 

The following variables are used to set up asset specific contract parameters:

Multiplier

Number of underlying units per option / future contract, for calculating the trade volume, selecting a contract, and filtering the options chain (default 0 = download all options). Asset specific; set it after selecting the asset and before buying contracts. If at 0, contractUpdate will in [Trade] mode automatically set this variable to the multiplier of the first contract if available via broker API.

Centage

Combination of flags that determine which option or futures prices in historical data or live data are given in cents instead of dollars (default 0 = all prices in dollars). Prices are then automatically converted to dollars when loading history or retrieving data from the broker API. Centage flags can be combined by adding them up. Asset specific; to be set after selecting the asset and before buying contracts.

1 -  strike in cents, in live contract data
2 -  strike in cents, in contract history
4 -  underlying in cents, in live contract data
8 -  underlying in cents, in contract history
16 - ask/bid in cents, in live contract data
32 - ask/bid in cents, in contract history
64 - underlying prices and spreads in cents, in live and historical price data (similar to HedgeRatio = 0.01).

Example: Centage = 59 (= 32+16+8+2+1) for ask/bid always in cents, underlying history in cents but live in dollars, and strike always in cents.

Type:

int, asset specific

ExpiryTime

The hour in HHMM format at which contracts expire; default 1200 (UTC). Used for contractDays. Added to the TradeExitDate variable when a trade is opened. At that time on its expiration day, the trade will be removed from the open trade list, and its profit or loss will be booked to the account. Set this to a higher value for checking contract expiration with the contractCheck function in live trading. Note that some exchanges have restrictions to trading or exercising contracts at their expiration day.

Type:

int, global for all assets

Exchange

The exchange for the contracts in live trading. Set the exchange symbol manually through this variable when the exchange is required by the broker. The list of valid exchange symbols can be obtained from the broker website.

Type:

string, asset specific.


 

Remarks:

  • Contract variables are only valid when a contract chain was not loaded (see contractUpdate()).
  • Multiplier and Centage (if required) must be set up for the current asset before loading contract chains.
     

Examples: see Options and Futures

See also:

enterLong/Short, Contract, Combo

 

► latest version online

Übersetzung (Deutsch)

Variablen für Futures und Optionen

Die folgenden Variablen sind gültig, nachdem eine Vertragskette geladen und ein Vertrag ausgewählt wurde.

ContractType

ContractExpiry

Typ und Verfallsdatum (Format JJJJMMTT) des ausgewählten Vertrags oder 0, wenn kein gültiger Vertrag ausgewählt wurde.

Typ:

int, nur lesbar

ContractAsk

ContractBid

ContractUnl

ContractStrike

ContractVol

ContractVal

Aktueller Ask-, Bid-, Underlying- und Strike-Preis sowie Handelsvolumen oder Open Interest des ausgewählten Vertrags. 0, wenn keine Vertragskette geladen wurde, kein gültiger Vertrag ausgewählt wurde oder der Parameter nicht oder noch nicht im ausgewählten Vertrag verfügbar ist. In historischen Daten können ContractAsk oder ContractBid bei illiquiden oder wertlosen Verträgen 0 sein; solche Verträge sollten nicht gehandelt werden. ContractVal umfasst den Multiplikator, der über die Broker-API im [Trade]-Modus abgerufen wird. Um die Ask- und Bid-Preise, das Underlying und das Volumen im [Trade]-Modus abzurufen, muss vorher contractPrice aufgerufen werden.

Typ:

var, nur lesbar

ThisContract

Der aktuell ausgewählte Vertrag durch den letzten contract-Aufruf. Im [Trade]-Modus, (string)ThisContract - das erste Element der CONTRACT-Struktur - enthält die Handelsklasse, die über die Broker-API abgerufen wurde.

Contracts

Die aktuelle Options- oder Future-Kette, die durch den letzten contractUpdate-Aufruf geladen wurde. Eine Liste von CONTRACT-Strukturen der Größe NumContracts, sortiert zuerst nach aufsteigendem Verfallsdatum, dann nach aufsteigendem Strike. Kann verwendet werden, um alle Verträge aufzulisten.

Typ:

CONTRACT*

NumContracts

Die Anzahl der Verträge in der Kette, bis zu 20000, oder 0, wenn keine Kette geladen wurde.

ContractRow

Die Zeilennummer des ausgewählten Vertrags im historischen .t8 Datensatz, der die Vertragskettengeschichte des aktuellen Assets im Test- und Trainingsmodus enthält; die Zeilennummer des ausgewählten Vertrags in der Optionskette (Contracts-Pointer) im Handelsmodus. Kann verwendet werden, um weitere Daten, die zum Vertrag gehören, aus zusätzlichen Datensätzen abzurufen.

ContractHandle

Der Handle des historischen .t8 Datensatzes, der die Vertragskettengeschichte des aktuellen Assets im Test- und Trainingsmodus enthält. Kann vor dem Aufruf von contractUpdate auf einen spezifischen Datensatz gesetzt werden; andernfalls wird er automatisch gesetzt.

Typ:

int, asset-spezifisch.

 

Die folgenden Variablen werden verwendet, um asset-spezifische Vertragsparameter einzurichten:

Multiplier

Anzahl der Underlying-Einheiten pro Options- / Future-Vertrag, zur Berechnung des Handelsvolumens, zur Auswahl eines Vertrags und zum Filtern der Optionskette (Standard 0 = alle Optionen herunterladen). Asset-spezifisch; nach der Auswahl des Assets und vor dem Kauf von Verträgen einstellen. Wenn auf 0 gesetzt, wird contractUpdate im [Trade]-Modus diese Variable automatisch auf den Multiplikator des ersten Vertrags setzen, sofern über die Broker-API verfügbar.

Centage

Kombination von Flags, die bestimmen, welche Options- oder Future-Preise in historischen Daten oder Live-Daten in Cent statt in Dollar angegeben werden (Standard 0 = alle Preise in Dollar). Preise werden dann beim Laden der Historie oder beim Abrufen von Daten von der Broker-API automatisch in Dollar umgerechnet. Centage-Flags können durch Addition kombiniert werden. Asset-spezifisch; nach der Auswahl des Assets und vor dem Kauf von Verträgen einstellen.

1 - Strike in Cent, in Live-Vertragsdaten
2 - Strike in Cent, in Vertragsgeschichte
4 - Underlying in Cent, in Live-Vertragsdaten
8 - Underlying in Cent, in Vertragsgeschichte
16 - Ask/Bid in Cent, in Live-Vertragsdaten
32 - Ask/Bid in Cent, in Vertragsgeschichte
64 - Underlying-Preise und Spreads in Cent, in Live- und historischen Preisdaten (ähnlich zu HedgeRatio = 0.01).

Beispiel: Centage = 59 (= 32+16+8+2+1) für Ask/Bid immer in Cent, Underlying-Historie in Cent aber Live in Dollar, und Strike immer in Cent.

Typ:

int, asset-spezifisch

ExpiryTime

Die Stunde im HHMM-Format, zu der Verträge verfallen; Standard 1200 (UTC). Wird für contractDays verwendet. Wird zur TradeExitDate-Variable hinzugefügt, wenn ein Trade eröffnet wird. Zu diesem Zeitpunkt am Verfallsdatum des Vertrags wird der Trade aus der offenen Trade-Liste entfernt und sein Gewinn oder Verlust dem Konto gutgeschrieben. Setze dies auf einen höheren Wert, um die Vertragsverfall mit der contractCheck-Funktion im Live-Handel zu überprüfen. Beachte, dass einige Börsen Beschränkungen für den Handel oder die Ausübung von Verträgen am Verfallsdatum haben.

Typ:

int, global für alle Assets

Exchange

Die Börse für die Verträge im Live-Handel. Setze das Börsensymbol manuell über diese Variable, wenn die Börse vom Broker verlangt wird. Die Liste gültiger Börsensymbole kann von der Broker-Website bezogen werden.

Typ:

string, asset specific.


 

Bemerkungen:

  • Vertragsvariablen sind nur gültig, wenn keine Vertragskette geladen wurde (siehe contractUpdate()).
  • Multiplier und Centage (falls erforderlich) müssen für das aktuelle Asset eingerichtet werden, bevor Vertragsketten geladen werden.
     

Beispiele: siehe Optionen und Futures

See also:

enterLong/Short, Vertrag, Combo

 

► neueste Version online