Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
iamWing committed Mar 14, 2021
2 parents 37a4f81 + d5e420b commit 11780c3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v1.0.3] - 2021-03-14
Hotfix `IBBridge.req_historical_ticks`.

### Fixed
- Issue of end time specified for `IBBridge.req_historical_ticks` get ignored
when fetching expired futures contract.

## [v1.0.2] - 2021-03-09
Minor release focuses on bug fixes.

Expand Down Expand Up @@ -192,7 +199,8 @@ returns with `finished` mark as `True` unexpectedly while IB returns less than
1000 records but there're more historical ticks those should be fetched
in next request.

[Unreleased]: https://github.com/Devtography/ibpy_native/compare/v1.0.2...HEAD
[Unreleased]: https://github.com/Devtography/ibpy_native/compare/v1.0.3...HEAD
[v1.0.3]: https://github.com/Devtography/ibpy_native/compare/v1.0.3...v1.0.2
[v1.0.2]: https://github.com/Devtography/ibpy_native/compare/v1.0.2...v1.0.1
[v1.0.1]: https://github.com/Devtography/ibpy_native/compare/v1.0.1...v1.0.0
[v1.0.0]: https://github.com/Devtography/ibpy_native/compare/v1.0.0...v0.2.0
Expand Down
11 changes: 9 additions & 2 deletions ibpy_native/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,13 @@ async def req_historical_ticks(

start_date_time = (head_time if start is None or head_time > start
else start)
end_date_time = datetime.datetime.now() if end is None else end
end_date_time = (datetime.datetime.now()
.astimezone(_global.TZ)
.replace(tzinfo=None))

if end is not None:
if end < end_date_time:
end_date_time = end

# Request tick data
finished = False
Expand Down Expand Up @@ -481,7 +487,8 @@ async def req_historical_ticks(

if start_date_time is not None:
if (_global.TZ.localize(start_date_time)
>= datetime.datetime.now().astimezone(_global.TZ)):
>= datetime.datetime.now().astimezone(_global.TZ)
or start_date_time >= end_date_time):
# Indicates all ticks up until now are received
finished = True
start_date_time = None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version="1.0.2", # Required
version="1.0.3", # Required
# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
# https://packaging.python.org/specifications/core-metadata/#summary
Expand Down

0 comments on commit 11780c3

Please sign in to comment.