forked from jamesmawm/High-Frequency-Trading-Model-with-IB
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ibDataTypes.py
76 lines (63 loc) · 1.84 KB
/
ibDataTypes.py
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
#######################################
# Author: James Ma
# Email stuff here: [email protected]
#######################################
# https://www.interactivebrokers.com/en/software/api/apiguide/java/reqhistoricaldata.htm
# https://www.interactivebrokers.com/en/software/api/apiguide/tables/tick_types.htm
FIELD_BID_SIZE = 0
FIELD_BID_PRICE = 1
FIELD_ASK_PRICE = 2
FIELD_ASK_SIZE = 3
FIELD_LAST_PRICE = 4
FIELD_LAST_SIZE = 5
FIELD_HIGH = 6
FIELD_LOW = 7
FIELD_VOLUME = 8
FIELD_CLOSE_PRICE = 9
FIELD_AVG_VOLUME = 21
FIELD_BID_EXCH = 32
FIELD_ASK_EXCH = 33
FIELD_AUCTION_VOLUME = 34
FIELD_AUCTION_PRICE = 35
FIELD_LAST_TIMESTAMP = 45
FIELD_HALTED = 49
FIELD_TRADE_COUNT = 54
FIELD_TRADE_RATE = 55
FIELD_VOLUME_RATE = 56
FIELD_HALTED_NOT_HALTED = 0
FIELD_HALTED_IS_HALTED = 1
FIELD_HALTED_BY_VOLATILITY = 2
DURATION_1_HR = "3600 S"
DURATION_1_MIN = "60 S"
DURATION_1_DAY = "1 D"
BAR_SIZE_1_SEC = "1 secs"
BAR_SIZE_1_MIN = "1 min"
RTH_ALL = 0
RTH_ONLY_TRADING_HRS = 1
WHAT_TO_SHOW_TRADES = "TRADES"
WHAT_TO_SHOW_MID_PT = "MIDPOINT"
WHAT_TO_SHOW_BID = "BID"
WHAT_TO_SHOW_ASK = "ASK"
WHAT_TO_SHOW_BID_ASK = "BID_ASK"
WHAT_TO_SHOW_HVOL = "HISTORICAL_VOLATILITY"
WHAT_TO_SHOW_OPT_IMPV = "OPTION_IMPLIED_VOLATILITY"
DATEFORMAT_STRING = 1
DATEFORMAT_UNIX_TS = 2
MSG_TYPE_HISTORICAL_DATA = "historicalData"
MSG_TYPE_UPDATE_PORTFOLIO = "updatePortfolio"
MSG_TYPE_MANAGED_ACCOUNTS = "managedAccounts"
MSG_TYPE_NEXT_ORDER_ID = "nextValidId"
MSG_TYPE_TICK_PRICE = "tickPrice"
MSG_TYPE_TICK_STRING = "tickString"
MSG_TYPE_STICK_SIZE = "tickSize"
DATE_TIME_FORMAT = "%Y%m%d %H:%M:%S"
DATE_TIME_FORMAT_LONG = "%Y-%m-%d %H:%M:%S"
DATE_TIME_FORMAT_LONG_MILLISECS = "%Y-%m-%d %H:%M:%S.%f"
GENERIC_TICKS_NONE = ''
GENERIC_TICKS_RTVOLUME = "233"
SNAPSHOT_NONE = False
SNAPSHOT_TRUE = True
ORDER_TYPE_MARKET = "MKT"
ORDER_TYPE_LIMIT = "LMT"
ORDER_ACTION_SELL = "SELL"
ORDER_ACTION_BUY = "BUY"