alpacahq / alpacahq/pylivetrader

data.history() pulls incorrect minute time frame data if data lookback extends past current day's open.

Open
#258 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
685
Forks
198
PR merge metrics
No merged PRs in 30d

Description

For example, when pulling 745 minutes of previous data and the current date is 2022-09-09 at 11:10am, the latest price claims to be at 2022-09-08 12:42:00. The believe the latest minute price should be at 2022-09-09 at 11:09am. Here is the example from running the function in a shell and getting incorrect output.

```
In [31]: datetime.now()
Out[31]: datetime.datetime(2022, 9, 9, 11, 10, 20, 428901)
In [32]: data.history(symbol("HYRE"), 'price', 745, '1m')[-45:-1]
Out[32]:
2022-09-08 11:59:00-04:00 1.2900
2022-09-08 12:00:00-04:00 1.3000
2022-09-08 12:01:00-04:00 1.3000
2022-09-08 12:02:00-04:00 1.3000
2022-09-08 12:03:00-04:00 1.2960
2022-09-08 12:04:00-04:00 1.2950
2022-09-08 12:05:00-04:00 1.2950
2022-09-08 12:06:00-04:00 1.2952
2022-09-08 12:07:00-04:00 1.2902
2022-09-08 12:08:00-04:00 1.3000
2022-09-08 12:09:00-04:00 1.2950
2022-09-08 12:10:00-04:00 1.2950
2022-09-08 12:11:00-04:00 1.2906
2022-09-08 12:12:00-04:00 1.2900
2022-09-08 12:13:00-04:00 1.2900
2022-09-08 12:14:00-04:00 1.2950
2022-09-08 12:15:00-04:00 1.2950
2022-09-08 12:16:00-04:00 1.3000
2022-09-08 12:17:00-04:00 1.2969
2022-09-08 12:18:00-04:00 1.2999
2022-09-08 12:19:00-04:00 1.3000
2022-09-08 12:20:00-04:00 1.3000
2022-09-08 12:21:00-04:00 1.2850
2022-09-08 12:22:00-04:00 1.2844
2022-09-08 12:23:00-04:00 1.2802
2022-09-08 12:24:00-04:00 1.2850
2022-09-08 12:25:00-04:00 1.2900
2022-09-08 12:26:00-04:00 1.2850
2022-09-08 12:27:00-04:00 1.3000
2022-09-08 12:28:00-04:00 1.2994
2022-09-08 12:29:00-04:00 1.3000
2022-09-08 12:30:00-04:00 1.3000
2022-09-08 12:31:00-04:00 1.2999
2022-09-08 12:32:00-04:00 1.3000
2022-09-08 12:33:00-04:00 1.3100
2022-09-08 12:34:00-04:00 1.3150
2022-09-08 12:35:00-04:00 1.3150
2022-09-08 12:36:00-04:00 1.3100
2022-09-08 12:37:00-04:00 1.3007
2022-09-08 12:38:00-04:00 1.3050
2022-09-08 12:39:00-04:00 1.3005
2022-09-08 12:40:00-04:00 1.3100
2022-09-08 12:41:00-04:00 1.3058
2022-09-08 12:42:00-04:00 1.3000
Name: Equity(514b879a-7d3b-41ac-a5e5-c7f468175be2 [HYRE]), dtype: float64
```

Any help is appreciated, thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.