TuringTrader icon indicating copy to clipboard operation
TuringTrader copied to clipboard

asset.Monthly().Open and asset.Monthly().Close does not work the way you would think

Open mathewsk opened this issue 11 months ago • 1 comments

I found something strange in the TuringTrader.org. I am using the latest version, I am not sure if this is a bug in the API or a problem with my understanding. Whenever you have some time, if you would please let me know your thoughts, I would appreciate it!

var asset = Asset(ETF.SPY);

On SimDate of Jan 31, 2020, if I do asset.Monthly().Open[0] I get 309.3909221661874 asset.Monthly().Close[0] I get 304.40472412109375 I thought that using asset.Monthly().Open[0], I would get the opening price of the month January, 2020 (306.1172745036964) instead of 309.3909221661874

If I print the daily Open and Close each of the month of Jan, 2020 I get this

1-2-2020 daily open=306.1172745036964 daily close=307.3756408691406 1-3-2020 daily open=303.8654391035394 daily close=305.0481262207031 1-6-2020 daily open=303.2316099598491 daily close=306.2120056152344 1-7-2020 daily open=305.625314816108 daily close=305.3509521484375 1-8-2020 daily open=305.5496066207918 daily close=306.9783020019531 1-9-2020 daily open=308.59624078058306 daily close=309.0598449707031 1-10-2020 daily open=309.6653735147707 daily close=308.1704406738281 1-13-2020 daily open=308.81386449573563 daily close=310.28985595703125 1-14-2020 daily open=309.8357155822098 daily close=309.8168029785156 1-15-2020 daily open=309.7220834882384 daily close=310.516845703125 1-16-2020 daily open=311.9456106028352 daily close=313.09991455078125 1-17-2020 daily open=313.83783393783926 daily close=314.0743713378906 1-21-2020 daily open=313.080927001925 daily close=313.4593811035156 1-22-2020 daily open=314.3488436155879 daily close=313.497314453125 1-23-2020 daily open=312.8254812932716 daily close=313.8567810058594 1-24-2020 daily open=314.5380256021345 daily close=311.0656433105469 1-27-2020 daily open=305.6347152551311 daily close=306.07940673828125 1-28-2020 daily open=307.5554559419741 daily close=309.28692626953125 1-29-2020 daily open=310.6966045755457 daily close=309.0313720703125 1-30-2020 daily open=306.8931082857648 daily close=310.0343322753906 1-31-2020 daily open=309.3909221661874 daily close=304.40472412109375

mathewsk avatar Jul 18 '23 01:07 mathewsk