From b25233b4cf451da8e2d1c0606c253222823483cb Mon Sep 17 00:00:00 2001 From: Nisayo Date: Sun, 19 May 2024 18:50:21 +0200 Subject: [PATCH 1/3] Update client.py Temporal fix for the bug that leads to endless loop at end of day when downloading tick-level historical data from Interactive Brokers. --- .../adapters/interactive_brokers/historic/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nautilus_trader/adapters/interactive_brokers/historic/client.py b/nautilus_trader/adapters/interactive_brokers/historic/client.py index 98d370e7aeb8..93b39425a1a8 100644 --- a/nautilus_trader/adapters/interactive_brokers/historic/client.py +++ b/nautilus_trader/adapters/interactive_brokers/historic/client.py @@ -429,7 +429,8 @@ def _handle_timestamp_iteration( if min_timestamp.floor("S") == max_timestamp.floor("S"): max_timestamp = max_timestamp.floor("S") + pd.Timedelta(seconds=1) - + if len(ticks)<=50: + max_timestamp = max_timestamp.floor("S") + pd.Timedelta(minutes=1) if max_timestamp >= end_date_time: return None, False From 6de202c9d52160158c89b8ecfde11c2202261657 Mon Sep 17 00:00:00 2001 From: Nisayo Date: Sun, 19 May 2024 20:51:49 +0200 Subject: [PATCH 2/3] Create pre-commit.yml Adding pre-commit action so that pre-commit on github possible. No need to pre-commit on local maschine. --- .github/workflows/pre-commit.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000000..e36bc13f2054 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,23 @@ +name: pre-commit + +on: [push, pull_request] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files From df3aa9152fd03a099eeb43f2ad5879361fd1b11f Mon Sep 17 00:00:00 2001 From: Nisayo Date: Sun, 19 May 2024 21:21:22 +0200 Subject: [PATCH 3/3] Update pre-commit.yml --- .github/workflows/pre-commit.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index e36bc13f2054..c66eaf5c81a1 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -21,3 +21,13 @@ jobs: - name: Run pre-commit run: pre-commit run --all-files + - name: Commit and push changes + if: github.event_name == 'push' + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Apply pre-commit fixes" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}