> For the complete documentation index, see [llms.txt](https://touchance-1.gitbook.io/touchance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://touchance-1.gitbook.io/touchance/multicharts/jia-zhi-han-shu/mcextendquote/dao-qi-ri-han-shu-getcontractsexpire.md).

# GetContractsExpire

## 語法

```
GetContractsExpire(ExpireType,Symbol_NAME,EL_Date,El_times);
```

## 範例

查詢 CME.GC 2002 合約的到期日期，存入 test2 數值變數並列印結果。

```
var:test2(0);
test2 = GetContractsExpire(3,"CME.GC 2002",Date,time_s);
print(D,"	",T,"	expire=",test2);
```

輸出結果

```
1200212.00	 600.00	expire=20200226.00	
1200213.00	 600.00	expire=20200226.00	
1200214.00	 600.00	expire=20200226.00	
1200215.00	 600.00	expire=20200226.00	
```

**參數**

| **名稱**       | **類型** | **說明**                     |
| ------------ | ------ | -------------------------- |
| ExpireType   | 數值型    | 到期日的類型                     |
|              |        | 1：回傳剩餘日曆日 ( 若合約已到期，返回 -1 ) |
|              |        | 2：回傳剩餘交易日 ( 若合約已到期，返回 -1 ) |
|              |        | 3：回傳到期日期                   |
| Symbol\_NAME | 字串行    | 期貨指定月商品的代碼，如：CME.GC 2002   |
| EL\_Date     | 數值型    | 查詢的日期                      |
| EL\_times    | 數值型    | 查詢的時間                      |

{% hint style="warning" %}
只限指定月 ( 例如 CME.GC 2002 ) 商品才可查詢。
{% endhint %}
