GoogleFinanceQuoteAdapter.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:paperbroker 作者: philipodonnell 项目源码 文件源码
def get_options(self, underlying_asset=None, expiration_date=None):
        oc = OptionChain('NASDAQ:' + asset_factory(underlying_asset).symbol)
        underlying_quote = self.get_quote(underlying_asset)

        out = []
        for option in (oc.calls + oc.puts):
            if arrow.get(expiration_date).format('YYMMDD') in option['s']:
                quote = OptionQuote(quote_date=arrow.now().format('YYYY-MM-DD'),
                                asset=option['s'],
                                bid=float(option['b']) if option['b'] != '-' else None,
                                ask=float(option['a']) if option['a'] != '-' else None,
                                underlying_price = underlying_quote.price)
                self._set_cache(quote)
                out.append(quote)

        return out





# the code below is from https://github.com/makmac213/python-google-option-chain
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号