-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContract.cs
More file actions
152 lines (127 loc) · 4.66 KB
/
Copy pathContract.cs
File metadata and controls
152 lines (127 loc) · 4.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* Copyright (C) 2025 Interactive Brokers LLC. All rights reserved. This code is subject to the terms
* and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. */
using System.Collections.Generic;
namespace IBApi
{
/**
* @class Contract
* @brief class describing an instrument's definition
* @sa ContractDetails
*/
public class Contract
{
/**
* @brief The unique IB contract identifier
*/
public int ConId { get; set; }
/**
* @brief The underlying's asset symbol
*/
public string Symbol { get; set; }
/**
* @brief The security's type:
* STK - stock (or ETF)
* OPT - option
* FUT - future
* IND - index
* FOP - futures option
* CASH - forex pair
* BAG - combo
* WAR - warrant
* BOND- bond
* CMDTY- commodity
* NEWS- news
* FUND- mutual fund
*/
public string SecType { get; set; }
/**
* @brief The contract's last trading day or contract month (for Options and Futures). Strings with format YYYYMM will be interpreted as the Contract Month whereas YYYYMMDD will be interpreted as Last Trading Day.
*/
public string LastTradeDateOrContractMonth { get; set; }
/**
* @brief The contract's last trading day.
*/
public string LastTradeDate { get; set; }
/**
* @brief The option's strike price
*/
public double Strike { get; set; }
/**
* @brief Either Put or Call (i.e. Options). Valid values are P, PUT, C, CALL.
*/
public string Right { get; set; }
/**
* @brief The instrument's multiplier (i.e. options, futures).
*/
public string Multiplier { get; set; }
/**
* @brief The destination exchange.
*/
public string Exchange { get; set; }
/**
* @brief The underlying's currency
*/
public string Currency { get; set; }
/**
* @brief The contract's symbol within its primary exchange
* For options, this will be the OCC symbol
*/
public string LocalSymbol { get; set; }
/**
* @brief The contract's primary exchange.
* For smart routed contracts, used to define contract in case of ambiguity.
* Should be defined as native exchange of contract
* For exchanges which contain a period in name, will only be part of exchange name prior to period, i.e. ENEXT for ENEXT.BE
*/
public string PrimaryExch { get; set; }
/**
* @brief The trading class name for this contract.
* Available in TWS contract description window as well. For example, GBL Dec '13 future's trading class is "FGBL"
*/
public string TradingClass { get; set; }
/**
* @brief If set to true, contract details requests and historical data queries can be performed pertaining to expired futures contracts.
* Expired options or other instrument types are not available.
*/
public bool IncludeExpired { get; set; }
/**
* @brief Security's identifier when querying contract's details or placing orders
* ISIN - Example: Apple: US0378331005
* CUSIP - Example: Apple: 037833100
*/
public string SecIdType { get; set; }
/**
* @brief Identifier of the security type
* @sa secIdType
*/
public string SecId { get; set; }
/**
* @brief Description of the contract
*/
public string Description { get; set; }
/**
* @brief IssuerId of the contract
*/
public string IssuerId { get; set; }
/**
* @brief Description of the combo legs.
*/
public string ComboLegsDescription { get; set; }
/**
* @brief The legs of a combined contract definition
* @sa ComboLeg
*/
public List<ComboLeg> ComboLegs { get; set; }
/**
* @brief Delta and underlying price for Delta-Neutral combo orders.
* Underlying (STK or FUT), delta and underlying price goes into this attribute.
* @sa DeltaNeutralContract
*/
public DeltaNeutralContract DeltaNeutralContract { get; set; }
public Contract()
{
Strike = double.MaxValue;
}
public override string ToString() => $"{SecType} {Symbol} {Currency} {Exchange}";
}
}