Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Bfexplorer cannot be held responsible for any losses or damages incurred during the use of this betfair bot.
// It is up to you to determine the level of risk you wish to trade under.
// Do not gamble with money you cannot afford to lose.
module BfexplorerBot
//(*
#I @"C:\Program Files (x86)\BeloSoft\Bfexplorer\"
#r "BeloSoft.Data.dll"
#r "BeloSoft.Bfexplorer.Domain.dll"
#r "BeloSoft.Bfexplorer.Trading.dll"
#r "BeloSoft.Bfexplorer.Service.Core.dll"
//*)
open BeloSoft.Bfexplorer.Domain
open BeloSoft.Bfexplorer.Trading
/// <summary>
/// TriggerStatus
/// </summary>
type TriggerStatus =
| Initialize
| ShowData
/// <summary>
/// ShowPriceTradedVolume
/// </summary>
type ShowPriceTradedVolume(_market : Market, selection : Selection, _botName : string, _botTriggerParameters : BotTriggerParameters, _myBfexplorer : IMyBfexplorer) =
let mutable status = TriggerStatus.Initialize
interface IBotTrigger with
/// <summary>
/// Execute
/// </summary>
member __.Execute() =
match status with
| TriggerStatus.Initialize ->
status <- TriggerStatus.ShowData
// If not using streaming, you must enable ladder update.
// When you choose a selection in bfexplorer it is enabled automatically.
selection.PriceGridDataEnabled <- true
TriggerResult.WaitingForOperation
| TriggerStatus.ShowData ->
let dataContext = selection.PriceGridData.DataContext
let bestToBackIndex = dataContext.BestToBackIndex
let bestToLayIndex = dataContext.BestToLayIndex
TriggerResult.EndExecutionWithMessage (sprintf "\n%s:\n%s" selection.Name (
[
bestToBackIndex - 4; bestToBackIndex - 2; bestToBackIndex
bestToLayIndex; bestToLayIndex + 2; bestToLayIndex + 4
]
|> List.filter (fun index -> index >= 0 && index <= OddsData.LastOddsIndex)
|> List.map (fun index ->
let priceData = dataContext.GetPriceData(index)
sprintf "%.2f: %.2f" priceData.Price priceData.TotalMatched
)
|> String.concat "\n"
))
/// <summary>
/// EndExecution
/// </summary>
member __.EndExecution() =
()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.