Exemplo n.º 1
0
class AccountInformation(Schema):
    accountId = String()
    acctAlias = String()
    currency = OneOf(*CURRENCY_CODES)
    name = String()
    accountType = OneOf("Individual", "Institution Master",
                        "Institution Client", "Advisor Master",
                        "Advisor Master Consolidated", "Advisor Client",
                        "Broker Master", "Broker Master Consolidated",
                        "Broker Client", "Fund Advisor")
    customerType = OneOf("Individual", "Joint", "Trust", "IRA", "Corporate",
                         "Partnership", "Limited Liability Corporation",
                         "Unincorporated Business", "IRA Traditional Rollover",
                         "IRA Traditional New", "IRA Traditional Inherited",
                         "IRA Roth New", "IRA Roth Inherited", "IRA SEP New",
                         "IRA SEP Inherited")
    accountCapabilities = List(
        valid=["Cash", "Margin", "Portfolio Margin", "IBPrime"])
    tradingPermissions = List(valid=[
        "Stocks", "Options", "Mutual Funds", "Futures", "Forex", "Bonds",
        "CFDs", "IBG Notes", "Warrants", "US Treasury Bills",
        "Futures Options", "SSF", "Stock Loan", "Stock Borrow"
    ])
    dateOpened = Date()
    dateFunded = Date()
    dateClosed = Date()
    masterName = String()
    ibEntity = OneOf("IBLLC-US", "IB-UK", "IB-UKL", "IB-CAN", "IB-JP", "IB-IN")
Exemplo n.º 2
0
class TradeConfirmation(Schema, TradeMixin):
    """ Wrapped in <TradeConfirms> """
    buySell = OneOf("BUY", "BUY (Ca.)", "SELL", "SELL (Ca.)")
    levelOfDetail = OneOf("SYMBOL_SUMMARY", "ORDER", "EXECUTION")
    commissionCurrency = OneOf(*CURRENCY_CODES)
    price = Decimal()
    thirdPartyClearingCommission = Decimal()
    orderID = Decimal()
    allocatedTo = String()
    thirdPartyRegulatoryCommission = Decimal()
    dateTime = DateTime()
    brokerExecutionCommission = Decimal()
    thirdPartyExecutionCommission = Decimal()
    amount = Decimal()
    otherCommission = Decimal()
    commission = Decimal()
    brokerClearingCommission = Decimal()
    ibOrderID = String()
    ibExecID = String()
    execID = String()
    brokerageOrderID = String()
    orderReference = String()
    volatilityOrderLink = String()
    exchOrderId = String()
    extExecID = String()
    # Despite the name, orderTime actually contains both date & time data.
    orderTime = DateTime()
    changeInPrice = Decimal()
    changeInQuantity = Decimal()
    orderType = OneOf("LMT", "MKT", "MOC")
    traderID = String()
    isAPIOrder = Boolean()
Exemplo n.º 3
0
class StatementOfFundsLine(Schema, AccountMixin, SecurityMixin):
    """ Wrapped in <StmtFunds> """
    currency = OneOf(*CURRENCY_CODES)
    reportDate = Date()
    date = Date()
    activityDescription = String()
    tradeID = String()
    debit = Decimal()
    credit = Decimal()
    amount = Decimal()
    balance = Decimal()
    buySell = String()
Exemplo n.º 4
0
class DividendAccrualMixin(AccountMixin, CurrencyMixin, SecurityMixin):
    exDate = Date()
    payDate = Date()
    quantity = Decimal()
    tax = Decimal()
    fee = Decimal()
    grossRate = Decimal()
    grossAmount = Decimal()
    netAmount = Decimal()
    code = List()
    fromAcct = String()
    toAcct = String()
Exemplo n.º 5
0
class SLBActivity(Schema, AccountMixin, CurrencyMixin, SecurityMixin):
    """ Wrapped in <SLBActivities> """
    date = Date()
    slbTransactionId = String()
    activityDescription = String()
    type = OneOf("DirectBorrow", "DirectLoan", "ManagedLoan")
    exchange = String()
    quantity = Decimal()
    feeRate = Decimal()
    collateralAmount = Decimal()
    markQuantity = Decimal()
    markPriorPrice = Decimal()
    markCurrentPrice = Decimal()
Exemplo n.º 6
0
class TradeTransfer(Schema, TradeMixin):
    """ Wrapped in <TradeTransfers> """
    # Oddly, TradeTransfer uses YYYYMMDD format for origTradeDate
    # instead of ISO format like Trade
    origTradeDate = Date()
    brokerName = String()
    brokerAccount = String()
    awayBrokerCommission = Decimal()
    regulatoryFee = Decimal()
    direction = OneOf("To", "From")
    deliveredReceived = OneOf("Delivered", "Received")
    netTradeMoney = Decimal()
    netTradeMoneyInBase = Decimal()
    netTradePrice = Decimal()
Exemplo n.º 7
0
class CashTransaction(Schema, AccountMixin, CurrencyMixin, SecurityMixin):
    """ Wrapped in <CashTransactions> """
    # Despite the name, dateTime actually contains only the date.
    dateTime = Date()
    amount = Decimal()
    type = OneOf("Deposits/Withdrawals", "Broker Interest Paid",
                 "Broker Interest Received", "Withholding Tax",
                 "Bond Interest Received", "Bond Interest Paid", "Other Fees",
                 "Dividends", "Payment In Lieu Of Dividends")
    tradeID = String()
    code = List()
    transactionID = String()
    reportDate = Date()
    clientReference = String()
Exemplo n.º 8
0
class FxLot(Schema, AccountMixin):
    """ Wrapped in <FxLots> """
    assetCategory = String()
    reportDate = Date()
    functionalCurrency = OneOf(*CURRENCY_CODES)
    fxCurrency = OneOf(*CURRENCY_CODES)
    quantity = Decimal()
    costPrice = Decimal()
    costBasis = Decimal()
    closePrice = Decimal()
    value = Decimal()
    unrealizedPL = Decimal()
    code = List()
    lotDescription = String()
    lotOpenDateTime = DateTime()
    levelOfDetail = OneOf('LOT', 'SUMMARY')
Exemplo n.º 9
0
class MTMPerformanceSummaryUnderlying(Schema, AccountMixin, SecurityMixin):
    """ Wrapped in <MTMPerformanceSummaryInBase> """
    listingExchange = String()
    underlyingSecurityID = String()
    underlyingListingExchange = String()
    reportDate = Date()
    prevCloseQuantity = Decimal()
    prevClosePrice = Decimal()
    closeQuantity = Decimal()
    closePrice = Decimal()
    transactionMtm = Decimal()
    priorOpenMtm = Decimal()
    commissions = Decimal()
    other = Decimal()
    total = Decimal()
    code = List()
Exemplo n.º 10
0
class Transfer(Schema, AccountMixin, CurrencyMixin, SecurityMixin):
    """ Wrapped in <Transfers> """
    date = Date()
    type = OneOf("INTERNAL", "ACATS")
    direction = OneOf("IN", "OUT")
    company = String()
    account = String()
    accountName = String()
    quantity = Decimal()
    transferPrice = Decimal()
    positionAmount = Decimal()
    positionAmountInBase = Decimal()
    pnlAmount = Decimal()
    pnlAmountInBase = Decimal()
    fxPnl = Decimal()
    cashTransfer = Decimal()
    code = List()
    clientReference = String()
Exemplo n.º 11
0
class OpenPosition(Schema, AccountMixin, CurrencyMixin, SecurityMixin):
    """ Wrapped in <OpenPositions> """
    reportDate = Date()
    position = Decimal()
    markPrice = Decimal()
    positionValue = Decimal()
    openPrice = Decimal()
    costBasisPrice = Decimal()
    costBasisMoney = Decimal()
    percentOfNAV = Decimal()
    fifoPnlUnrealized = Decimal()
    side = OneOf('Long', 'Short')
    levelOfDetail = OneOf('LOT', 'SUMMARY')
    openDateTime = DateTime()
    holdingPeriodDateTime = DateTime()
    code = List()
    originatingOrderID = String()
    originatingTransactionID = String()
    accruedInt = String()
