Skip to content

Commit 52513a7

Browse files
committed
Fix and update
1 parent 095a208 commit 52513a7

8 files changed

+259
-396
lines changed

Diff for: .pre-commit-config.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
# General checks
44
##############################################################################
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.4.0
6+
rev: v4.5.0
77
hooks:
88
- id: fix-encoding-pragma
99
args: [--remove]
@@ -24,7 +24,7 @@ repos:
2424
- id: check-yaml
2525

2626
- repo: https://github.com/codespell-project/codespell
27-
rev: v2.2.4
27+
rev: v2.2.6
2828
hooks:
2929
- id: codespell
3030
description: Checks for common misspellings.
@@ -34,35 +34,35 @@ repos:
3434
# Python formatting and linting
3535
##############################################################################
3636
- repo: https://github.com/asottile/add-trailing-comma
37-
rev: v2.4.0
37+
rev: v3.1.0
3838
hooks:
3939
- id: add-trailing-comma
4040
name: add-trailing-comma
4141
types: [python]
4242

4343
- repo: https://github.com/psf/black
44-
rev: 23.3.0
44+
rev: 24.2.0
4545
hooks:
4646
- id: black
4747
types_or: [python, pyi]
4848
entry: "black"
4949

5050
- repo: https://github.com/charliermarsh/ruff-pre-commit
51-
rev: v0.0.269
51+
rev: v0.3.0
5252
hooks:
5353
- id: ruff
5454
args: ["--fix"]
5555

5656
- repo: https://github.com/pre-commit/mirrors-mypy
57-
rev: v1.3.0
57+
rev: v1.8.0
5858
hooks:
5959
- id: mypy
6060
args: [--no-strict-optional, --ignore-missing-imports, --warn-no-return, --explicit-package-bases]
6161
additional_dependencies: [types-pytz, types-redis, types-toml, types-requests, msgspec]
6262
exclude: "nautilus_server/backend/api_v1/endpoints/models*"
6363

6464
- repo: https://github.com/kynan/nbstripout
65-
rev: 0.6.1
65+
rev: 0.7.1
6666
hooks:
6767
- id: nbstripout
6868

@@ -75,7 +75,7 @@ repos:
7575
- id: jshint
7676

7777
- repo: https://github.com/pre-commit/mirrors-prettier
78-
rev: "v3.1.0"
78+
rev: "v4.0.0-alpha.8"
7979
hooks:
8080
- id: prettier
8181
args: ["--print-width", "160"]

Diff for: Dockerfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ENV PYTHONUNBUFFERED=1 \
44
PIP_NO_CACHE_DIR=off \
55
PIP_DISABLE_PIP_VERSION_CHECK=on \
66
PIP_DEFAULT_TIMEOUT=100 \
7-
POETRY_VERSION=1.7.1 \
7+
POETRY_VERSION=1.8.1 \
88
POETRY_HOME="/opt/poetry" \
99
POETRY_VIRTUALENVS_CREATE=false \
1010
POETRY_NO_INTERACTION=1 \
@@ -39,6 +39,3 @@ COPY ./nautilus_data $PYSETUP_PATH/nautilus_data
3939

4040
# Generate data catalog
4141
RUN python -m nautilus_data.hist_data_to_catalog
42-
43-
# Run backtest to generate data
44-
RUN python -m nautilus_data.example_backtest

Diff for: nautilus_data/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -------------------------------------------------------------------------------------------------
2+
# Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
3+
# https://nautechsystems.io
4+
#
5+
# Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6+
# You may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# -------------------------------------------------------------------------------------------------

Diff for: nautilus_data/example_backtest.py

-81
This file was deleted.

Diff for: nautilus_data/hist_data_to_catalog.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -------------------------------------------------------------------------------------------------
2-
# Copyright (C) 2015-2023 Nautech Systems Pty Ltd. All rights reserved.
2+
# Copyright (C) 2015-2024 Nautech Systems Pty Ltd. All rights reserved.
33
# https://nautechsystems.io
44
#
55
# Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
@@ -13,29 +13,43 @@
1313
# limitations under the License.
1414
# -------------------------------------------------------------------------------------------------
1515

16+
from os import PathLike
17+
from pathlib import Path
1618
import requests
19+
1720
from nautilus_trader.persistence.catalog import ParquetDataCatalog
1821
from nautilus_trader.persistence.wranglers import QuoteTickDataWrangler
1922
from nautilus_trader.test_kit.providers import CSVTickDataLoader
2023
from nautilus_trader.test_kit.providers import TestInstrumentProvider
2124

22-
from nautilus_data.util import CATALOG_DIR
25+
26+
ROOT = Path(__file__).parent.parent
27+
CATALOG_DIR = ROOT / "catalog"
28+
CATALOG_DIR.mkdir(exist_ok=True)
2329

2430

25-
def load_fx_hist_data(filename: str, currency: str, catalog_path: str) -> None:
31+
def load_fx_hist_data(
32+
filename: str,
33+
currency: str,
34+
catalog_path: PathLike[str] | str,
35+
) -> None:
2636
instrument = TestInstrumentProvider.default_fx_ccy(currency)
2737
wrangler = QuoteTickDataWrangler(instrument)
2838

2939
df = CSVTickDataLoader.load(filename, index_col=0, format="%Y%m%d %H%M%S%f")
3040
df.columns = ["bid_price", "ask_price", "size"]
3141
print(df)
3242

43+
print("Preparing ticks...")
3344
ticks = wrangler.process(df)
3445

46+
print("Writing data to catalog...")
3547
catalog = ParquetDataCatalog(catalog_path)
3648
catalog.write_data([instrument])
3749
catalog.write_data(ticks)
3850

51+
print("Done")
52+
3953

4054
def download(url: str) -> None:
4155
filename = url.rsplit("/", maxsplit=1)[1]

Diff for: nautilus_data/util.py

-21
This file was deleted.

0 commit comments

Comments
 (0)