示例#1
0
文件: go.py 项目: moronbros/f5go
    def index(self, **kwargs):
        self.redirectIfNotFullHostname()

        if "keyword" in kwargs:
            return self.redirect("/" + kwargs["keyword"])

        return env.get_template('index.html').render(now=tools.today())
示例#2
0
文件: core.py 项目: moronbros/f5go
    def clicked(self, n=1):
        todayord = tools.today()
        if todayord not in self.clickData:
            # partition clickdata around 30 days ago
            archival = []
            recent = []
            for od, nclicks in self.clickData.items():
                if todayord - 30 > od:
                    archival.append((od, nclicks))
                else:
                    recent.append((od, nclicks))

            # archive older samples
            if archival:
                self.archivedClicks += sum(nclicks for od, nclicks in archival)

            # recent will have at least one sample if it was ever clicked
            recent.append((todayord, n))
            self.clickData = dict(recent)
        else:
            self.clickData[todayord] += n
示例#3
0
def getOptionChainsInDteRange(underlying, lowerDte, higherDte):
    currentDay = today()
    return getOptionChainsInDateRange(underlying,
                                      currentDay+timedelta(days=lowerDte),
                                      currentDay+timedelta(days=higherDte))
示例#4
0
def _dte(expiration):
    return _timeDeltaInDays(today(), expiration)