def notice_cdp_strong(stock, id, cdp):
    global big_vol_price
    global big_vol_times
    global big_vol_time
    url = 'https://tw.stock.yahoo.com/q/bc?s=***'
    url = url.replace('***', id)
    msg = '%s\n%s\n%s在%.02f塊出量%.02f倍\n%s' % (
        stock, url, big_vol_time, big_vol_price, big_vol_times, str(cdp))
    gfunction.send_email('下跌出量', msg, test_group)
Exemple #2
0
def main():
    while True:
        list = read_test_list()
        print('模擬交易系統')
        direction = input("(1)多(2)空(3)CDP:")
        if(direction == '3'):
            stock = input("輸入股票:")
            cdp_5price = techindicators.cdp(stock)
            ah = float(cdp_5price[0])
            nh = float(cdp_5price[1])
            cdp = float(cdp_5price[2])
            nl = float(cdp_5price[3])
            al = float(cdp_5price[4])
            print('-----------ah %.02f------------'%(ah))
            print('-----------nh %.02f------------'%(nh))
            print('-----------cdp %.02f------------'%(cdp))
            print('-----------nl %.02f------------'%(nl))
            print('-----------al %.02f------------'%(al))


        elif(direction == '1' or direction == '2'):
            type = input("(1)買(2)賣:")
            stock = input("輸入股票:")
            if(type == '1'):
                price = input("輸入交易價位:")
                add_stock(list, stock, price, direction)
                if(direction == '1'):
                    profit_price = float(price)*(1 + profit/100)
                    title = '買入%s於%s塊,建議%.02f塊賣出'%(stock, price, float(profit_price))
                elif(direction == '2'):
                    profit_price = float(price)*(1 - profit/100)
                    title = '放空%s於%s塊,建議%.02f塊回補'%(stock, price, float(profit_price))

                gfunction.send_email(title, '', test_group1)
                print('建議賣價=%.02f'%(profit_price))
            elif(type == '2'):
                #record_profit(stock, price, direction)
                delete_stock(stock)


        print('交易成功')
        time.sleep(2)
def notice_cdp_weak(stock, id, cdp):
    url = 'https://tw.stock.yahoo.com/q/bc?s=***'
    url = url.replace('***', id)
    msg = '%s\n%s\n%s' % (stock, url, str(cdp))
    gfunction.send_email('CDP轉弱', msg, test_group)
def notice_stop_loss(id):
    gfunction.send_email('停損通知', id, test_group)
def notice_rebound_fail(id):
    gfunction.send_email('跌破AL轉空', id, test_group1)
def notice_break_high(stock, id, cdp):
    url = 'https://tw.stock.yahoo.com/q/bc?s=***'
    url = url.replace('***', id)
    msg = '%s\n%s\n%s' % (stock, url, str(cdp))
    gfunction.send_email('開盤強勢回檔中,突破開盤價可買進', msg, test_group)
def notice_become_red(id):
    gfunction.send_email('由黑翻紅', id, test_group1)