1

我可以使用以下命令检索给定日期的汇率:

=GoogleFinance("audusd","price","09/15/2015")

但是,如果当天市场关闭,则GoogleFinance返回“N/A”:

=GoogleFinance("audusd","price","11/19/2015")

即使市场关闭,我如何让 GoogleFinance 为我提供价格?

4

1 回答 1

0

我根据 UTC 时间使用了以下解决方案:

import datetime as dt

nowUTC = dt.datetime.utcnow()                  
    today14= nowUTC.replace(hour=14, minute=25, second=0, microsecond=0)
    today21= nowUTC.replace(hour=21, minute=5, second=0, microsecond=0)

if (nowUTC >= today21 or today14 >= nowUTC):

此解决方案基于市场关闭的时间:

http://www.wisestockbuyer.com/2012/05/what-time-do-stock-markets-open-and-close/

于 2017-03-01T21:21:38.970 回答