当前位置: 首页>>代码示例>>Python>>正文


Python Stock.all方法代码示例

本文整理汇总了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
开发者ID:fabiomdiniz,项目名称:verdandi,代码行数:11,代码来源:util.py

示例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
开发者ID:fabiomdiniz,项目名称:verdandi,代码行数:12,代码来源:util.py

示例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)
开发者ID:fabiomdiniz,项目名称:verdandi,代码行数:7,代码来源:util.py

示例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()
开发者ID:fabiomdiniz,项目名称:verdandi,代码行数:5,代码来源:util.py


注:本文中的models.Stock.all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。