def __init__(self):
        """The Twitter Elon Musk Doge Tracker constructor"""

        super(TwitterElonMuskDogeTracker, self).__init__()

        # Init API
        self.twitter_api: TwitterApi = TwitterApi()
        self.ftx_rest_api: FtxRestApi = FtxRestApi()

        # Init local values
        self.last_tweet: dict = {"id": None, "text": ""}
        self.new_tweet: bool = False
        self.first_loop: bool = True
        self.last_tweet_doge_oriented_probability: ProbabilityEnum = ProbabilityEnum.NOT_PROBABLE
        self.lock: threading.Lock = threading.Lock()

        # Init stock acquisition / order decision maker / position driver
        self.doge_manager: CryptoPairManager = CryptoPairManager(
            "DOGE-PERP", self.ftx_rest_api, self.lock)
        self.doge_manager.add_time_frame(15)
        self.doge_manager.start_all_time_frame_acq()
        self.order_decision_maker: OrderDecisionMaker = OrderDecisionMaker(
            self.doge_manager.get_time_frame(15).stock_data_manager)
        self.position_driver: PositionDriver = PositionDriver(
            self.ftx_rest_api,
            self.doge_manager.get_time_frame(15).stock_data_manager, self.lock)
Example #2
0
    def __init__(self):
        """The Twitter Elon Musk Doge Tracker constructor"""

        logging.info("TwitterElonMuskDogeTracker run strategy")
        super(TwitterElonMuskDogeTracker, self).__init__()

        self.ftx_rest_api: FtxRestApi = FtxRestApi()

        # Init local values
        self.last_tweet: dict = {"id": None, "text": ""}
        self.new_tweet: bool = False
        self.first_loop: bool = True
        self.last_tweet_doge_oriented_probability: ProbabilityEnum = ProbabilityEnum.NOT_PROBABLE
        self.deciding_timeout = DEFAULT_DECIDING_TIMEOUT
        self.is_deciding = False

        # Init stock acquisition / order decision maker / position driver
        self.doge_manager: CryptoPairManager = CryptoPairManager(
            "DOGE-PERP", self.ftx_rest_api)
        self.doge_manager.add_time_frame(15)
        self.doge_manager.start_all_time_frame_acq()
        self.order_decision_maker: OrderDecisionMaker = OrderDecisionMaker(
            self.doge_manager.get_time_frame(15).stock_data_manager)
        self.position_driver: PositionDriver = PositionDriver(
            self.ftx_rest_api)
    def __init__(self):
        """The listing sniper strategy constructor"""

        logging.info("ListingSniper run strategy")
        super(ListingSniper, self).__init__()

        self._sniped = False
        self.ftx_rest_api: FtxRestApi = FtxRestApi()
    def __init__(self):
        """The best strategy ever constructor"""

        logging.info("BestStrategyEver run strategy")
        super(BestStrategyEver, self).__init__()

        self.ftx_ws_client: FtxWebsocketClient = FtxWebsocketClient()
        self.ftx_ws_client.connect()
        self.ftx_rest_api: FtxRestApi = FtxRestApi()
Example #5
0
    def __init__(self):
        """The demo strategy constructor"""
        logging.info("DemoStrategy run strategy")
        super(DemoStrategy, self).__init__()

        self.ftx_rest_api: FtxRestApi = FtxRestApi()
        self.btc_pair_manager: CryptoPairManager = CryptoPairManager(
            "BTC-PERP", self.ftx_rest_api)
        self.btc_pair_manager.add_time_frame(15)
        self.btc_pair_manager.add_time_frame(60)
        self.btc_pair_manager.start_all_time_frame_acq()
Example #6
0
    def __init__(self):
        """The High frequency trading strategy constructor"""

        logging.info("HighFrequencyTrading run strategy")
        super(TrendFollow, self).__init__()

        self.ftx_rest_api: FtxRestApi = FtxRestApi()
        self.ftx_ws_client: FtxWebsocketClient = FtxWebsocketClient()
        self.ftx_ws_client.connect()

        # Init stock acquisition / or / position driver
        self.btc_manager: CryptoPairManager = CryptoPairManager(
            MARKET, self.ftx_rest_api)
        self.btc_manager.add_time_frame(15)
        self.btc_manager.start_all_time_frame_acq()
        self.position_driver: PositionDriver = PositionDriver(
            self.ftx_rest_api, 10)

        # Init loop vars
        self.current_position_side = SideEnum.BUY
        self.last_position_state = PositionStateEnum.NOT_OPENED
    def __init__(self):
        """The multi coin abnormal volume tracker strategy constructor"""

        logging.info("MultiCoinAbnormalVolumeTracker run strategy")
        super(MultiCoinAbnormalVolumeTracker, self).__init__()

        # Deactivate stock data log for readability purposes
        TimeFrameManager.log_received_stock_data = False

        self.ftx_rest_api: FtxRestApi = FtxRestApi()
        self.pair_manager_list = {}  # { [pair]: pair_manager }

        self.total_invested = 0

        # Compute all market volume during the last SHORT_MA_VOLUME_DEPTH candles to apply a coefficient on
        # VOLUME_CHECK_FACTOR_SIZE accordingly (the more the market is volume is pumping, the more it will be difficult
        # to trigger VOLUME_CHECK_FACTOR_SIZE check
        self.current_market_volume_indicator = 1

        i = 0
        for pair_to_track in PAIRS_TO_TRACK:
            i += 1
            print(
                f"Initializing pair {i} of {len(PAIRS_TO_TRACK)}: {pair_to_track}"
            )
            crypto_pair_manager = CryptoPairManager(pair_to_track,
                                                    self.ftx_rest_api)
            crypto_pair_manager.add_time_frame(60, False)
            crypto_pair_manager.start_all_time_frame_acq()

            pair_manager: PairManagerDict = {
                "crypto_pair_manager": crypto_pair_manager,
                "position_driver": None,
                "last_position_driver_state": PositionStateEnum.NOT_OPENED,
                "jail_start_timestamp": 0,
                "invested": 0
            }

            self.pair_manager_list[pair_to_track] = pair_manager
            time.sleep(TIME_TO_SLEEP_BETWEEN_TIMEFRAME_LAUNCH)