Beispiel #1
0
    def HottestPennyStocks():
        """
        Subscribe to US stocks 1 < price < 10 and vol > 1M.
        Scan code = TOP_PERC_GAIN
        """
        scanSub = ScannerSubscription()
        scanSub.instrument = "STK"
        scanSub.locationCode = "STK.US"
        scanSub.scanCode = "TOP_PERC_GAIN"
        scanSub.abovePrice = 2
        scanSub.belowPrice = 50
        scanSub.aboveVolume = 1000000

        return scanSub
Beispiel #2
0
def assemble_stock_list(client, sentiment):
    ''' Use scanner to obtain stock list '''

    # Define scanner subscription
    ss = ScannerSubscription()
    ss.instrument = 'STK'
    ss.locationCode = 'STK.US.MAJOR'
    ss.abovePrice = 10.0
    ss.belowPrice = client.funds / 200.0
    ss.aboveVolume = 20000
    ss.numberOfRows = 5

    # Set scan code according to sentiment
    if sentiment == Sentiment.BULLISH:
        ss.scanCode = 'HIGH_VS_13W_HL'
    else:
        ss.scanCode = 'LOW_VS_13W_HL'

    # Request securities
    client.reqScannerSubscription(4, ss, [], [])
    time.sleep(3)