如何在日期市场上获得与GoogleFinance的汇率关闭

时间:2016-01-27 12:17:59

标签: google-finance google-finance-api

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

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

然而,如果当天市场关闭,则GoogleFinance返回" N / A":

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

即使市场关闭,我如何让GoogleFinance为我付出代价?

1 个答案:

答案 0 :(得分: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/