Exemplo n.º 1
0
def create_contract(security):
    contract = IBCpp.Contract()
    contract.symbol = security.symbol
    contract.secType = security.secType
    contract.exchange = security.exchange
    contract.currency = security.currency       
    contract.primaryExchange = security.primaryExchange
    contract.includeExpired=security.includeExpired      
    contract.expiry= security.expiry 
    contract.strike= float(security.strike)
    contract.right= security.right
    contract.multiplier= security.multiplier
    return contract 
Exemplo n.º 2
0
    # print (a.exchange)

    ########
    '''
    c=ContextClass(('aaa','bbb'))
    print (c.portfolio['aaa'].positions)
    c.portfolio['aaa'].positions['aa']=1
    print (c.portfolio['aaa'].positions)
    print (c.portfolio['bbb'].positions)
    '''
    ########
    # a=LimitOrder(2355.0)
    # print (a.__dict__)

    #######
    # print (search_security_in_file('STK', 'XIV', 'exchange'))

    ######
    # c = Positions()
    ##c['a'] = 1
    # print(c['b'])

    a_contract = IBCpp.Contract()
    a_contract.secType = 'OPT'
    a_contract.symbol = 'ES'
    a_contract.exchange = 'test'
    a_contract.primaryExchange = 'test'
    a_contract.currency = 'USD'
    a_contract.expiry = '20180726'
    print(from_contract_to_security(a_contract).full_print())