← Back to list

Automating MyFundedFutures Coupon Redemption with Python

A Python Script to Win Free Trading Accounts in Real-Time

Ori Meged · 2025-05-02 11:24 · 0 claps · 3.3 min read
#python #videos #live #script #cupon
Open on Medium ↗

Automating MyFundedFutures Coupon Redemption with Python

A Python Script to Win Free Trading Accounts in Real-Time

Introduction

MyFundedFutures, a leading futures proprietary trading firm, occasionally offers free trading accounts to the first 20 participants who redeem specific coupon codes during their YouTube live streams (MyFundedFutures YouTube Channel). These codes, announced in real-time, correspond to four account types: STARTER, STARTER PLUS, EXPERT, and Eval to Live. Each code must be entered on the correct account type’s checkout page on their website.

With only seconds to act, manually entering these codes is challenging. To secure one of these accounts, I developed a Python script that automates the process by capturing coupon codes from live streams and inputting them into the appropriate checkout page.

In this article, I’ll explain how the script works, its technical components, and how you can adapt it to compete for free trading accounts. The full code is provided, along with setup instructions and tips for optimization.

The Challenge

During MyFundedFutures’ live streams, coupon codes are displayed on-screen (e.g., “CODE: XYZ123”) alongside an account type (e.g., “STARTER PLUS”).

For example ,

The first 20 users to apply the code to the corresponding account type’s checkout page win a free account. The process requires:

  1. Watching the live stream for the coupon code and account type.
  2. Navigating to the correct checkout page (each account type has a dedicated tab).
  3. Entering the code and submitting it before others.

Manually performing these steps is slow, especially under time pressure. My solution automates this by:

  • Capturing the live stream’s video feed.
  • Extracting text using Optical Character Recognition (OCR).
  • Identifying the coupon code and account type.
  • Simulating keyboard inputs to switch tabs and submit the code.

The Solution: A Python Script

The Python script uses screen capture, OCR, and keyboard automation to streamline the process. Here’s how it works:

  1. Screen Capture with MSS

The script captures the lower half of the screen, where coupon codes typically appear during live streams, using the mss library for fast screenshots.

python

with mss.mss() as sct: screen = sct.monitors[1] monitor = { "top": screen["height"] // 2, "left": 0, "width": screen["width"], "height": screen["height"] // 2 }

  1. Text Extraction with Tesseract OCR

The pytesseract library, paired with PIL, extracts text from screenshots. The script looks for a pattern like :<word> (e.g., “CODE: XYZ123”) to capture the coupon code.

python

key_pattern = r"\:\s*(\w+)" code_match = re.search(key_pattern, text) if code_match: code_word = code_match.group(1)

  1. Account Type Detection

The script uses regular expressions to detect one of four account types: STARTER, STARTER PLUS, EXPERT, or Eval to Live. Each type is associated with a specific number of Ctrl + Tab presses to switch to the correct browser tab.

python

starter_plus_pattern = r"\bSTARTER PLUS\b" starter_pattern = r"\bSTARTER\b(?!\s*PLUS)" expert_pattern = r"\bEXPERT\b" eval_to_live_pattern = r"\bEval to Live\b"

  • Eval to Live: 4 presses
  • STARTER PLUS: 3 presses
  • EXPERT: 2 presses
  • STARTER: 1 press
  1. Keyboard Automation with PyAutoGUI

Once the code and account type are identified, pyautogui simulates keyboard actions:

  • Switches to the correct tab using Ctrl + Tab.
  • Types the coupon code.
  • Presses Tab, Enter, and 5 additional Tab keys to navigate the checkout form.
  • Waits 10 seconds to allow the form to process.

python

for _ in range(Ctrl_tab_count): pyautogui.hotkey('ctrl', 'tab') time.sleep(0.1) pyautogui.write(code_word) pyautogui.press('tab') pyautogui.press('enter') for _ in range(5): pyautogui.press('tab') time.sleep(10)

Full code:

import time
import re
from PIL import Image
from pytesseract import pytesseract
import mss
import pyautogui

# Defining path to tesseract.exe
path_to_tesseract = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
pytesseract.tesseract_cmd = path_to_tesseract

# Configure pyautogui
pyautogui.FAILSAFE = True  # Move mouse to top-left corner to stop the script
pyautogui.PAUSE = 0.05  # Reduced pause for faster keyboard actions

# Get screen dimensions and define the lower half region
with mss.mss() as sct:
    screen = sct.monitors[1]
    monitor = {
        "top": screen["height"] // 2,
        "left": 0,
        "width": screen["width"],
        "height": screen["height"] // 2
    }

def capture_and_extract_text():
    with mss.mss() as sct:
        screenshot = sct.grab(monitor)
        img = Image.frombytes("RGB", screenshot.size, screenshot.rgb)

    text = pytesseract.image_to_string(img)

    key_pattern = r"\:\s*(\w+)"
    code_match = re.search(key_pattern, text)

    if code_match:
        code_word = code_match.group(1)

        starter_plus_pattern = r"\bSTARTER PLUS\b"
        starter_pattern = r"\bSTARTER\b(?!\s*PLUS)"
        expert_pattern = r"\bEXPERT\b"
        eval_to_live_pattern = r"\bEval to Live\b"

        starter_plus_match = re.search(starter_plus_pattern, text)
        starter_match = re.search(starter_pattern, text)
        expert_match = re.search(expert_pattern, text)
        eval_to_live_match = re.search(eval_to_live_pattern, text)

        Ctrl_tab_count = 0

        if eval_to_live_match:
            Ctrl_tab_count = 4
        elif starter_plus_match:
            Ctrl_tab_count = 3
        elif expert_match:
            Ctrl_tab_count = 2
        elif starter_match:
            Ctrl_tab_count = 1

        if Ctrl_tab_count > 0:
            print("-" * 50)
            for _ in range(Ctrl_tab_count):
                pyautogui.hotkey('ctrl', 'tab')
                time.sleep(0.1)
            print(code_word + "!!!!")
            pyautogui.write(code_word)
            pyautogui.press('tab')
            pyautogui.press('enter')
            for _ in range(5):
                pyautogui.press('tab')
            time.sleep(10)

try:
    while True:
        capture_and_extract_text()
        time.sleep(0.05)
except KeyboardInterrupt:
    print("Stopped by user.")

메타데이터
post_id
6b347ecb9a5c
slug
automating-myfundedfutures-coupon-redemption-with-python-6b347ecb9a5c
url
https://medium.com/@orimeged4/automating-myfundedfutures-coupon-redemption-with-python-6b347ecb9a5c
canonical_url
https://medium.com/@orimeged4/automating-myfundedfutures-coupon-redemption-with-python-6b347ecb9a5c
author_url
https://medium.com/@orimeged4
status
ok
fetched_at
2026-07-20 02:25:49