Exemplo n.º 1
0
log = Logger('scanner')

msgs = queue.Queue()
wrapper = Wrapper({}, msgs)
connection = EClientSocket(wrapper)

host = "54.197.15.42"
port = 7496

connection.eConnect(host, port, 1)
subscription = ScannerSubscription()
subscription.numberOfRows(100)
subscription.instrument('STK')
subscription.locationCode('STK.US')
subscription.scanCode('TOP_PERC_GAIN')
subscription.abovePrice(1.0)
subscription.aboveVolume(1)
subscription.marketCapBelow(1000000000.0)

ticker_id = 10

log.operation('Requesting subscription')

connection.reqScannerSubscription(ticker_id, subscription)

while True:
    msg = msgs.get()
    if msg['type'] == 'scannerDataEnd':
        log.operation('Received end scanner data end signal')
        break
    elif msg['type'] == 'scannerData':