All files / src/models contract.model.ts

100% Statements 19/19
100% Branches 0/0
100% Functions 0/0
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 938x 8x           8x     8x       8x       8x                 8x       8x               8x       8x       8x       8x             8x                   8x               8x                   8x       8x    
import {OptionType, SecType} from "@stoqey/ib";
import {enumProperty, model, property} from "@waytrade/microservice-core";
 
/**
 * A contract on Interactive Brokers.
 */
@model("A contract on Interactive Brokers.")
export class Contract {
  /** The unique IB contract identifier. */
  @property("The unique IB contract identifier.")
  conId?: number;
 
  /** The asset symbol. */
  @property("The asset symbol.")
  symbol?: string;
 
  /** The security type. */
  @enumProperty("SecType", SecType, "The security type.")
  secType?: SecType;
 
  /**
   * 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.
   */
  @property("The contract's last trading day or contract month.")
  lastTradeDateOrContractMonth?: string;
 
  /** The option's strike price. */
  @property("The option's strike price.")
  strike?: number;
 
  /** Either Put or Call (i.e. Options). Valid values are P, PUT, C, CALL. */
  @enumProperty(
    "OptionType",
    OptionType,
    "Either Put or Call (i.e. Options). Valid values are P, PUT, C, CALL.",
  )
  right?: OptionType;
 
  /** The instrument's multiplier (i.e. options, futures). */
  @property("The instrument's multiplier (i.e. options, futures).")
  multiplier?: number;
 
  /** The destination exchange. */
  @property("The destination exchange.")
  exchange?: string;
 
  /** The trading currency. */
  @property("The trading currency.")
  currency?: string;
 
  /**
   * The contract's symbol within its primary exchange.
   * For options, this will be the OCC symbol.
   */
  @property("The contract's symbol within its primary exchange.")
  localSymbol?: string;
 
  /**
   * 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, e.g. ISLAND for MSFT.
   * For exchanges which contain a period in name, will only be part of exchange
   * name prior to period, i.e. ENEXT for ENEXT.BE.
   */
  @property("The contract's primary exchange.")
  primaryExch?: string;
 
  /**
   * 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".
   */
  @property("The trading class name for this contract.")
  tradingClass?: string;
 
  /**
   * Security's identifier when querying contract's details or placing orders
   * ISIN - Example: Apple: US0378331005.
   * CUSIP - Example: Apple: 037833100.
   */
  @property(
    "Security's identifier when querying contract's details or placing orders.",
  )
  secIdType?: string;
 
  /**Identifier of the security type. */
  @property("Identifier of the security type.")
  secId?: string;
}