Skip to content

fix: restore compatibility with modern Python/pandas/TensorFlow#1

Merged
victalejo merged 2 commits into
masterfrom
fix/modernize-deps
May 20, 2026
Merged

fix: restore compatibility with modern Python/pandas/TensorFlow#1
victalejo merged 2 commits into
masterfrom
fix/modernize-deps

Conversation

@victalejo
Copy link
Copy Markdown
Owner

Summary

The project no longer installed or ran on a fresh environment because dependencies and several call sites were 5+ years old. This PR fixes the breaking changes so pip install -r requirements.txt && python -c "import iq, training, testing" works again on Python 3.10+ with modern pandas/TF.

  • requirements.txt: switch git:// (deprecated by GitHub in 2022) to https://, relax pins to numpy>=1.23,<2.0, pandas>=2.0,<3.0, tensorflow>=2.13,<3.0, scikit-learn>=1.3,<2.0
  • iq.py: replace DataFrame.append() (removed in pandas 2.0) with pd.concat() in get_all_candles and fast_data
  • training.py:
    • drop("future", 1)drop("future", axis=1) (positional axis no longer accepted)
    • Adam(lr=LEARNING_RATE, decay=5e-5)Adam(learning_rate=LEARNING_RATE) (lr kwarg removed, decay is no longer a constructor arg in Keras 3 — equivalent behavior now requires a learning-rate schedule)
    • monitor='val_acc'monitor='val_accuracy' so ModelCheckpoint actually saves the best epoch instead of silently keeping nothing

Test plan

Validated end-to-end in a clean Python 3.12.3 venv with the new requirements (tensorflow-cpu 2.16.2):

  • uv pip install --dry-run -r requirements.txt resolves 49 packages with no conflicts
  • pip install -r requirements.txt succeeds (numpy 1.26.4, pandas 2.3.3, scikit-learn 1.8.0, TF 2.16.2)
  • import iq works; fast_data/get_all_candles inner loop produces correct DataFrame with synthetic candles
  • import training works; classify() returns expected values
  • import testing reaches the live while(1): loop with stubbed login/load_model (defaults bet_money=1 ratio='EURUSD' martingale=2)
  • preprocess_df returns balanced X.shape=(28,5,9) from synthetic OHLCV
  • The exact LSTM model from train_data() compiles (339 554 params) with Adam(learning_rate=) and trains 1 epoch end-to-end (val_accuracy metric available)

Not validated (requires real credentials / IQ Option network):

  • Real login to IQ Option API
  • Live candle schema parity
  • End-to-end betting loop behavior

🤖 Generated with Claude Code

Pinned versions were ~5 years old and the project no longer installs or
runs on a fresh environment:

- requirements.txt: switch git:// (deprecated by GitHub since 2022) to
  https://, relax pins to numpy>=1.23, pandas>=2.0, tensorflow>=2.13,
  scikit-learn>=1.3 so installs succeed on Python 3.10+
- iq.py: replace DataFrame.append() (removed in pandas 2.0) with
  pd.concat() in get_all_candles and fast_data
- training.py: drop("future", 1) -> drop("future", axis=1) for pandas
  2.x; Adam(lr=, decay=) -> Adam(learning_rate=) (lr kwarg removed,
  decay no longer a constructor arg in Keras 3); val_acc -> val_accuracy
  so the ModelCheckpoint actually saves the best epoch

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74c63ec887

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread training.py Outdated
ModelCheckpoint in Keras 3 (bundled with TF 2.16+) rejects custom
extensions like .model and requires .keras (whole model) or .weights.h5
(weights only). The previous suffix would have aborted training as soon
as val_accuracy improved.

- training.py:220: "models/{}.model" -> "models/{}.keras"
- testing.py:125, 139: train_data() + '.model' -> + '.keras'

Validated end-to-end with TF 2.16.2: ModelCheckpoint saves on
val_accuracy improvement, load_model() reloads the file, and the
restored model produces valid softmax predictions (339 554 params
preserved).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@victalejo victalejo merged commit d587065 into master May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant