本文整理汇总了Python中models.Stock.all方法的典型用法代码示例。如果您正苦于以下问题:Python Stock.all方法的具体用法?Python Stock.all怎么用?Python Stock.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Stock
的用法示例。
在下文中一共展示了Stock.all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_stocks_in_day
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import all [as 别名]
def get_stocks_in_day(stock_name, day):
out = []
markets = Market.all(keys_only=False).filter("date =", day).filter("ref =", stock_name.market_ref).order('time').fetch(100)
for market in markets:
stock = Stock.all().filter("market =", market.key()).filter('name = ', stock_name.key()).get()
if not stock is None:
dt = datetime.combine(market.date, market.time)
out.append((dt, stock, market.exchange_rate))
return out
示例2: get_stocks_days
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import all [as 别名]
def get_stocks_days(stock_name, num_days=10):
days = last_weekdays(num_days)
out = []
for day in days:
market = Market.all(keys_only=False).filter("date =", day.date()).filter("ref =", stock_name.market_ref).order('-time').get()
if not market is None:
stock = Stock.all().filter("market =", market.key()).filter('name = ', stock_name.key()).get()
if not stock is None:
out.append((day, stock, market.exchange_rate))
return out
示例3: clean_market
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import all [as 别名]
def clean_market(ref, date=None):
market = get_market(ref, date, keys_only=True)
if market:
db.delete(Stock.all(keys_only=True).filter("market =", market).fetch(1000))
db.delete(market)
示例4: get_stock
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import all [as 别名]
def get_stock(stock_name, date=None):
market = get_market(stock_name.market_ref, date, keys_only=True)
return Stock.all().filter("market =", market).filter('name = ', stock_name.key()).get()