Skip to content

Instantly share code, notes, and snippets.

View Canx's full-sized avatar

Ruben Cancho Canx

View GitHub Profile
@Canx
Canx / adjust_trade_posicion.py
Last active January 4, 2025 16:18
idea for improving adjust_trade_position function
def adjust_trade_position(
self,
trade: Trade,
current_time: datetime,
current_rate: float,
current_profit: float,
min_stake: Optional[float],
max_stake: float,
current_entry_rate: float,
current_exit_rate: float,
This file has been truncated, but you can view the full file.
import copy
import logging
import pathlib
import rapidjson
import numpy as np
import talib.abstract as ta
import pandas as pd
import pandas_ta as pta
from freqtrade.strategy.interface import IStrategy
from freqtrade.strategy import merge_informative_pair
@Canx
Canx / informative_indicators.py
Created December 14, 2024 09:23
Gemini 2 informative_indicators refactoring
import time
import logging
import pandas as pd
import pandas_ta as pta
import numpy as np
from pandas import DataFrame
from typing import Dict
log = logging.getLogger(__name__)
@Canx
Canx / NFIX5_analysis.md
Last active March 6, 2025 03:05
Analysis of NostalgiaForInfinityX5 signals
@Canx
Canx / _df in stats_summary
Created July 1, 2024 06:36
backtest_date_fix
lumibot_original:
portfolio_value cash return
datetime
2023-03-03 09:30:00-05:00 100000.000000 100000.000000 NaN
2023-03-04 09:30:00-05:00 100000.000000 60029.000854 0.000000 <- these stats are from friday!!!
2023-03-06 09:30:00-05:00 100729.000854 100729.000854 0.007290 <- these stats are from weekend!
2023-03-07 09:30:00-05:00 100729.000854 100729.000854 0.000000 <- monday (6)
2023-03-08 09:30:00-05:00 100923.100464 160681.602661 0.001927 <- tuesday (7)
2023-03-09 09:30:00-05:00 100720.604126 160681.602661 -0.002006 <- wednesday (8)
@Canx
Canx / polygon_client.py
Created May 24, 2024 07:22
thread safe PolygonClient
class PolygonClient(RESTClient):
''' Rate Limited RESTClient with factory method '''
WAIT_SECONDS = 12
_class_lock = threading.Lock()
@classmethod
def create(cls, *args, **kwargs) -> RESTClient:
if 'api_key' not in kwargs:
kwargs['api_key'] = os.environ.get("POLYGON_API_KEY")
class RLRESTClient(RESTClient):
''' Rate Limited RESTClient '''
def __init__(self, *args, **kwargs):
self.paid = kwargs.pop('paid', True)
self.seconds = 60
super().__init__(*args, **kwargs)
def _get(self, *args, **kwargs):
if not self.paid:
print(
import time
from polygon import RESTClient
def apply_sleep_to_polygon_api_calls(sleep=60):
from polygon.rest import BaseClient
# Save a reference to the original method
original_get = BaseClient._get
# Define a new version of the _get method
#!/bin/bash
sudo apt-get install autoconf automake libtool
git clone https://github.com/TA-Lib/ta-lib.git
cd ta-lib
chmod +x autogen.sh
./autogen.sh
./configure
make
sudo make install
@Canx
Canx / header_checks
Created December 1, 2023 12:46
configuracion postfix para envio desde centros
/^From:/ REPLACE From: <correo>
/^Sender:/ REPLACE Sender: <correo>
/^Reply-To:/ REPLACE Reply-To: <correo>
/^Subject:/ REPLACE Subject: Escaner