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


Python Book.bid方法代码示例

本文整理汇总了Python中book.Book.bid方法的典型用法代码示例。如果您正苦于以下问题:Python Book.bid方法的具体用法?Python Book.bid怎么用?Python Book.bid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在book.Book的用法示例。


在下文中一共展示了Book.bid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: len

# 需要导入模块: from book import Book [as 别名]
# 或者: from book.Book import bid [as 别名]
#!/usr/bin/python

import sys

from book import Book

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print "usage: %s input.csv" % sys.argv[0]
        sys.exit(0)
    try:
        reader = open(sys.argv[1], 'r')
        quotebook = Book()
        for line in reader:
            if line[0] == 'B':
                quotebook.bid(line.rstrip())
            elif line[0] == 'A':
                quotebook.ask(line.rstrip())
            else:
                quotebook.trade(line.rstrip())

            # Manual Debugging
            print "\n"
            print "Input: " + line
            print quotebook
            raw_input("Press enter to continue.")
        reader.close()
    except IOError:
        print 'Cannot open input file "%s"' % sys.argv[1]
        sys.exit(1)
开发者ID:hedgefair,项目名称:PyLimitBook,代码行数:32,代码来源:parse.py

示例2: len

# 需要导入模块: from book import Book [as 别名]
# 或者: from book.Book import bid [as 别名]
        ask = b.ask()
        if   bid is None and ask is None: mark = oldMark if oldMark is not None else 50
        elif bid is None                : mark = ask
        elif ask is None                : mark = bid
        else                            : mark = (bid+ask)/2.0

        if mark != oldMark:
            pnlEvents.append(("M", game.gameId, time.time(), "", "", "", "", mark))
            oldMark = mark

        ## responses for gateways
        for e in gatewayEvents:
            gateways.sendToOwner(e)

        ## feed handler
        if len(events):
            msg = ";".join(str(e) for e in events)
            f.send(msg)
            if debugFeedBook:
                log.info("FB MESSAGE:" + msg)
                fb.processMessage(msg)

        ## now check that the local book and reconstructed book look the same
        if debugFeedBook:
            x = str(b ).split("\n")
            y = str(fb).split("\n")
            assert len(x) == len(y)
            z = "\n".join(xx + "  " + (" " if xx == yy else "X") + "   " + yy for xx,yy in zip(x,y))
            log.info("Book:\n"+z)
            assert x == y or (fb.bid() is None and fb.ask() is None)
开发者ID:mschubmehl,项目名称:chesschallenge,代码行数:32,代码来源:me.py


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