【发布时间】:2022-01-08 22:14:59
【问题描述】:
我无法弄清楚这个系列的实际公式或名称是什么:
3 : 5; 4:10; 5:15;等等。
代码如下:
i = 4
n = 2
while i <= granularity and i != 3:
if (i == granularity):
return 5 * n
n += 1
i += 1
return 5
这里是我用来解决这个系列的更多代码:
def getChartData(self, sym, timescale="last_day", intraday="Y", granularity="3", ytdate="False", extdhrs="n"):
dateMin = ""
dateMax = ""
alt = "hi" if timescale == "last_hi" else "lo" if timescale == "last_lo" else "cl" if timescale == "last_cl" else ""
href = ""
content = ""
sorted_content = {}
def granFac():
gran = int(granularity)
i = 4
n = 2
while i <= gran and i != 3:
if (i == gran):
return (dt.now() - td(minutes=(5 * n))).strftime("%Y/%m/%d-%H:%M:%S")
n += 1
i += 1
return (dt.now() - td(minutes=5)).strftime("%Y/%m/%d-%H:%M:%S")
【问题讨论】:
-
能贴出完整的代码sn-p吗?
-
这听起来像是一道作业题。这些很好,但就像非家庭作业问题一样,请展示你尝试了什么以及你是如何陷入困境的(以便答案对你的学习真正有用)
-
抱歉,与 numpy 无关,只是认为这些用户会喜欢这类问题。这不是家庭作业,我只是在开发一些图表软件。我已经解决了我或多或少想探索其背后数学的代码。
-
"3 = 5"?这在 Python 中没有任何意义,在数学中也没有多大意义。也许你的意思是
3的输入返回5,比如f(3) = 5?无论如何,Stack Overflow 是关于编程,而不是数学,那么你的编程问题是什么?如果你真的想问数学,有Mathematics。 -
谢谢,你帮了大忙!一个函数,其增量范围从 3 开始,带有 { 5 |领域}。 varsitytutors.com/hotmath/hotmath_help/topics/domain-and-range
标签: python algorithm function math series