Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9d88e6
fileutils unit tests
bug-or-feature Dec 20, 2025
a4541c0
removing unused import
bug-or-feature Dec 20, 2025
f4e7914
replace os.path with pathlib
bug-or-feature Dec 23, 2025
1df3908
start refactor of fileutils
bug-or-feature Dec 23, 2025
4731282
tests refactored
bug-or-feature Dec 29, 2025
e319e6f
handle mixed module and file names
bug-or-feature Dec 29, 2025
ad54e9d
run tests
bug-or-feature Dec 29, 2025
aa7c547
fix parquet path
bug-or-feature Dec 30, 2025
7f7e171
making data.futures.csvconfig a module
bug-or-feature Dec 30, 2025
ee90c5a
adding a specific test for instrument config
bug-or-feature Dec 30, 2025
7dc7877
deal with private config
bug-or-feature Dec 30, 2025
d83e296
revert
bug-or-feature Jan 2, 2026
77cf1da
revert
bug-or-feature Jan 2, 2026
899778a
revert
bug-or-feature Jan 2, 2026
22d53d0
pass full path for prod logging config
bug-or-feature Jan 2, 2026
e72e19b
deprecation warning for not passing filename
bug-or-feature Jan 2, 2026
1665c28
passing config defaults filename separately
bug-or-feature Jan 2, 2026
221f8f2
simplify config
bug-or-feature Jan 5, 2026
ec5b091
better type hints
bug-or-feature Jan 6, 2026
f4b9f24
new file resolving implementation
bug-or-feature Jan 13, 2026
96542be
tidy
bug-or-feature Jan 19, 2026
ac8220c
docs updated
bug-or-feature Jan 19, 2026
fc6f33f
tests updated
bug-or-feature Jan 19, 2026
3fab4dc
fix absolute
bug-or-feature Jan 19, 2026
4b9ee1f
Merge branch 'develop' into feature_xxx_fileutils-refactor
bug-or-feature Feb 23, 2026
a60c6d9
Merge branch 'develop' into feature-1603-improve-path-resolution
bug-or-feature Feb 25, 2026
2933e1b
add trading hours tests
bug-or-feature Feb 25, 2026
3742a3f
ensure all config files are present in normal install
bug-or-feature Feb 25, 2026
7202194
ensure __main__ function for all sysproduction scripts
bug-or-feature Feb 25, 2026
d0dff89
black
bug-or-feature Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/os-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install .
python -m pip install '.[dev]'

- name: Test with pytest
run: |
pytest syscore/tests/test_fileutils.py
26 changes: 25 additions & 1 deletion docs/backtesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3123,7 +3123,6 @@ resolve_path_and_filename_for_package("\\home/rob.file.csv")

```


These functions are used internally whenever a file name is passed in, so feel free to use any of these file formats when specifying eg a configuration filename.
```
### Absolute: Windows (note use of double backslash in str)
Expand All @@ -3136,6 +3135,31 @@ These functions are used internally whenever a file name is passed in, so feel f
"syscore.tests.pricedata.csv"
```

Obviously, using 'dots' as a separator brings limitations, like supporting directories or files with 'dots' in their names. This won't work:
```
>>> resolve_path_and_filename_for_package("syscore/tests/price.test.data.csv")
'/home/user/pysystemtrade/syscore/tests/price/test/data.csv'
```

do this instead:
```
>>> resolve_path_and_filename_for_package("syscore/tests", "price.test.data.csv")
'/home/user/pysystemtrade/syscore/tests/price.test.data.csv'
```

This will also not work:
```
>>> get_resolved_pathname("data/dir.with.dots")
'/home/user/pysystemtrade/data/dir/with/dots'
```

do this instead:
```
>>> from pathlib import Path
>>> get_resolved_pathname(Path("data/dir.with.dots"))
'/home/user/pysystemtrade/data/dir.with.dots'
```

## Logging

### Basic logging
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[build-system]
requires = ["setuptools >= 61.0"]
requires = [
"setuptools >= 61.0",
"setuptools-scm >= 8.0"
]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -47,8 +50,11 @@ find = {}

[tool.setuptools.package-data]
"data" = ["*.csv"]
"data.futures" = ["*.csv"]
"private" = ["*.yaml"]
"sysbrokers" = ["*.csv", "*.yaml"]
"sysbrokers" = ["*.csv"]
"sysbrokers.IB" = ["*.yaml"]
"sysbrokers.IB.config" = ["*.csv"]
"syscontrol" = ["*.yaml"]
"sysdata" = ["*.csv"]
"sysdata.config" = ["*.yaml"]
Expand Down
25 changes: 17 additions & 8 deletions sysbrokers/IB/ib_trading_hours.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
import datetime
from ib_insync import ContractDetails as ibContractDetails

from sysdata.config.private_directory import get_full_path_for_private_config
from sysdata.config.private_config import (
get_private_config_dir,
)
from sysobjects.production.trading_hours.trading_hours import (
tradingHours,
listOfTradingHours,
)
from syscore.fileutils import does_filename_exist
from syscore.fileutils import (
does_resolved_filename_exist,
resolve_path_and_filename_for_package,
)
from sysdata.config.production_config import get_production_config
from sysdata.production.trading_hours import read_trading_hours

IB_CONFIG_TRADING_HOURS_FILE = "sysbrokers.IB.ib_config_trading_hours.yaml"
PRIVATE_CONFIG_TRADING_HOURS_FILE = get_full_path_for_private_config(
"private_config_trading_hours.yaml"
)
PRIVATE_CONFIG_TRADING_HOURS_FILE = "private_config_trading_hours.yaml"


def get_saved_trading_hours():
if does_filename_exist(PRIVATE_CONFIG_TRADING_HOURS_FILE):
return read_trading_hours(PRIVATE_CONFIG_TRADING_HOURS_FILE)
private_path = resolve_path_and_filename_for_package(
get_private_config_dir(), PRIVATE_CONFIG_TRADING_HOURS_FILE
)
if does_resolved_filename_exist(private_path):
return read_trading_hours(private_path)
else:
return read_trading_hours(IB_CONFIG_TRADING_HOURS_FILE)
default_path = resolve_path_and_filename_for_package(
IB_CONFIG_TRADING_HOURS_FILE
)
return read_trading_hours(default_path)


def get_trading_hours_from_contract_details(
Expand Down
7 changes: 7 additions & 0 deletions syscore/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from importlib.util import find_spec
from pathlib import Path

module_spec = find_spec(__name__)
path = Path(module_spec.origin)

PYSYS_PROJECT_DIR = path.parent.parent
Loading