Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#I @"C:\Program Files (x86)\BeloSoft\Bfexplorer\"
#r "BeloSoft.Data.dll"
#r "BeloSoft.Bfexplorer.Domain.dll"
#r "BeloSoft.Bfexplorer.Service.Core.dll"
open System
open BeloSoft.Data
open BeloSoft.Bfexplorer.Domain
open BeloSoft.Bfexplorer.Service
let [<Literal>] MyTimeInMinutes = 10.0
// Comment this line for runtime
//let bfexplorer : IBfexplorerConsole = nil
async {
let! resultOpenMyFavouriteBetEvent = bfexplorer.OpenMyFavouriteBetEvent("Horse Racing")
if resultOpenMyFavouriteBetEvent.IsSuccessResult
then
let mutable time = DateTime.Now.AddMinutes(-MyTimeInMinutes)
let marketInfos =
bfexplorer.BetEventBrowserMarketCatalogs
|> List.map (fun marketCatalog -> marketCatalog.MarketInfo)
|> List.filter (fun marketInfo -> marketInfo.StartTime > time)
|> List.sortBy (fun marketInfo -> marketInfo.StartTime)
if marketInfos.Length > 0
then
time <- (marketInfos |> List.head).StartTime.AddMinutes(-MyTimeInMinutes)
let myMarketInfos = ResizeArray<MarketInfo>()
marketInfos
|> List.iter (fun marketInfo ->
if (marketInfo.StartTime - time).TotalMinutes >= MyTimeInMinutes
then
myMarketInfos.Add(marketInfo)
time <- marketInfo.StartTime
)
let! resultStartMyBotStrategy = bfexplorer.StartMyBotStrategy("Start Monitoring", TimeSpan.FromMinutes(-MyTimeInMinutes), 1.0, myMarketInfos)
if not resultStartMyBotStrategy.IsSuccessResult
then
printf "%s" resultStartMyBotStrategy.FailureMessage
else
printf "%s" resultOpenMyFavouriteBetEvent.FailureMessage
}
|> Async.RunSynchronously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment