Esempio n. 1
0
File: dkx.py Progetto: dxcv/qqqhhh
def jiaocha(df):
    rows_index = range(df.shape[0])
    rates = []
    hold = 0
    金叉日期 = []
    死叉日期 = []
    for i in rows_index:
        if i == 0:
            continue
        if df.ix[i, 'dkx金叉'] != None and hold == 0:
            #if df.ix[i, 'macd金叉'] != None and hold==0:
            buy = df.ix[i, 'dkx金叉']
            hold = 1
            金叉日期.append(df.ix[i, 'date'])
        #else:
        #    buy = df.ix[i-1, 'macd金叉']

        if df.ix[i, 'dkx死叉'] != None and hold == 1:
            rates.append(df.ix[i, 'dkx死叉'] / buy)
            hold = 0
            死叉日期.append(df.ix[i, 'date'])

    #print(金叉日期)
    #print(死叉日期)
    result(df, rates)
Esempio n. 2
0
File: dkx.py Progetto: dxcv/qqqhhh
def xielv_b_reversed(df):

    print('--------------------b_reversed-----------------')
    rows_index = range(df.shape[0])
    rates = []
    hold = 0
    for i in rows_index:
        if i == 0:
            continue
        if df.ix[i, 'd向下'] != None and hold == 0:
            buy = df.ix[i, 'd向下']
            hold = 1

        if df.ix[i, 'b向上'] != None and hold == 1:
            rates.append(df.ix[i, 'b向上'] / buy)
            hold = 0
    result(df, rates)
Esempio n. 3
0
File: dkx.py Progetto: dxcv/qqqhhh
def xielv_bd(df):
    print('--------------------bd-----------------')
    rows_index = range(df.shape[0])
    rates = []
    hold = 0
    for i in rows_index:
        if i == 0:
            continue
        if df.ix[i, 'b向上'] != None and hold == 0:
            buy = df.ix[i, 'b向上']
            hold = 1
        #else:
        #    buy = df.ix[i-1, 'macd金叉']

        if df.ix[i, 'd向下'] != None and hold == 1:
            rates.append(df.ix[i, 'd向下'] / buy)
            hold = 0
    result(df, rates)
Esempio n. 4
0
File: dkx.py Progetto: dxcv/qqqhhh
def xielv_b(df):
    print('--------------------bb-----------------')
    rows_index = range(df.shape[0])
    rates = []
    hold = 0
    买入日期 = []
    卖出日期 = []
    for i in rows_index:
        if i == 0:
            continue
        if df.ix[i, 'b向上'] != None and hold == 0:
            buy = df.ix[i, 'b向上']
            hold = 1
            买入日期.append(df.ix[i, 'date'])

        if df.ix[i, 'b向下'] != None and hold == 1:
            rates.append(df.ix[i, 'b向下'] / buy)
            hold = 0
            卖出日期.append(df.ix[i, 'date'])
    #print(买入日期)
    #print(卖出日期)
    result(df, rates)
Esempio n. 5
0
        return True


### Test ###

testrunner = KLLTestRunner([
    SimpleLayerTest(),
])
testrunner.run()

# Tally test results
pass_tests(len(testrunner.passed()))
fail_tests(len(testrunner.failed()))

result()

sys.exit(0)
print("-- 1 key test --")

# Drop to cli, type exit in the displayed terminal to continue
#i.control.cli()

# Read current keyboard state
print(data.usb_keyboard())

# Press key 0x00
i.control.cmd('addScanCode')(0x01)

# Run processing loop twice, needs to run twice in order to reach the Hold state
i.control.loop(2)
Esempio n. 6
0
i.control.loop(1)
print( data.usb_keyboard() )
print( " Triggers", data.trigger_list_buffer() )
print( " TPending", data.pending_trigger_list() )
check( len( data.pending_trigger_list() ) == 0 )



# Release keys
i.control.cmd('removeScanCode')( 0x01 )
i.control.cmd('removeScanCode')( 0x06 )
i.control.cmd('removeScanCode')( 0x04 )
i.control.cmd('removeScanCode')( 0x05 ) # Extra key (purposefully not pressed earlier to simulate bug)

# Run processing loop
print("Release State")
i.control.loop(1)
print( data.usb_keyboard() )


### Combo Test ###

print("-- 2 key combo test --")
# TODO
# - Combo
# - Delayed combo
# - Sequence

result()