Strat is as follows, at min 79 of a game, I place a lay bet on the next goal market for a max period of 5 mins, then take the profit offered or if a goal is scored then the trades ends.
The criteria are as follows.
Odds at minute 79 of the game must be between 1.7 & 3.0 on the next goal market,
Amount of £££ matched on BF must be over £10,000 (for liquidity purposes)
Lay xx ££ (amount is generally £5) on the next goal market (example score is 1-0 then it would be lay the 1.5G market)
Exit trade at min 84 or if profit has reached xx ££ amount (normally £1)
if a goal is scored during the trade, it automatically ends with a full loss.
Bfexplorer Solution:
The FootballNextGoalStrategyBotTrigger.fsx script defines a custom bot trigger for Bfexplorer, specifically designed for football "Next Goal" trading strategies. Here’s a summary of its functionality:
---
### **Purpose**
This bot trigger automates a trading strategy that operates on football "Match Odds" markets and, based on the match state and score, opens and trades on the corresponding "Next Goal" (Over/Under) market at a specified match time.
### **Key Components**
- **TriggerStatus (Discriminated Union):**
- Represents the internal state of the bot trigger, such as initialization, updating match score, opening next goal market, executing the strategy, waiting, or ending.
- **Parameters:**
- `MatchTimeToExecute`: The match minute when the strategy should execute (default: 79).
- `ExecuteOnUnderSelection`: Whether to execute on the "Under" selection (default: false).
- **State Variables:**
- `status`: Current trigger status.
- `footballMatch`: Holds the football match data.
- `timeToUpdate`: Controls when the next match score update is allowed.
- **Helper Functions:**
- `doReport`: Outputs messages to the Bfexplorer console.
- `isMatchOddsMarket`: Checks if the current market is a football match odds market.
- `canUpdateMatchScore`: Checks if enough time has passed to update the match score.
- `setNextUpdateMatchScore`: Schedules the next match score update.
- `matchScoreInitialized` and `matchScoreUpdated`: Handle the result of match score updates, including reporting and state transitions.
- `getOverUnderMarket` and `getMarketTypesToOpen`: Build the market type string for the next goal Over/Under market.
- `associatedMarketsOpened`: Handles the result of opening associated markets.
- `executeMyStrategy`: Executes the trading action on the selected market and selection.
- **IBotTrigger Implementation:**
- **Execute:** The main state machine. Depending on `status`, it:
- Initializes and loads match data.
- Periodically updates the match score.
- Opens the next goal market when the match time threshold is reached.
- Executes the trading strategy on the appropriate selection.
- Waits for operations or ends execution as needed.
- **EndExecution:** Cleans up when the bot ends.
### **How It Works (Flow)**
1. **Initialization:**
Checks if the market is a football match odds market. If so, loads match data and requests a match score update.
2. **Match Score Updates:**
Periodically updates the football match score (every 15 seconds).
3. **Triggering the Strategy:**
When the match time reaches the configured threshold (e.g., 79th minute), it opens the next goal Over/Under market.
4. **Executing the Strategy:**
Once the associated market is open, it executes the trading action on the specified selection (Over or Under).
5. **Reporting:**
Throughout, it reports status and match information to the Bfexplorer output.
6. **State Management:**
Uses the `TriggerStatus` union to manage and transition between different operational states.
**In summary:**
This script is a stateful, event-driven bot trigger for football trading in Bfexplorer. It automates the process of monitoring a match, opening the next goal market at a specific time, and executing a trading strategy, with periodic reporting and robust state management.