<s> '''<STR_LIT>''' <EOL> from ib . ext . Contract import Contract <EOL> from ib . ext . Order import Order <EOL> priceTicks = { <NUM_LIT:1> : '<STR_LIT>' , <NUM_LIT:2> : '<STR_LIT>' , <NUM_LIT:4> : '<STR_LIT>' , <NUM_LIT:6> : '<STR_LIT>' , <NUM_LIT:7> : '<STR_LIT>' , <NUM_LIT:9> : '<STR_LIT>' , <NUM_LIT> : '<STR_LIT>' } <EOL> timeFormat = "<STR_LIT>" <EOL> dateFormat = "<STR_LIT>" <EOL> def createContract ( symbol , secType = '<STR_LIT>' , exchange = '<STR_LIT>' , currency = '<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> c = Contract ( ) <EOL> c . m_symbol = symbol <EOL> c . m_secType = secType <EOL> c . m_exchange = exchange <EOL> c . m_currency = currency <EOL> return c <EOL> def createOrder ( orderId , shares , orderType = '<STR_LIT>' , limit = None , transmit = <NUM_LIT:0> ) : <EOL> '''<STR_LIT>''' <EOL> action = { - <NUM_LIT:1> : '<STR_LIT>' , <NUM_LIT:1> : '<STR_LIT>' } <EOL> o = Order ( ) <EOL> o . m_orderId = orderId <EOL> o . m_action = action [ cmp ( shares , <NUM_LIT:0> ) ] <EOL> o . m_totalQuantity = abs ( shares ) <EOL> o . m_transmit = transmit <EOL> o . m_orderType = orderType <EOL> if limit is not None : <EOL> o . m_lmtPrice = limit <EOL> return o </s>
