Skip to content

Commit

Permalink
inlcude samples in pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaron committed Aug 25, 2024
1 parent c3e9743 commit 6ffcfa7
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 20 deletions.
2 changes: 1 addition & 1 deletion bin/local_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm -rf ./runs

# QA
flake8 roboquant tests || exit 1
pylint roboquant tests samples || exit 1
pylint roboquant tests || exit 1
python -m unittest discover -s tests/unit || exit 1

# Build
Expand Down
2 changes: 1 addition & 1 deletion bin/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm -rf ./runs

# QA
flake8 || exit 1
pylint roboquant tests samples || exit 1
pylint roboquant tests || exit 1
python -m unittest discover -s tests/unit || exit 1

# Build
Expand Down
2 changes: 1 addition & 1 deletion bin/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source .venv/bin/activate

# QA
flake8 || exit 1
pylint roboquant tests samples || exit 1
pylint roboquant tests || exit 1
python -m unittest discover -s tests/unit || exit 1

echo "All tests passed"
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ testpaths = [

[tool.pyright]
reportOptionalOperand = "none"
# exclude = ["samples/*.py", "scratch/*.py"]

[tool.pylint.MASTER]
ignore-paths = 'samples'

[tool.pylint.'MESSAGES CONTROL']
max-line-length = 127
disable = "too-few-public-methods,missing-module-docstring,missing-class-docstring,missing-function-docstring,unnecessary-ellipsis"
disable = "too-few-public-methods,missing-module-docstring,missing-class-docstring,missing-function-docstring,unnecessary-ellipsis,invalid-name"
max-args = 15
max-locals = 20
max-attributes = 10
Expand Down
Empty file added tests/samples/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/samples/monetary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# %%
from roboquant.monetary import EUR, USD, JPY, ECBConversion, Amount
from datetime import datetime
from roboquant.monetary import EUR, USD, JPY, ECBConversion, Amount

# %%
# Different ways to create Amounts and add them to a wallet
Expand Down
11 changes: 0 additions & 11 deletions tests/samples/parquet_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,3 @@
feed = ParquetFeed("/tmp/stocks.parquet")
if not feed.exists():
feed.record(yahoo_feed)

# %%
# split the feed timeframe in 4 equal parts
timeframes = feed.timeframe().split(4)

# %%
# run a walkforward back-test on each timeframe
for timeframe in timeframes:
strategy = rq.strategies.EMACrossover(13, 26)
account = rq.run(feed, strategy, timeframe=timeframe)
print(f"{timeframe} equity={account.equity()}")
2 changes: 2 additions & 0 deletions tests/samples/talib_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from roboquant.ml.features import TaFeature
from roboquant.strategies.buffer import OHLCVBuffer

# pylint: disable=no-member


# %%
class RSIFeature(TaFeature):
Expand Down
3 changes: 3 additions & 0 deletions tests/samples/talib_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
from roboquant.signal import Signal
from roboquant.strategies import OHLCVBuffer, TaStrategy

# pylint: disable=no-member


# %%
class MyStrategy(TaStrategy):
"""Example using talib to create a combined RSI/BollingerBand strategy"""

def process_asset(self, asset: rq.Asset, ohlcv: OHLCVBuffer):

close = ohlcv.close()

rsi = ta.RSI(close, timeperiod=self.size - 1) # type: ignore
Expand Down

0 comments on commit 6ffcfa7

Please sign in to comment.