Skip to content

Commit

Permalink
Merge branch 'robcarver17:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcodespoorly authored Jan 30, 2024
2 parents 32df147 + bcfd966 commit de7066b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 23 deletions.
21 changes: 4 additions & 17 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,13 @@ And now install the dependencies

### MacOS (ARM)

If you're running MacOS on one of the new ARM chips, the process is more complex. You'll need Homebrew and the Apple XCode Commandline Development Tools, configured for ARM. Doing that is beyond the scope of this document, type `homebrew apple xcode command line tools` into your favourite search engine. Once installed and configured, install *cython*:
If you're running MacOS on one of the new ARM chips, the process is more complex. You'll need Homebrew and the Apple XCode Commandline Development Tools, configured for ARM. Doing that is beyond the scope of this document, type `homebrew apple xcode command line tools` into your favourite search engine. Once installed and configured, run installation script:

```
(3.8.16) $ OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.6 python -m pip install cython --no-use-pep517
```

Then the key dependencies

```
(3.8.16) $ OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.6 python -m pip install "numpy>=1.19.4,<1.24.0" --no-use-pep517
(3.8.16) $ OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.6 python -m pip install scipy --no-use-pep517
(3.8.16) $ OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.6 python -m pip install pandas==1.0.5 --no-use-pep517
(3.8.16) $ OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.6 python -m pip install statsmodels==0.12.2 --no-use-pep517
```

Then the remaining dependencies

```
(3.8.16) $ pip install -r requirements.txt
chmod u+x install_dependencies_apple_silicon.sh
./install_dependencies_apple_silicon.sh
```
Note: this may (unfortunately) become out of date and require some tweaking.

### Check dependencies, all OSs

Expand Down
11 changes: 11 additions & 0 deletions install_dependencies_apple_silicon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Cython 3.0.0 is not supported by pandas 1.0.5
python -m pip install "cython<3.0.0" wheel
python -m pip install pyyaml==5.4.1 --no-build-isolation
python -m pip install "numpy>=1.19.4,<1.24.0" --no-use-pep517
python -m pip install scipy --no-use-pep517
python -m pip install pandas==1.0.5 --no-use-pep517
python -m pip install statsmodels==0.12.2 --no-use-pep517

pip install -r requirements_apple_silicon.txt
9 changes: 9 additions & 0 deletions requirements_apple_silicon.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
matplotlib>=3.0.0
pymongo==3.11.3
arctic==1.79.2
ib-insync==0.9.86
psutil==5.6.6
pytest>6.2
Flask>=2.0.1
Werkzeug>=2.0.1
PyPDF2>=2.5.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def dir_this_file():
long_description=read("README.md"),
install_requires=[
"pandas==1.0.5",
"matplotlib>=3.0.0",
"matplotlib>=3.0.0,<3.8.0",
"ib-insync==0.9.86",
"PyYAML>=5.4",
"numpy>=1.19.4,<1.24.0",
Expand Down
16 changes: 11 additions & 5 deletions sysexecution/stack_handler/roll_orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,17 @@ def get_strategy_name_with_largest_position_for_instrument(
diag_positions.get_all_current_strategy_instrument_positions()
)

return (
all_instrument_positions.strategy_name_with_largest_abs_position_for_instrument(
instrument_code
)
)
try:
strategy_name = all_instrument_positions.strategy_name_with_largest_abs_position_for_instrument(
instrument_code
)
except:
## corner case where nets out to 0
strategies = diag_positions.get_list_of_strategies_with_positions()
strategy_name = strategies[0]
data.log.debug("No strategies have net positions in %s, using arbitrary strategy %s" % (instrument_code, strategy_name))

return strategy_name


def create_contract_roll_orders(
Expand Down

0 comments on commit de7066b

Please sign in to comment.