コード例 #1
0
def get_option_data(symbol, year, month,i):
    myPrice = float(yahoostock.get_price(symbol))
    myArray = yahoostock._option_data(symbol,year,month);
    myRetArray = get_relevant_data(myPrice,myArray,i)
    for ix1 in myRetArray:
        price = ix1['price']
        quote = ix1['quote']
        returnPct = (quote/myPrice) * 100 
        print '    %4s   %-6.2f   %-6.2f    %-6.2f    %-2.2f' % (symbol,myPrice,price,quote, returnPct)
コード例 #2
0
def get_option_data(symbol, year, month, i):
    myPrice = float(yahoostock.get_price(symbol))
    myArray = yahoostock._option_data(symbol, year, month)
    myRetArray = get_relevant_data(myPrice, myArray, i)
    for ix1 in myRetArray:
        price = ix1['price']
        quote = ix1['quote']
        returnPct = (quote / myPrice) * 100
        print '    %4s   %-6.2f   %-6.2f    %-6.2f    %-2.2f' % (
            symbol, myPrice, price, quote, returnPct)
コード例 #3
0
ファイル: option_prices_cls.py プロジェクト: tarakparikh/sma
def get_option_data(symbol, myPrice, mySma, safetyGoal, profitGoal, year, month):
    toRet = []
    myOpt = option_class(symbol,myPrice,mySma,safetyGoal,profitGoal);
    myArray = yahoostock._option_data(symbol,year,month);
    myRetArray = myOpt._get_relevant_data(myArray)
 
    for ix1 in myRetArray:
        symbol = ix1['symbol']
        myPrice = ix1['myPrice']
        opt_type = ix1['opt_type']
        opt_price = ix1['opt_price']
        opt_quote = ix1['opt_quote']
        opt_sp = ix1['opt_sp']
        opt_pp = ix1['opt_pp']
	print '    %4s   %s   %-6.2f   %-6.2f    %-6.2f    %-3.2f  %-3.2f' % (symbol,opt_type,myPrice,opt_price,opt_quote, opt_sp, opt_pp)

    return myRetArray
コード例 #4
0
ファイル: option_prices_cls.py プロジェクト: tarakparikh/sma
def get_option_data(symbol, myPrice, mySma, safetyGoal, profitGoal, year,
                    month):
    toRet = []
    myOpt = option_class(symbol, myPrice, mySma, safetyGoal, profitGoal)
    myArray = yahoostock._option_data(symbol, year, month)
    myRetArray = myOpt._get_relevant_data(myArray)

    for ix1 in myRetArray:
        symbol = ix1['symbol']
        myPrice = ix1['myPrice']
        opt_type = ix1['opt_type']
        opt_price = ix1['opt_price']
        opt_quote = ix1['opt_quote']
        opt_sp = ix1['opt_sp']
        opt_pp = ix1['opt_pp']
        print '    %4s   %s   %-6.2f   %-6.2f    %-6.2f    %-3.2f  %-3.2f' % (
            symbol, opt_type, myPrice, opt_price, opt_quote, opt_sp, opt_pp)

    return myRetArray
コード例 #5
0
ファイル: get_option_prices.py プロジェクト: tarakparikh/sma
def get_option_data(symbol, year, month,i):
    toRet = []
    myPrice = float(yahoostock.get_price(symbol))
    myArray = yahoostock._option_data(symbol,year,month);
    #print symbol
    myRetArray = get_relevant_data(myPrice,myArray,i)
    for ix1 in myRetArray:
        ret_tuple = {}
        price = ix1['price']
        quote = ix1['quote']
        returnPct = (quote/price) * 100 
        ret_tuple['symbol'] = symbol;
        ret_tuple['myPrice'] = myPrice;
        ret_tuple['price'] = price;
        ret_tuple['quote'] = quote;
        ret_tuple['returnPct'] = returnPct;
        cumRet = int(100 * returnPct * ((myPrice - price)/myPrice*100))
        ret_tuple['cumRet'] = cumRet;
        toRet.append(ret_tuple)
#print '    %4s   %-6.2f   %-6.2f    %-6.2f    %-2.2f' % (symbol,myPrice,price,quote, returnPct)
    return toRet
コード例 #6
0
ファイル: get_option_prices.py プロジェクト: tarakparikh/sma
def get_option_data(symbol, year, month, i):
    toRet = []
    myPrice = float(yahoostock.get_price(symbol))
    myArray = yahoostock._option_data(symbol, year, month)
    #print symbol
    myRetArray = get_relevant_data(myPrice, myArray, i)
    for ix1 in myRetArray:
        ret_tuple = {}
        price = ix1['price']
        quote = ix1['quote']
        returnPct = (quote / price) * 100
        ret_tuple['symbol'] = symbol
        ret_tuple['myPrice'] = myPrice
        ret_tuple['price'] = price
        ret_tuple['quote'] = quote
        ret_tuple['returnPct'] = returnPct
        cumRet = int(100 * returnPct * ((myPrice - price) / myPrice * 100))
        ret_tuple['cumRet'] = cumRet
        toRet.append(ret_tuple)


#print '    %4s   %-6.2f   %-6.2f    %-6.2f    %-2.2f' % (symbol,myPrice,price,quote, returnPct)
    return toRet