本文整理汇总了Python中models.Stock.PS方法的典型用法代码示例。如果您正苦于以下问题:Python Stock.PS方法的具体用法?Python Stock.PS怎么用?Python Stock.PS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Stock
的用法示例。
在下文中一共展示了Stock.PS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: import_data
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import PS [as 别名]
def import_data():
snapshot = Snapshot()
snapshot.snapshot = datetime.now()
snapshot.save()
print "Importing data from finviz"
r = requests.get('http://finviz.com/export.ashx?v=152', cookies={"screenerUrl": "screener.ashx?v=152&f=cap_smallover&ft=4", "customTable": "0,1,2,6,7,10,11,13,14,45,65"})
data = csv_to_dicts(r.text)
tickers = []
for row in data:
try:
stock = Stock()
stock.snapshot = snapshot
if row["Ticker"]:
stock.Ticker = row["Ticker"]
print stock.Ticker
tickers.append(stock.Ticker)
if "Importing " + row["Company"]:
stock.Company = row["Company"]
if row["Market Cap"]:
stock.MarketCap = row["Market Cap"]
if row["P/E"]:
stock.PE = row["P/E"]
if row["P/S"]:
stock.PS = row["P/S"]
if row["P/B"]:
stock.PB = row["P/B"]
if row["P/Free Cash Flow"]:
stock.PFreeCashFlow = row["P/Free Cash Flow"]
if row["Dividend Yield"]:
stock.DividendYield = row["Dividend Yield"][:-1]
if row["Performance (Half Year)"]:
stock.PerformanceHalfYear = row["Performance (Half Year)"][:-1]
if row["Price"]:
stock.Price = row["Price"]
stock.save()
except:
pdb.set_trace()
import_evebitda(snapshot)
import_buyback_yield(snapshot)