示例#1
0
def main():
    
    stock = Stock('2330')                             # 擷取
    ma_p = stock.moving_average(stock.price, 5)       # 計算五日均價
    strma_p=str(ma_p)
    ma_c = stock.moving_average(stock.capacity, 5)    # 計算五日均量
    strma_c=str(ma_c)
    ma_p_cont = stock.continuous(ma_p)                # 計算五日均價持續天數
    strma_p_cont=str(ma_p_cont)
    ma_br = stock.ma_bias_ratio(5, 10)                # 計算五日、十日乖離值
    strma_br=str(ma_br)
    
    print ("計算五日均價", strma_p)
    print ("計算五日均量", strma_c)
    print ("計算五日均價持續天數", strma_p_cont)
    print ("計算五日、十日乖離值", strma_br)
示例#2
0
# import pandas as pd
# data = pd.read_csv("./stock_list.csv")
# stockNumberList =  data['id']
# print(stockNumberList[3])

# exit()

from StockFunction import getStockList

stockList = getStockList()

exit()

from twstock import Stock

stock = Stock('2330')  # 擷取台積電股價
ma_p = stock.moving_average(stock.price, 5)  # 計算五日均價
ma_c = stock.moving_average(stock.capacity, 1)  # 計算五日均量
ma_p_cont = stock.continuous(ma_p)  # 計算五日均價持續天數
ma_br = stock.ma_bias_ratio(5, 10)  # 計算五日、十日乖離值

# print(stock.data[-1])
print(ma_c)

exit()

from testHello import sample_func
sample_func()

exit()