Skip to content

Instantly share code, notes, and snippets.

@StefanBelo
Last active August 19, 2019 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanBelo/db014f0e5fbecbc7672576759763fdd9 to your computer and use it in GitHub Desktop.
Save StefanBelo/db014f0e5fbecbc7672576759763fdd9 to your computer and use it in GitHub Desktop.
#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