1use pyo3::prelude::*;
13
14use crate::{
15 common::enums::{
16 IbAccountSummaryEvent, IbAccountUpdateEvent, IbAccountUpdateMultiEvent, IbAction,
17 IbArticleType, IbAuctionStrategy, IbAuctionType, IbBondIdentifierKind,
18 IbBuilderTimeInForce, IbCancelOrderEvent, IbComboLegOpenClose, IbConditionConjunction,
19 IbConditionKind, IbExecutionsEvent, IbExerciseAction, IbExerciseOptionsEvent,
20 IbFundAssetType, IbFundDistributionPolicyIndicator, IbHistoricalBarSize,
21 IbHistoricalBarUpdateEvent, IbHistoricalTickType, IbHistoricalWhatToShow, IbLegAction,
22 IbLiquidity, IbMarketDepthEvent, IbOcaType, IbOptionRight, IbOrderOpenClose, IbOrderOrigin,
23 IbOrderStatus, IbOrderType, IbOrderUpdateEvent, IbOrdersEvent, IbPlaceOrderEvent,
24 IbPositionUpdateEvent, IbPositionUpdateMultiEvent, IbRealtimeBarSize, IbRealtimeWhatToShow,
25 IbReferencePriceType, IbRiskAversion, IbRule80A, IbSecurityType, IbShortSaleSlot,
26 IbTickEvent, IbTickType, IbTimeInForce, IbTradingHours, IbTriggerMethod,
27 IbTwapStrategyType, IbVolatilityType,
28 },
29 error::{ErrorCategory, InteractiveBrokersErrorKind},
30};
31
32#[pymethods]
33impl IbAction {
34 #[classattr]
35 const BUY: Self = Self::Buy;
36 #[classattr]
37 const BOUGHT: Self = Self::Bought;
38 #[classattr]
39 const SELL: Self = Self::Sell;
40 #[classattr]
41 const SOLD: Self = Self::Sold;
42 #[classattr]
43 const SELL_SHORT: Self = Self::SellShort;
44 #[classattr]
45 const SELL_LONG: Self = Self::SellLong;
46
47 #[pyo3(name = "as_str")]
48 fn py_as_str(&self) -> String {
49 self.to_string()
50 }
51}
52
53#[pymethods]
54impl IbOrderStatus {
55 #[classattr]
56 const API_PENDING: Self = Self::ApiPending;
57 #[classattr]
58 const PENDING_SUBMIT: Self = Self::PendingSubmit;
59 #[classattr]
60 const PRE_SUBMITTED: Self = Self::PreSubmitted;
61 #[classattr]
62 const SUBMITTED: Self = Self::Submitted;
63 #[classattr]
64 const PENDING_CANCEL: Self = Self::PendingCancel;
65 #[classattr]
66 const API_CANCELLED: Self = Self::ApiCancelled;
67 #[classattr]
68 const CANCELLED: Self = Self::Cancelled;
69 #[classattr]
70 const FILLED: Self = Self::Filled;
71 #[classattr]
72 const INACTIVE: Self = Self::Inactive;
73
74 #[pyo3(name = "as_str")]
75 fn py_as_str(&self) -> String {
76 self.to_string()
77 }
78}
79
80#[pymethods]
81impl IbOrderType {
82 #[classattr]
83 const MARKET: Self = Self::Market;
84 #[classattr]
85 const MARKET_ON_CLOSE: Self = Self::MarketOnClose;
86 #[classattr]
87 const LIMIT: Self = Self::Limit;
88 #[classattr]
89 const LIMIT_ON_CLOSE: Self = Self::LimitOnClose;
90 #[classattr]
91 const STOP: Self = Self::Stop;
92 #[classattr]
93 const STOP_LIMIT: Self = Self::StopLimit;
94 #[classattr]
95 const TRAILING_STOP: Self = Self::TrailingStop;
96 #[classattr]
97 const TRAILING_STOP_LIMIT: Self = Self::TrailingStopLimit;
98 #[classattr]
99 const MARKET_IF_TOUCHED: Self = Self::MarketIfTouched;
100 #[classattr]
101 const LIMIT_IF_TOUCHED: Self = Self::LimitIfTouched;
102 #[classattr]
103 const MARKET_TO_LIMIT: Self = Self::MarketToLimit;
104 #[classattr]
105 const MARKET_WITH_PROTECTION: Self = Self::MarketWithProtection;
106 #[classattr]
107 const STOP_WITH_PROTECTION: Self = Self::StopWithProtection;
108 #[classattr]
109 const MIDPRICE: Self = Self::Midprice;
110 #[classattr]
111 const PEGGED_TO_MARKET: Self = Self::PeggedToMarket;
112 #[classattr]
113 const PEGGED_TO_STOCK: Self = Self::PeggedToStock;
114 #[classattr]
115 const PEGGED_TO_MIDPOINT: Self = Self::PeggedToMidpoint;
116 #[classattr]
117 const PEGGED_TO_BENCHMARK: Self = Self::PeggedToBenchmark;
118 #[classattr]
119 const PEG_BEST: Self = Self::PegBest;
120 #[classattr]
121 const RELATIVE: Self = Self::Relative;
122 #[classattr]
123 const PASSIVE_RELATIVE: Self = Self::PassiveRelative;
124 #[classattr]
125 const VOLATILITY: Self = Self::Volatility;
126 #[classattr]
127 const BOX_TOP: Self = Self::BoxTop;
128 #[classattr]
129 const RELATIVE_LIMIT_COMBO: Self = Self::RelativeLimitCombo;
130 #[classattr]
131 const RELATIVE_MARKET_COMBO: Self = Self::RelativeMarketCombo;
132
133 #[pyo3(name = "as_str")]
134 fn py_as_str(&self) -> &'static str {
135 self.as_str()
136 }
137}
138
139#[pymethods]
140impl IbTimeInForce {
141 #[classattr]
142 const DAY: Self = Self::Day;
143 #[classattr]
144 const GOOD_TIL_CANCELED: Self = Self::GoodTilCanceled;
145 #[classattr]
146 const IMMEDIATE_OR_CANCEL: Self = Self::ImmediateOrCancel;
147 #[classattr]
148 const GOOD_TIL_DATE: Self = Self::GoodTilDate;
149 #[classattr]
150 const ON_OPEN: Self = Self::OnOpen;
151 #[classattr]
152 const FILL_OR_KILL: Self = Self::FillOrKill;
153 #[classattr]
154 const DAY_TIL_CANCELED: Self = Self::DayTilCanceled;
155 #[classattr]
156 const AUCTION: Self = Self::Auction;
157
158 #[pyo3(name = "as_str")]
159 fn py_as_str(&self) -> String {
160 self.to_string()
161 }
162}
163
164#[pymethods]
165impl IbBuilderTimeInForce {
166 #[classattr]
167 const DAY: Self = Self::Day;
168 #[classattr]
169 const GOOD_TILL_CANCEL: Self = Self::GoodTillCancel;
170 #[classattr]
171 const IMMEDIATE_OR_CANCEL: Self = Self::ImmediateOrCancel;
172 #[classattr]
173 const GOOD_TILL_DATE: Self = Self::GoodTillDate;
174 #[classattr]
175 const FILL_OR_KILL: Self = Self::FillOrKill;
176 #[classattr]
177 const GOOD_TILL_CROSSING: Self = Self::GoodTillCrossing;
178 #[classattr]
179 const DAY_TILL_CANCELED: Self = Self::DayTillCanceled;
180 #[classattr]
181 const AUCTION: Self = Self::Auction;
182 #[classattr]
183 const OPENING_AUCTION: Self = Self::OpeningAuction;
184
185 #[pyo3(name = "as_str")]
186 fn py_as_str(&self) -> &'static str {
187 self.as_str()
188 }
189}
190
191#[pymethods]
192impl IbSecurityType {
193 #[classattr]
194 const STOCK: Self = Self::Stock;
195 #[classattr]
196 const OPTION: Self = Self::Option;
197 #[classattr]
198 const FUTURE: Self = Self::Future;
199 #[classattr]
200 const CONTINUOUS_FUTURE: Self = Self::ContinuousFuture;
201 #[classattr]
202 const INDEX: Self = Self::Index;
203 #[classattr]
204 const FUTURES_OPTION: Self = Self::FuturesOption;
205 #[classattr]
206 const FOREX_PAIR: Self = Self::ForexPair;
207 #[classattr]
208 const SPREAD: Self = Self::Spread;
209 #[classattr]
210 const WARRANT: Self = Self::Warrant;
211 #[classattr]
212 const BOND: Self = Self::Bond;
213 #[classattr]
214 const COMMODITY: Self = Self::Commodity;
215 #[classattr]
216 const NEWS: Self = Self::News;
217 #[classattr]
218 const MUTUAL_FUND: Self = Self::MutualFund;
219 #[classattr]
220 const CRYPTO: Self = Self::Crypto;
221 #[classattr]
222 const CFD: Self = Self::Cfd;
223
224 #[pyo3(name = "as_str")]
225 fn py_as_str(&self) -> &'static str {
226 self.as_str()
227 }
228}
229
230#[pymethods]
231impl IbOptionRight {
232 #[classattr]
233 const CALL: Self = Self::Call;
234 #[classattr]
235 const PUT: Self = Self::Put;
236
237 #[pyo3(name = "as_str")]
238 fn py_as_str(&self) -> &'static str {
239 self.as_str()
240 }
241}
242
243#[pymethods]
244impl IbHistoricalTickType {
245 #[classattr]
246 const TRADES: Self = Self::Trades;
247 #[classattr]
248 const BID_ASK: Self = Self::BidAsk;
249
250 #[pyo3(name = "as_str")]
251 fn py_as_str(&self) -> &'static str {
252 self.as_str()
253 }
254}
255
256#[pymethods]
257impl IbTradingHours {
258 #[classattr]
259 const REGULAR: Self = Self::Regular;
260 #[classattr]
261 const EXTENDED: Self = Self::Extended;
262
263 #[pyo3(name = "use_rth")]
264 fn py_use_rth(&self) -> bool {
265 self.use_rth()
266 }
267}
268
269#[pymethods]
270impl IbHistoricalBarSize {
271 #[classattr]
272 const SEC: Self = Self::Sec;
273 #[classattr]
274 const SEC5: Self = Self::Sec5;
275 #[classattr]
276 const SEC10: Self = Self::Sec10;
277 #[classattr]
278 const SEC15: Self = Self::Sec15;
279 #[classattr]
280 const SEC30: Self = Self::Sec30;
281 #[classattr]
282 const MIN: Self = Self::Min;
283 #[classattr]
284 const MIN2: Self = Self::Min2;
285 #[classattr]
286 const MIN3: Self = Self::Min3;
287 #[classattr]
288 const MIN5: Self = Self::Min5;
289 #[classattr]
290 const MIN10: Self = Self::Min10;
291 #[classattr]
292 const MIN15: Self = Self::Min15;
293 #[classattr]
294 const MIN20: Self = Self::Min20;
295 #[classattr]
296 const MIN30: Self = Self::Min30;
297 #[classattr]
298 const HOUR: Self = Self::Hour;
299 #[classattr]
300 const HOUR2: Self = Self::Hour2;
301 #[classattr]
302 const HOUR3: Self = Self::Hour3;
303 #[classattr]
304 const HOUR4: Self = Self::Hour4;
305 #[classattr]
306 const HOUR8: Self = Self::Hour8;
307 #[classattr]
308 const DAY: Self = Self::Day;
309 #[classattr]
310 const WEEK: Self = Self::Week;
311 #[classattr]
312 const MONTH: Self = Self::Month;
313
314 #[pyo3(name = "as_str")]
315 fn py_as_str(&self) -> String {
316 self.to_string()
317 }
318}
319
320#[pymethods]
321impl IbHistoricalWhatToShow {
322 #[classattr]
323 const TRADES: Self = Self::Trades;
324 #[classattr]
325 const MIDPOINT: Self = Self::Midpoint;
326 #[classattr]
327 const BID: Self = Self::Bid;
328 #[classattr]
329 const ASK: Self = Self::Ask;
330 #[classattr]
331 const BID_ASK: Self = Self::BidAsk;
332 #[classattr]
333 const HISTORICAL_VOLATILITY: Self = Self::HistoricalVolatility;
334 #[classattr]
335 const OPTION_IMPLIED_VOLATILITY: Self = Self::OptionImpliedVolatility;
336 #[classattr]
337 const FEE_RATE: Self = Self::FeeRate;
338 #[classattr]
339 const SCHEDULE: Self = Self::Schedule;
340 #[classattr]
341 const ADJUSTED_LAST: Self = Self::AdjustedLast;
342
343 #[pyo3(name = "as_str")]
344 fn py_as_str(&self) -> &'static str {
345 self.as_str()
346 }
347}
348
349#[pymethods]
350impl IbRealtimeBarSize {
351 #[classattr]
352 const SEC5: Self = Self::Sec5;
353
354 #[pyo3(name = "as_str")]
355 fn py_as_str(&self) -> String {
356 self.to_string()
357 }
358}
359
360#[pymethods]
361impl IbRealtimeWhatToShow {
362 #[classattr]
363 const TRADES: Self = Self::Trades;
364 #[classattr]
365 const MIDPOINT: Self = Self::Midpoint;
366 #[classattr]
367 const BID: Self = Self::Bid;
368 #[classattr]
369 const ASK: Self = Self::Ask;
370
371 #[pyo3(name = "as_str")]
372 fn py_as_str(&self) -> &'static str {
373 self.as_str()
374 }
375}
376
377#[pymethods]
378impl IbConditionKind {
379 #[classattr]
380 const PRICE: Self = Self::Price;
381 #[classattr]
382 const TIME: Self = Self::Time;
383 #[classattr]
384 const MARGIN: Self = Self::Margin;
385 #[classattr]
386 const EXECUTION: Self = Self::Execution;
387 #[classattr]
388 const VOLUME: Self = Self::Volume;
389 #[classattr]
390 const PERCENT_CHANGE: Self = Self::PercentChange;
391
392 #[pyo3(name = "as_str")]
393 fn py_as_str(&self) -> &'static str {
394 self.as_str()
395 }
396}
397
398#[pymethods]
399impl IbConditionConjunction {
400 #[classattr]
401 const AND: Self = Self::And;
402 #[classattr]
403 const OR: Self = Self::Or;
404
405 #[pyo3(name = "as_str")]
406 fn py_as_str(&self) -> &'static str {
407 self.as_str()
408 }
409
410 #[pyo3(name = "is_conjunction")]
411 fn py_is_conjunction(&self) -> bool {
412 self.is_conjunction()
413 }
414}
415
416#[pymethods]
417impl IbComboLegOpenClose {
418 #[classattr]
419 const SAME: Self = Self::Same;
420 #[classattr]
421 const OPEN: Self = Self::Open;
422 #[classattr]
423 const CLOSE: Self = Self::Close;
424 #[classattr]
425 const UNKNOWN: Self = Self::Unknown;
426
427 #[pyo3(name = "as_i32")]
428 fn py_as_i32(&self) -> i32 {
429 self.as_i32()
430 }
431}
432
433#[pymethods]
434impl IbTriggerMethod {
435 #[classattr]
436 const DEFAULT: Self = Self::Default;
437 #[classattr]
438 const DOUBLE_BID_ASK: Self = Self::DoubleBidAsk;
439 #[classattr]
440 const LAST: Self = Self::Last;
441 #[classattr]
442 const DOUBLE_LAST: Self = Self::DoubleLast;
443 #[classattr]
444 const BID_ASK: Self = Self::BidAsk;
445 #[classattr]
446 const LAST_OR_BID_ASK: Self = Self::LastOrBidAsk;
447 #[classattr]
448 const MIDPOINT: Self = Self::Midpoint;
449
450 #[pyo3(name = "as_i32")]
451 fn py_as_i32(&self) -> i32 {
452 self.as_i32()
453 }
454}
455
456#[pymethods]
457impl IbOcaType {
458 #[classattr]
459 const NONE: Self = Self::None;
460 #[classattr]
461 const CANCEL_WITH_BLOCK: Self = Self::CancelWithBlock;
462 #[classattr]
463 const REDUCE_WITH_BLOCK: Self = Self::ReduceWithBlock;
464 #[classattr]
465 const REDUCE_WITHOUT_BLOCK: Self = Self::ReduceWithoutBlock;
466
467 #[pyo3(name = "as_i32")]
468 fn py_as_i32(&self) -> i32 {
469 self.as_i32()
470 }
471}
472
473#[pymethods]
474impl IbLiquidity {
475 #[classattr]
476 const NONE: Self = Self::None;
477 #[classattr]
478 const ADDED_LIQUIDITY: Self = Self::AddedLiquidity;
479 #[classattr]
480 const REMOVED_LIQUIDITY: Self = Self::RemovedLiquidity;
481 #[classattr]
482 const LIQUIDITY_ROUTED_OUT: Self = Self::LiquidityRoutedOut;
483
484 #[pyo3(name = "as_i32")]
485 fn py_as_i32(&self) -> i32 {
486 self.as_i32()
487 }
488}
489
490macro_rules! py_i32_enum {
491 ($ty:ty, $($name:ident => $variant:ident),+ $(,)?) => {
492 #[pymethods]
493 impl $ty {
494 $(
495 #[classattr]
496 const $name: Self = Self::$variant;
497 )+
498
499 #[pyo3(name = "as_i32")]
500 fn py_as_i32(&self) -> i32 {
501 self.as_i32()
502 }
503 }
504 };
505}
506
507macro_rules! py_str_enum {
508 ($ty:ty, $($name:ident => $variant:ident),+ $(,)?) => {
509 #[pymethods]
510 impl $ty {
511 $(
512 #[classattr]
513 const $name: Self = Self::$variant;
514 )+
515
516 #[pyo3(name = "as_str")]
517 fn py_as_str(&self) -> String {
518 self.to_string()
519 }
520 }
521 };
522}
523
524macro_rules! py_marker_enum {
525 ($ty:ty, $($name:ident => $variant:ident),+ $(,)?) => {
526 #[pymethods]
527 impl $ty {
528 $(
529 #[classattr]
530 const $name: Self = Self::$variant;
531 )+
532
533 #[pyo3(name = "as_str")]
534 fn py_as_str(&self) -> String {
535 format!("{self:?}")
536 }
537 }
538 };
539}
540
541py_i32_enum!(
542 IbTickType,
543 UNKNOWN => Unknown,
544 BID_SIZE => BidSize,
545 BID => Bid,
546 ASK => Ask,
547 ASK_SIZE => AskSize,
548 LAST => Last,
549 LAST_SIZE => LastSize,
550 HIGH => High,
551 LOW => Low,
552 VOLUME => Volume,
553 CLOSE => Close,
554 BID_OPTION => BidOption,
555 ASK_OPTION => AskOption,
556 LAST_OPTION => LastOption,
557 MODEL_OPTION => ModelOption,
558 OPEN => Open,
559 LOW_13_WEEK => Low13Week,
560 HIGH_13_WEEK => High13Week,
561 LOW_26_WEEK => Low26Week,
562 HIGH_26_WEEK => High26Week,
563 LOW_52_WEEK => Low52Week,
564 HIGH_52_WEEK => High52Week,
565 AVG_VOLUME => AvgVolume,
566 OPEN_INTEREST => OpenInterest,
567 OPTION_HISTORICAL_VOL => OptionHistoricalVol,
568 OPTION_IMPLIED_VOL => OptionImpliedVol,
569 OPTION_BID_EXCH => OptionBidExch,
570 OPTION_ASK_EXCH => OptionAskExch,
571 OPTION_CALL_OPEN_INTEREST => OptionCallOpenInterest,
572 OPTION_PUT_OPEN_INTEREST => OptionPutOpenInterest,
573 OPTION_CALL_VOLUME => OptionCallVolume,
574 OPTION_PUT_VOLUME => OptionPutVolume,
575 INDEX_FUTURE_PREMIUM => IndexFuturePremium,
576 BID_EXCH => BidExch,
577 ASK_EXCH => AskExch,
578 AUCTION_VOLUME => AuctionVolume,
579 AUCTION_PRICE => AuctionPrice,
580 AUCTION_IMBALANCE => AuctionImbalance,
581 MARK_PRICE => MarkPrice,
582 BID_EFP_COMPUTATION => BidEfpComputation,
583 ASK_EFP_COMPUTATION => AskEfpComputation,
584 LAST_EFP_COMPUTATION => LastEfpComputation,
585 OPEN_EFP_COMPUTATION => OpenEfpComputation,
586 HIGH_EFP_COMPUTATION => HighEfpComputation,
587 LOW_EFP_COMPUTATION => LowEfpComputation,
588 CLOSE_EFP_COMPUTATION => CloseEfpComputation,
589 LAST_TIMESTAMP => LastTimestamp,
590 SHORTABLE => Shortable,
591 FUNDAMENTAL_RATIOS => FundamentalRatios,
592 RT_VOLUME => RtVolume,
593 HALTED => Halted,
594 BID_YIELD => BidYield,
595 ASK_YIELD => AskYield,
596 LAST_YIELD => LastYield,
597 CUST_OPTION_COMPUTATION => CustOptionComputation,
598 TRADE_COUNT => TradeCount,
599 TRADE_RATE => TradeRate,
600 VOLUME_RATE => VolumeRate,
601 LAST_RTH_TRADE => LastRthTrade,
602 RT_HISTORICAL_VOL => RtHistoricalVol,
603 IB_DIVIDENDS => IbDividends,
604 BOND_FACTOR_MULTIPLIER => BondFactorMultiplier,
605 REGULATORY_IMBALANCE => RegulatoryImbalance,
606 NEWS_TICK => NewsTick,
607 SHORT_TERM_VOLUME_3_MIN => ShortTermVolume3Min,
608 SHORT_TERM_VOLUME_5_MIN => ShortTermVolume5Min,
609 SHORT_TERM_VOLUME_10_MIN => ShortTermVolume10Min,
610 DELAYED_BID => DelayedBid,
611 DELAYED_ASK => DelayedAsk,
612 DELAYED_LAST => DelayedLast,
613 DELAYED_BID_SIZE => DelayedBidSize,
614 DELAYED_ASK_SIZE => DelayedAskSize,
615 DELAYED_LAST_SIZE => DelayedLastSize,
616 DELAYED_HIGH => DelayedHigh,
617 DELAYED_LOW => DelayedLow,
618 DELAYED_VOLUME => DelayedVolume,
619 DELAYED_CLOSE => DelayedClose,
620 DELAYED_OPEN => DelayedOpen,
621 RT_TRD_VOLUME => RtTrdVolume,
622 CREDITMAN_MARK_PRICE => CreditmanMarkPrice,
623 CREDITMAN_SLOW_MARK_PRICE => CreditmanSlowMarkPrice,
624 DELAYED_BID_OPTION => DelayedBidOption,
625 DELAYED_ASK_OPTION => DelayedAskOption,
626 DELAYED_LAST_OPTION => DelayedLastOption,
627 DELAYED_MODEL_OPTION => DelayedModelOption,
628 LAST_EXCH => LastExch,
629 LAST_REG_TIME => LastRegTime,
630 FUTURES_OPEN_INTEREST => FuturesOpenInterest,
631 AVG_OPT_VOLUME => AvgOptVolume,
632 DELAYED_LAST_TIMESTAMP => DelayedLastTimestamp,
633 SHORTABLE_SHARES => ShortableShares,
634 DELAYED_HALTED => DelayedHalted,
635 REUTERS2_MUTUAL_FUNDS => Reuters2MutualFunds,
636 ETF_NAV_CLOSE => EtfNavClose,
637 ETF_NAV_PRIOR_CLOSE => EtfNavPriorClose,
638 ETF_NAV_BID => EtfNavBid,
639 ETF_NAV_ASK => EtfNavAsk,
640 ETF_NAV_LAST => EtfNavLast,
641 ETF_FROZEN_NAV_LAST => EtfFrozenNavLast,
642 ETF_NAV_HIGH => EtfNavHigh,
643 ETF_NAV_LOW => EtfNavLow,
644 SOCIAL_MARKET_ANALYTICS => SocialMarketAnalytics,
645 ESTIMATED_IPO_MIDPOINT => EstimatedIpoMidpoint,
646 FINAL_IPO_LAST => FinalIpoLast,
647 DELAYED_YIELD_BID => DelayedYieldBid,
648 DELAYED_YIELD_ASK => DelayedYieldAsk,
649);
650
651py_i32_enum!(IbOrderOrigin, CUSTOMER => Customer, FIRM => Firm);
652py_i32_enum!(IbShortSaleSlot, NONE => None, BROKER => Broker, THIRD_PARTY => ThirdParty);
653py_i32_enum!(IbVolatilityType, DAILY => Daily, ANNUAL => Annual);
654py_i32_enum!(
655 IbReferencePriceType,
656 AVERAGE_OF_NBBO => AverageOfNbbo,
657 NBBO => Nbbo,
658);
659py_i32_enum!(
660 IbAuctionStrategy,
661 MATCH => Match,
662 IMPROVEMENT => Improvement,
663 TRANSPARENT => Transparent,
664);
665py_i32_enum!(IbExerciseAction, EXERCISE => Exercise, LAPSE => Lapse);
666py_i32_enum!(IbArticleType, TEXT => Text, BINARY => Binary);
667py_i32_enum!(
668 IbAuctionType,
669 OPENING => Opening,
670 CLOSING => Closing,
671 VOLATILITY => Volatility,
672);
673
674py_str_enum!(
675 IbRule80A,
676 INDIVIDUAL => Individual,
677 AGENCY => Agency,
678 AGENT_OTHER_MEMBER => AgentOtherMember,
679 INDIVIDUAL_PTIA => IndividualPtia,
680 AGENCY_PTIA => AgencyPtia,
681 AGENT_OTHER_MEMBER_PTIA => AgentOtherMemberPtia,
682 INDIVIDUAL_PT => IndividualPt,
683 AGENCY_PT => AgencyPt,
684 AGENT_OTHER_MEMBER_PT => AgentOtherMemberPt,
685);
686py_str_enum!(IbOrderOpenClose, OPEN => Open, CLOSE => Close);
687py_str_enum!(
688 IbTwapStrategyType,
689 MARKETABLE => Marketable,
690 MATCHING_MIDPOINT => MatchingMidpoint,
691 MATCHING_SAME_SIDE => MatchingSameSide,
692 MATCHING_LAST => MatchingLast,
693);
694py_str_enum!(
695 IbRiskAversion,
696 GET_DONE => GetDone,
697 AGGRESSIVE => Aggressive,
698 NEUTRAL => Neutral,
699 PASSIVE => Passive,
700);
701py_str_enum!(IbLegAction, BUY => Buy, SELL => Sell);
702py_str_enum!(
703 IbFundDistributionPolicyIndicator,
704 NONE => None,
705 ACCUMULATION_FUND => AccumulationFund,
706 INCOME_FUND => IncomeFund,
707);
708py_str_enum!(
709 IbFundAssetType,
710 NONE => None,
711 OTHERS => Others,
712 MONEY_MARKET => MoneyMarket,
713 FIXED_INCOME => FixedIncome,
714 MULTI_ASSET => MultiAsset,
715 EQUITY => Equity,
716 SECTOR => Sector,
717 GUARANTEED => Guaranteed,
718 ALTERNATIVE => Alternative,
719);
720py_str_enum!(IbBondIdentifierKind, CUSIP => Cusip, ISIN => Isin);
721
722py_marker_enum!(
723 IbPlaceOrderEvent,
724 ORDER_STATUS => OrderStatus,
725 OPEN_ORDER => OpenOrder,
726 EXECUTION_DATA => ExecutionData,
727 COMMISSION_REPORT => CommissionReport,
728 MESSAGE => Message,
729);
730py_marker_enum!(
731 IbOrderUpdateEvent,
732 ORDER_STATUS => OrderStatus,
733 OPEN_ORDER => OpenOrder,
734 EXECUTION_DATA => ExecutionData,
735 COMMISSION_REPORT => CommissionReport,
736 MESSAGE => Message,
737);
738py_marker_enum!(IbCancelOrderEvent, ORDER_STATUS => OrderStatus, NOTICE => Notice);
739py_marker_enum!(
740 IbOrdersEvent,
741 ORDER_DATA => OrderData,
742 ORDER_STATUS => OrderStatus,
743 NOTICE => Notice,
744);
745py_marker_enum!(
746 IbExecutionsEvent,
747 EXECUTION_DATA => ExecutionData,
748 COMMISSION_REPORT => CommissionReport,
749 NOTICE => Notice,
750);
751py_marker_enum!(
752 IbExerciseOptionsEvent,
753 OPEN_ORDER => OpenOrder,
754 ORDER_STATUS => OrderStatus,
755 NOTICE => Notice,
756);
757py_marker_enum!(
758 IbHistoricalBarUpdateEvent,
759 HISTORICAL => Historical,
760 UPDATE => Update,
761 END => End,
762);
763py_marker_enum!(
764 IbMarketDepthEvent,
765 MARKET_DEPTH => MarketDepth,
766 MARKET_DEPTH_L2 => MarketDepthL2,
767 NOTICE => Notice,
768);
769py_marker_enum!(
770 IbTickEvent,
771 PRICE => Price,
772 SIZE => Size,
773 STRING => String,
774 EFP => Efp,
775 GENERIC => Generic,
776 OPTION_COMPUTATION => OptionComputation,
777 SNAPSHOT_END => SnapshotEnd,
778 NOTICE => Notice,
779 REQUEST_PARAMETERS => RequestParameters,
780 PRICE_SIZE => PriceSize,
781);
782py_marker_enum!(IbAccountSummaryEvent, SUMMARY => Summary, END => End);
783py_marker_enum!(
784 IbPositionUpdateEvent,
785 POSITION => Position,
786 POSITION_END => PositionEnd,
787);
788py_marker_enum!(
789 IbPositionUpdateMultiEvent,
790 POSITION => Position,
791 POSITION_END => PositionEnd,
792);
793py_marker_enum!(
794 IbAccountUpdateEvent,
795 ACCOUNT_VALUE => AccountValue,
796 PORTFOLIO_VALUE => PortfolioValue,
797 UPDATE_TIME => UpdateTime,
798 END => End,
799);
800py_marker_enum!(
801 IbAccountUpdateMultiEvent,
802 ACCOUNT_MULTI_VALUE => AccountMultiValue,
803 END => End,
804);
805py_marker_enum!(
806 ErrorCategory,
807 CLIENT_ERROR => ClientError,
808 CONNECTIVITY_ERROR => ConnectivityError,
809 SUBSCRIPTION_ERROR => SubscriptionError,
810 ORDER_ERROR => OrderError,
811 MARKET_DATA_ERROR => MarketDataError,
812 UNKNOWN => Unknown,
813);
814py_marker_enum!(
815 InteractiveBrokersErrorKind,
816 CONNECTION => Connection,
817 AUTHENTICATION => Authentication,
818 CONFIGURATION => Configuration,
819 REQUEST => Request,
820 PARSE => Parse,
821 INSTRUMENT => Instrument,
822 ORDER => Order,
823 MARKET_DATA => MarketData,
824 IB_API => IbApi,
825 INTERNAL => Internal,
826);