Exemplo n.º 12
0
class Trade(Schema, TradeMixin):
    """ Wrapped in <Trades> """
    buySell = OneOf("BUY", "BUY (Ca.)", "SELL", "SELL (Ca.)")
    ibOrderID = String()
    ibExecID = String()
    brokerageOrderID = String()
    orderReference = String()
    volatilityOrderLink = String()
    exchOrderId = String()
    extExecID = String()
    # Despite the name, orderTime actually contains both date & time data.
    orderTime = DateTime()
    changeInPrice = Decimal()
    changeInQuantity = Decimal()
    orderType = OneOf("LMT", "MKT")
    traderID = String()
    isAPIOrder = Boolean()
Exemplo n.º 13
0
class ChangeInPositionValue(Schema, AccountMixin):
    """ Wrapped in <ChangeInPositionValues> """
    currency = OneOf(*CURRENCY_CODES)
    assetCategory = String()
    priorPeriodValue = Decimal()
    transactions = Decimal()
    mtmPriorPeriodPositions = Decimal()
    mtmTransactions = Decimal()
    corporateActions = Decimal()
    other = Decimal()
    accountTransfers = Decimal()
    linkingAdjustments = Decimal()
    fxTranslationPnl = Decimal()
    futurePriceAdjustments = Decimal()
    settledCash = Decimal()
    endOfPeriodValue = Decimal()
Exemplo n.º 14
0
class OptionEAE(Schema, AccountMixin, CurrencyMixin, SecurityMixin):
    """
    Option Exercise, Assignment, or Expiration

    Wrapped in (identically-named) <OptionEAE>
    """
    date = Date()
    transactionType = OneOf("Assignment", "Exercise", "Expiration", "Sell")
    quantity = Decimal()
    tradePrice = Decimal()
    markPrice = Decimal()
    proceeds = Decimal()
    commisionsAndTax = Decimal()
    costBasis = Decimal()
    realizedPnl = Decimal()
    fxPnl = Decimal()
    mtmPnl = Decimal()
    tradeID = String()
Exemplo n.º 15
0
class TradeMixin(AccountMixin, CurrencyMixin, SecurityMixin):
    tradeID = String()
    reportDate = Date()
    tradeDate = Date()
    tradeTime = Time()
    settleDateTarget = Date()
    transactionType = OneOf("ExchTrade", "TradeCancel", "FracShare",
                            "FracShareCancel", "TradeCorrect", "BookTrade",
                            "DvpTrade")
    exchange = String()
    quantity = Decimal()
    tradePrice = Decimal()
    tradeMoney = Decimal()
    proceeds = Decimal()
    taxes = Decimal()
    ibCommission = Decimal()
    ibCommissionCurrency = OneOf(*CURRENCY_CODES)
    netCash = Decimal()
    closePrice = Decimal()
    openCloseIndicator = OneOf("O", "C", "C;O")
    notes = List(separator=';')
    cost = Decimal()
    fifoPnlRealized = Decimal()
    fxPnl = Decimal()
    mtmPnl = Decimal()
    origTradePrice = Decimal()
    origTradeDate = Date()
    origTradeID = String()
    origOrderID = String()
    clearingFirmID = String()
    transactionID = String()
    openDateTime = DateTime()
    holdingPeriodDateTime = DateTime()
    whenRealized = DateTime()
    whenReopened = DateTime()
    levelOfDetail = OneOf("EXECUTION", "ORDER", "CLOSED_LOT",
                          "TRADE_TRANSFERS")
Exemplo n.º 16
0
class SecurityMixin(object):
    assetCategory = String()
    symbol = String()
    description = String()
    conid = String()
    securityID = String()
    securityIDType = String()
    cusip = String()
    isin = String()
    underlyingConid = String()
    underlyingSymbol = String()
    issuer = String()
    multiplier = Decimal()
    strike = Decimal()
    expiry = Date()
    putCall = String()
    principalAdjustFactor = Decimal()
Exemplo n.º 17
0
class AccountMixin(object):
    accountId = String()
    acctAlias = String()
    model = String()
Exemplo n.º 18
0
class SecurityInfo(Schema, SecurityMixin):
    """ Wrapped in <SecuritiesInfo> """
    maturity = String()
    issueDate = Date()
    code = List()
    type = String()
Exemplo n.º 19
0
class FlexQueryResponse(Schema):
    """ Top-level element """
    queryName = String()
    type = String()
Exemplo n.º 20
0
class FlexStatement(Schema):
    accountId = String()
    fromDate = Date()
    toDate = Date()
    period = String()
    whenGenerated = DateTime()